Compare commits
No commits in common. "c8" and "c9" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
SOURCES/quota-4.04.tar.gz
|
SOURCES/quota-4.09.tar.gz
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
38e6cc7538d504891a8454bbdabef058bd1adc11 SOURCES/quota-4.04.tar.gz
|
5c215d869626b532be2773f4161bdcc8b9f97126 SOURCES/quota-4.09.tar.gz
|
||||||
|
|||||||
@ -1,180 +0,0 @@
|
|||||||
From a92dcf5a6cc49660d75a67966b0eb093b88e3b4c Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Tinguely, Mark" <mark.tinguely@hpe.com>
|
|
||||||
Date: Wed, 9 May 2018 16:50:25 +0200
|
|
||||||
Subject: [PATCH] Aadd HPE XFS support
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
HPE XFS has a different superblock magic and type name
|
|
||||||
to allow the community XFS and HPE XFS to coexist in
|
|
||||||
the same linux kernel.
|
|
||||||
|
|
||||||
This patch add HPE XFS support to the quota-tools so
|
|
||||||
our customers can use it.
|
|
||||||
|
|
||||||
Signed-off-by: Mark Tinguely <mark.tinguely@hpe.com>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
bylabel.c | 4 +++-
|
|
||||||
mntopt.h | 1 +
|
|
||||||
quot.c | 3 ++-
|
|
||||||
quotacheck.c | 5 +++--
|
|
||||||
quotaio.c | 3 ++-
|
|
||||||
quotaon.c | 6 ++++--
|
|
||||||
quotasys.c | 10 +++++++---
|
|
||||||
7 files changed, 22 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/bylabel.c b/bylabel.c
|
|
||||||
index ff10422..5313461 100644
|
|
||||||
--- a/bylabel.c
|
|
||||||
+++ b/bylabel.c
|
|
||||||
@@ -48,6 +48,7 @@ struct ext2_super_block {
|
|
||||||
|
|
||||||
#define XFS_SUPER_MAGIC "XFSB"
|
|
||||||
#define XFS_SUPER_MAGIC2 "BSFX"
|
|
||||||
+#define EXFS_SUPER_MAGIC "EXFS"
|
|
||||||
struct xfs_super_block {
|
|
||||||
u_char s_magic[4];
|
|
||||||
u_char s_dummy[28];
|
|
||||||
@@ -107,7 +108,8 @@ static int get_label_uuid(const char *device, char **label, char *uuid)
|
|
||||||
else if (lseek(fd, 0, SEEK_SET) == 0
|
|
||||||
&& read(fd, (char *)&xfsb, sizeof(xfsb)) == sizeof(xfsb)
|
|
||||||
&& (strncmp((char *)&xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0 ||
|
|
||||||
- strncmp((char *)&xfsb.s_magic, XFS_SUPER_MAGIC2, 4) == 0)) {
|
|
||||||
+ strncmp((char *)&xfsb.s_magic, XFS_SUPER_MAGIC2, 4) == 0 ||
|
|
||||||
+ strncmp((char *)&xfsb.s_magic, EXFS_SUPER_MAGIC, 4) == 0)) {
|
|
||||||
memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid));
|
|
||||||
namesize = sizeof(xfsb.s_fsname);
|
|
||||||
*label = smalloc(namesize + 1);
|
|
||||||
diff --git a/mntopt.h b/mntopt.h
|
|
||||||
index 7913048..0f3b0c5 100644
|
|
||||||
--- a/mntopt.h
|
|
||||||
+++ b/mntopt.h
|
|
||||||
@@ -15,6 +15,7 @@
|
|
||||||
#define MNTTYPE_UDF "udf" /* OSTA UDF file system */
|
|
||||||
#define MNTTYPE_REISER "reiserfs" /* Reiser file system */
|
|
||||||
#define MNTTYPE_XFS "xfs" /* SGI XFS file system */
|
|
||||||
+#define MNTTYPE_EXFS "exfs" /* HPE EXFS file system */
|
|
||||||
#define MNTTYPE_AUTOFS "autofs" /* Automount mountpoint */
|
|
||||||
#define MNTTYPE_JFS "jfs" /* JFS file system */
|
|
||||||
#define MNTTYPE_NFS4 "nfs4" /* NFSv4 filesystem */
|
|
||||||
diff --git a/quot.c b/quot.c
|
|
||||||
index 6311f77..c3a31a4 100644
|
|
||||||
--- a/quot.c
|
|
||||||
+++ b/quot.c
|
|
||||||
@@ -143,7 +143,8 @@ static void mounttable(void)
|
|
||||||
|
|
||||||
while ((mntp = get_next_mount())) {
|
|
||||||
/* Currently, only XFS is implemented... */
|
|
||||||
- if (strcmp(mntp->me_type, MNTTYPE_XFS) == 0) {
|
|
||||||
+ if (strcmp(mntp->me_type, MNTTYPE_XFS) == 0 ||
|
|
||||||
+ strcmp(mntp->me_type, MNTTYPE_EXFS) == 0) {
|
|
||||||
checkXFS(mntp->me_devname, mntp->me_dir);
|
|
||||||
doit = 1;
|
|
||||||
}
|
|
||||||
diff --git a/quotacheck.c b/quotacheck.c
|
|
||||||
index b1302b6..fd01dfc 100644
|
|
||||||
--- a/quotacheck.c
|
|
||||||
+++ b/quotacheck.c
|
|
||||||
@@ -1042,7 +1042,8 @@ static int detect_filename_format(struct mount_entry *mnt, int type)
|
|
||||||
int fmt;
|
|
||||||
|
|
||||||
if (strcmp(mnt->me_type, MNTTYPE_XFS) == 0 ||
|
|
||||||
- strcmp(mnt->me_type, MNTTYPE_GFS2) == 0)
|
|
||||||
+ strcmp(mnt->me_type, MNTTYPE_GFS2) == 0 ||
|
|
||||||
+ strcmp(mnt->me_type, MNTTYPE_EXFS) == 0)
|
|
||||||
return QF_XFS;
|
|
||||||
|
|
||||||
if (type == USRQUOTA) {
|
|
||||||
@@ -1116,7 +1117,7 @@ static int compatible_fs_qfmt(char *fstype, int fmt)
|
|
||||||
{
|
|
||||||
/* We never check XFS, NFS, and filesystems supporting VFS metaformat */
|
|
||||||
if (!strcmp(fstype, MNTTYPE_XFS) || nfs_fstype(fstype) ||
|
|
||||||
- meta_qf_fstype(fstype))
|
|
||||||
+ meta_qf_fstype(fstype) || !strcmp(fstype, MNTTYPE_EXFS))
|
|
||||||
return 0;
|
|
||||||
/* In all other cases we can pick a format... */
|
|
||||||
if (fmt == -1)
|
|
||||||
diff --git a/quotaio.c b/quotaio.c
|
|
||||||
index df893c6..94ae458 100644
|
|
||||||
--- a/quotaio.c
|
|
||||||
+++ b/quotaio.c
|
|
||||||
@@ -79,7 +79,8 @@ struct quota_handle *init_io(struct mount_entry *mnt, int type, int fmt, int fla
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(mnt->me_type, MNTTYPE_XFS) || /* XFS filesystem? */
|
|
||||||
- !strcmp(mnt->me_type, MNTTYPE_GFS2)) { /* XFS filesystem? */
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_GFS2) || /* XFS filesystem? */
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_EXFS)) { /* EXFS filesystem? */
|
|
||||||
if (fmt != -1 && fmt != QF_XFS) { /* User wanted some other format? */
|
|
||||||
errstr(_("Only XFS quota format is allowed on XFS filesystem.\n"));
|
|
||||||
goto out_handle;
|
|
||||||
diff --git a/quotaon.c b/quotaon.c
|
|
||||||
index fe19224..cee2e25 100644
|
|
||||||
--- a/quotaon.c
|
|
||||||
+++ b/quotaon.c
|
|
||||||
@@ -282,7 +282,8 @@ static int newstate(struct mount_entry *mnt, int type, char *extra)
|
|
||||||
if (!strcmp(mnt->me_type, MNTTYPE_GFS2)) {
|
|
||||||
errstr(_("Cannot change state of GFS2 quota.\n"));
|
|
||||||
return 1;
|
|
||||||
- } else if (!strcmp(mnt->me_type, MNTTYPE_XFS)) { /* XFS filesystem has special handling... */
|
|
||||||
+ } else if (!strcmp(mnt->me_type, MNTTYPE_XFS) ||
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_EXFS)) { /* XFS filesystem has special handling... */
|
|
||||||
if (!kern_qfmt_supp(QF_XFS)) {
|
|
||||||
errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
|
|
||||||
return 1;
|
|
||||||
@@ -337,7 +338,8 @@ static int print_state(struct mount_entry *mnt, int type)
|
|
||||||
if (kern_qfmt_supp(QF_XFS)) {
|
|
||||||
on = kern_quota_state_xfs(mnt->me_devname, type);
|
|
||||||
if (!strcmp(mnt->me_type, MNTTYPE_XFS) ||
|
|
||||||
- !strcmp(mnt->me_type, MNTTYPE_GFS2) || on >= 0) {
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_GFS2) || on >= 0 ||
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_EXFS)) {
|
|
||||||
if (on < 0)
|
|
||||||
on = 0;
|
|
||||||
if (!(flags & FL_VERBOSE))
|
|
||||||
diff --git a/quotasys.c b/quotasys.c
|
|
||||||
index 9336411..d8c0e48 100644
|
|
||||||
--- a/quotasys.c
|
|
||||||
+++ b/quotasys.c
|
|
||||||
@@ -781,7 +781,8 @@ static void copy_mntoptarg(char *buf, const char *optarg, int buflen)
|
|
||||||
static int hasquota(const char *dev, struct mntent *mnt, int type, int flags)
|
|
||||||
{
|
|
||||||
if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
|
|
||||||
- !strcmp(mnt->mnt_type, MNTTYPE_XFS))
|
|
||||||
+ !strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
|
|
||||||
+ !strcmp(mnt->mnt_type, MNTTYPE_EXFS))
|
|
||||||
return hasxfsquota(dev, mnt, type, flags);
|
|
||||||
if (!strcmp(mnt->mnt_type, MNTTYPE_OCFS2))
|
|
||||||
return hasvfsmetaquota(dev, mnt, type, flags);
|
|
||||||
@@ -953,12 +954,14 @@ add_entry:
|
|
||||||
break;
|
|
||||||
case QF_XFS:
|
|
||||||
if (!strcmp(mnt->me_type, MNTTYPE_XFS) ||
|
|
||||||
- !strcmp(mnt->me_type, MNTTYPE_GFS2))
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_GFS2) ||
|
|
||||||
+ !strcmp(mnt->me_type, MNTTYPE_EXFS))
|
|
||||||
goto add_entry;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (strcmp(mnt->me_type, MNTTYPE_XFS) &&
|
|
||||||
strcmp(mnt->me_type, MNTTYPE_GFS2) &&
|
|
||||||
+ strcmp(mnt->me_type, MNTTYPE_EXFS) &&
|
|
||||||
!nfs_fstype(mnt->me_type))
|
|
||||||
goto add_entry;
|
|
||||||
break;
|
|
||||||
@@ -1059,7 +1062,8 @@ void init_kernel_interface(void)
|
|
||||||
else {
|
|
||||||
struct v2_dqstats v2_stats;
|
|
||||||
|
|
||||||
- if (!stat("/proc/fs/xfs/stat", &st))
|
|
||||||
+ if (!stat("/proc/fs/xfs/stat", &st) ||
|
|
||||||
+ !stat("/proc/fs/exfs/stat", &st))
|
|
||||||
kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
|
|
||||||
else {
|
|
||||||
fs_quota_stat_t dummy;
|
|
||||||
--
|
|
||||||
2.26.3
|
|
||||||
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
From bbb8819fc0f6ed379a05d635a61bcf9c8986079f Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
|
|
||||||
Date: Sat, 16 Sep 2017 13:09:43 +0200
|
|
||||||
Subject: [PATCH] Add $(TIRPC_CFLAGS) globally to CFLAGS for RPC support,
|
|
||||||
needed for libc 2.26
|
|
||||||
|
|
||||||
---
|
|
||||||
Makefile.am | 5 ++---
|
|
||||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile.am b/Makefile.am
|
|
||||||
index 8d80bee..278290a 100644
|
|
||||||
--- a/Makefile.am
|
|
||||||
+++ b/Makefile.am
|
|
||||||
@@ -51,6 +51,8 @@ EXTRA_DIST = \
|
|
||||||
noinst_LIBRARIES = libquota.a
|
|
||||||
|
|
||||||
if WITH_RPC
|
|
||||||
+CFLAGS += $(TIRPC_CFLAGS)
|
|
||||||
+
|
|
||||||
rpcsvcdir = $(includedir)/rpcsvc
|
|
||||||
rpcsvc_DATA = \
|
|
||||||
rquota.h \
|
|
||||||
@@ -100,8 +102,6 @@ libquota_a_SOURCES = \
|
|
||||||
mntopt.h \
|
|
||||||
pot.c \
|
|
||||||
pot.h
|
|
||||||
-libquota_a_CFLAGS = \
|
|
||||||
- $(TIRPC_CFLAGS)
|
|
||||||
libquota_a_LIBADD = \
|
|
||||||
$(RPCLIBS)
|
|
||||||
|
|
||||||
@@ -235,7 +235,6 @@ rpc_rquotad_SOURCES = \
|
|
||||||
rquota_server.c \
|
|
||||||
rquota_svc.c \
|
|
||||||
svc_socket.c
|
|
||||||
-rpc_rquotad_CFLAGS = $(TIRPC_CFLAGS)
|
|
||||||
rpc_rquotad_LDADD = \
|
|
||||||
libquota.a \
|
|
||||||
$(WRAP_LIBS) \
|
|
||||||
--
|
|
||||||
2.14.1
|
|
||||||
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
From b5ed9878d60bf2c6764ce8e1de4f69e64c4bdfaf Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Wed, 6 Sep 2017 16:25:09 +0200
|
|
||||||
Subject: [PATCH] Install rquota(3) only if RPC is enabled
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
rquote(3) documents rpcsvc header files. Thus it should be installed
|
|
||||||
only if the the header files are installed and that is only if RPC
|
|
||||||
configure feature is enabled.
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
Makefile.am | 6 ++++--
|
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile.am b/Makefile.am
|
|
||||||
index 8d80bee..9b852d2 100644
|
|
||||||
--- a/Makefile.am
|
|
||||||
+++ b/Makefile.am
|
|
||||||
@@ -27,7 +27,6 @@ man_MANS = \
|
|
||||||
quota.1 \
|
|
||||||
quot.8 \
|
|
||||||
repquota.8 \
|
|
||||||
- rquota.3 \
|
|
||||||
setquota.8 \
|
|
||||||
warnquota.conf.5 \
|
|
||||||
warnquota.8 \
|
|
||||||
@@ -69,7 +68,10 @@ librpcclient_a_CFLAGS = -Wno-unused
|
|
||||||
RPCLIBS = librpcclient.a
|
|
||||||
BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c
|
|
||||||
CLEANFILES = rquota.c rquota.h rquota_clnt.c
|
|
||||||
-man_MANS += rpc.rquotad.8
|
|
||||||
+man_MANS += \
|
|
||||||
+ rpc.rquotad.8 \
|
|
||||||
+ rquota.3
|
|
||||||
+
|
|
||||||
endif
|
|
||||||
|
|
||||||
libquota_a_SOURCES = \
|
|
||||||
--
|
|
||||||
2.13.5
|
|
||||||
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
From 31ecd29b3b3f51145fd78f63087c10e9fcadf999 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Steve Dickson <steved@redhat.com>
|
|
||||||
Date: Tue, 22 May 2018 12:41:59 +0200
|
|
||||||
Subject: [PATCH] Listen on a TCP socket
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
rpc.rquotad spins in libtirpc's rendezvous_request() on accepting TCP
|
|
||||||
connections because the polled TCP socket is not listening:
|
|
||||||
|
|
||||||
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=5,
|
|
||||||
events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=6,
|
|
||||||
events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=7,
|
|
||||||
events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 4, -1) = 2 ([{fd=5,
|
|
||||||
revents=POLLHUP}, {fd=7, revents=POLLHUP}])
|
|
||||||
accept(5, 0x7ffe61698700, [128]) = -1 EINVAL (Invalid argument)
|
|
||||||
accept(7, 0x7ffe61698700, [128]) = -1 EINVAL (Invalid argument)
|
|
||||||
|
|
||||||
The polled descriptors are:
|
|
||||||
|
|
||||||
rpc.rquot 21981 root 4u IPv4 80449159 0t0 UDP *:rquotad
|
|
||||||
rpc.rquot 21981 root 5u sock 0,9 0t0 80449162 protocol: TCP
|
|
||||||
rpc.rquot 21981 root 6u IPv6 80449165 0t0 UDP *:rquotad
|
|
||||||
rpc.rquot 21981 root 7u sock 0,9 0t0 80449168 protocol: TCPv6
|
|
||||||
|
|
||||||
That results into a high CPU usage just after staring rpc.rquotad
|
|
||||||
process.
|
|
||||||
|
|
||||||
This patch adds a listen() call to svc_create_sock()
|
|
||||||
routine which is needed with libtirpc version of svc_tli_create()
|
|
||||||
as well as a needed IPv6 setsockopt().
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
svc_socket.c | 18 ++++++++++++++++++
|
|
||||||
1 file changed, 18 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/svc_socket.c b/svc_socket.c
|
|
||||||
index 8a44604..d2e3abf 100644
|
|
||||||
--- a/svc_socket.c
|
|
||||||
+++ b/svc_socket.c
|
|
||||||
@@ -118,6 +118,15 @@ static int svc_create_sock(struct addrinfo *ai)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (ai->ai_family == AF_INET6) {
|
|
||||||
+ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
|
|
||||||
+ &optval, sizeof(optval)) < 0) {
|
|
||||||
+ errstr(_("Cannot set IPv6 socket options: %s\n"), strerror(errno));
|
|
||||||
+ close(fd);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
|
|
||||||
errstr(_("Cannot set socket options: %s\n"), strerror(errno));
|
|
||||||
close(fd);
|
|
||||||
@@ -129,6 +138,15 @@ static int svc_create_sock(struct addrinfo *ai)
|
|
||||||
close(fd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (ai->ai_protocol == IPPROTO_TCP) {
|
|
||||||
+ if (listen(fd, SOMAXCONN) < 0) {
|
|
||||||
+ errstr(_("Cannot listen to address: %s\n"), strerror(errno));
|
|
||||||
+ close(fd);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.14.3
|
|
||||||
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
From 78403029375dbfe809b5b1034301dc687a94397f Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Thu, 23 Aug 2018 11:09:10 +0200
|
|
||||||
Subject: [PATCH 1/3] convertquota: Fix a file descriptor leak in
|
|
||||||
convert_endian()
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
convertquota.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/convertquota.c b/convertquota.c
|
|
||||||
index d913e05..6c8a553 100644
|
|
||||||
--- a/convertquota.c
|
|
||||||
+++ b/convertquota.c
|
|
||||||
@@ -363,6 +363,7 @@ static int convert_endian(int type, struct mount_entry *mnt)
|
|
||||||
}
|
|
||||||
ret = endian_scan_structures(ofd, type);
|
|
||||||
end_io(qn);
|
|
||||||
+ close(ofd);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.14.4
|
|
||||||
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
From bd36c3cf438ac4fd44b6779714ad0a44453d41b5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Mon, 16 Jul 2018 11:22:53 +0200
|
|
||||||
Subject: [PATCH] quota(1): Distinguish between none quota limits and no
|
|
||||||
allocated resources
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
If a user does not occupies any space or inodes on a file system but
|
|
||||||
quota limits are set, quota(1) tool still reports "none":
|
|
||||||
|
|
||||||
# quota -u test
|
|
||||||
Disk quotas for user test (uid 500): none
|
|
||||||
|
|
||||||
That's because the tool skips printing details for file systems
|
|
||||||
without any used resources but uses the shares the message with file
|
|
||||||
system without any quota limits.
|
|
||||||
|
|
||||||
This patch makes the distinction and changes "none" message into "no
|
|
||||||
quota limits set" and "no limited resources used" respectively.
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quota.c | 15 ++++++++++-----
|
|
||||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/quota.c b/quota.c
|
|
||||||
index 15c2a53..0303c7d 100644
|
|
||||||
--- a/quota.c
|
|
||||||
+++ b/quota.c
|
|
||||||
@@ -188,7 +188,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
||||||
char timebuf[MAXTIMELEN];
|
|
||||||
char name[MAXNAMELEN];
|
|
||||||
struct quota_handle **handles;
|
|
||||||
- int lines = 0, bover, iover, over;
|
|
||||||
+ int lines = 0, bover, iover, over, unlimited;
|
|
||||||
time_t now;
|
|
||||||
|
|
||||||
time(&now);
|
|
||||||
@@ -204,11 +204,16 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
||||||
goto out_handles;
|
|
||||||
}
|
|
||||||
over = 0;
|
|
||||||
+ unlimited = 1;
|
|
||||||
for (q = qlist; q; q = q->dq_next) {
|
|
||||||
bover = iover = 0;
|
|
||||||
- if (!(flags & FL_VERBOSE) && !q->dq_dqb.dqb_isoftlimit && !q->dq_dqb.dqb_ihardlimit
|
|
||||||
- && !q->dq_dqb.dqb_bsoftlimit && !q->dq_dqb.dqb_bhardlimit)
|
|
||||||
- continue;
|
|
||||||
+ if (!q->dq_dqb.dqb_isoftlimit && !q->dq_dqb.dqb_ihardlimit
|
|
||||||
+ && !q->dq_dqb.dqb_bsoftlimit && !q->dq_dqb.dqb_bhardlimit) {
|
|
||||||
+ if (!(flags & FL_VERBOSE))
|
|
||||||
+ continue;
|
|
||||||
+ } else {
|
|
||||||
+ unlimited = 0;
|
|
||||||
+ }
|
|
||||||
msgi = NULL;
|
|
||||||
if (q->dq_dqb.dqb_ihardlimit && q->dq_dqb.dqb_curinodes >= q->dq_dqb.dqb_ihardlimit) {
|
|
||||||
msgi = _("File limit reached on");
|
|
||||||
@@ -300,7 +305,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(flags & FL_QUIET) && !lines && qlist)
|
|
||||||
- heading(type, id, name, _("none"));
|
|
||||||
+ heading(type, id, name, unlimited ? _("none") : _("no limited resources used"));
|
|
||||||
freeprivs(qlist);
|
|
||||||
out_handles:
|
|
||||||
dispose_handle_list(handles);
|
|
||||||
--
|
|
||||||
2.14.4
|
|
||||||
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
From 4179911dc38af1b6499704a7f7fb710a40c95bdb Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Kara <jack@suse.cz>
|
|
||||||
Date: Mon, 5 Feb 2018 15:39:12 +0100
|
|
||||||
Subject: [PATCH] quotacheck: Avoid question in non-interactive mode
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
A question when quota file version is incorrect is asked even if
|
|
||||||
quotacheck is run in non-interactive mode. Avoid asking the question in
|
|
||||||
that case and fail the check instead.
|
|
||||||
|
|
||||||
Reproted-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotacheck_v2.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
|
|
||||||
index 4cc8558..86fbf42 100644
|
|
||||||
--- a/quotacheck_v2.c
|
|
||||||
+++ b/quotacheck_v2.c
|
|
||||||
@@ -363,7 +363,8 @@ static int check_header(char *filename, int fd, int type, int version)
|
|
||||||
"specified on command line (%d). Quota file header "
|
|
||||||
"may be corrupted.\n"),
|
|
||||||
le32toh(head.dqh_version), version);
|
|
||||||
- if (!ask_yn(_("Continue checking assuming version from command line?"), 1))
|
|
||||||
+ if (!(flags & FL_INTERACTIVE) ||
|
|
||||||
+ !ask_yn(_("Continue checking assuming version from command line?"), 1))
|
|
||||||
return -1;
|
|
||||||
detected_versions[type] = version;
|
|
||||||
} else
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
From b9525abadba082073e20e54ee7ad2423fc1ae6a8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Kara <jack@suse.cz>
|
|
||||||
Date: Mon, 5 Feb 2018 16:27:59 +0100
|
|
||||||
Subject: [PATCH] quotacheck: Fail check if quota file magic is invalid
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Currently quotacheck will just continue if quotafile magic is invalid.
|
|
||||||
Instead ask whether we should continue assuming quota format passed from
|
|
||||||
the command line.
|
|
||||||
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotacheck_v2.c | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
|
|
||||||
index 86fbf42..465765b 100644
|
|
||||||
--- a/quotacheck_v2.c
|
|
||||||
+++ b/quotacheck_v2.c
|
|
||||||
@@ -357,6 +357,9 @@ static int check_header(char *filename, int fd, int type, int version)
|
|
||||||
le32toh(head.dqh_version) > known_versions[type]) {
|
|
||||||
errstr(_("WARNING - Quota file %s has corrupted headers\n"),
|
|
||||||
filename);
|
|
||||||
+ if (!(flags & FL_INTERACTIVE) ||
|
|
||||||
+ !ask_yn(_("Continue checking assuming format from command line?"), 0))
|
|
||||||
+ return -1;
|
|
||||||
}
|
|
||||||
if (le32toh(head.dqh_version) != version) {
|
|
||||||
errstr(_("Quota file format version %d does not match the one "
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
From 7b6dfd6390476ec7b811c76e4e2653db2994cad4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Kara <jack@suse.cz>
|
|
||||||
Date: Mon, 5 Feb 2018 15:54:54 +0100
|
|
||||||
Subject: [PATCH] quotacheck: Report error when caching of quota file fails
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Currently quotacheck returns with zero exit code even though caching of
|
|
||||||
quota file fails. Fix it to return with non-zero exit code in that case
|
|
||||||
as expected.
|
|
||||||
|
|
||||||
Reported-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotacheck.c | 29 ++++++++++++++++++++++-------
|
|
||||||
1 file changed, 22 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/quotacheck.c b/quotacheck.c
|
|
||||||
index 9d7940b..b1302b6 100644
|
|
||||||
--- a/quotacheck.c
|
|
||||||
+++ b/quotacheck.c
|
|
||||||
@@ -924,6 +924,7 @@ static int check_dir(struct mount_entry *mnt)
|
|
||||||
struct stat st;
|
|
||||||
int remounted = 0;
|
|
||||||
int failed = 0;
|
|
||||||
+ int ret;
|
|
||||||
|
|
||||||
if (lstat(mnt->me_dir, &st) < 0)
|
|
||||||
die(2, _("Cannot stat mountpoint %s: %s\n"), mnt->me_dir, strerror(errno));
|
|
||||||
@@ -939,14 +940,22 @@ static int check_dir(struct mount_entry *mnt)
|
|
||||||
*/
|
|
||||||
if (cfmt == QF_XFS)
|
|
||||||
goto start_scan;
|
|
||||||
- if (ucheck)
|
|
||||||
- if (process_file(mnt, USRQUOTA) < 0)
|
|
||||||
+ if (ucheck) {
|
|
||||||
+ ret = process_file(mnt, USRQUOTA);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ failed |= ret;
|
|
||||||
ucheck = 0;
|
|
||||||
- if (gcheck)
|
|
||||||
- if (process_file(mnt, GRPQUOTA) < 0)
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (gcheck) {
|
|
||||||
+ ret = process_file(mnt, GRPQUOTA);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ failed |= ret;
|
|
||||||
gcheck = 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
if (!ucheck && !gcheck) /* Nothing to check? */
|
|
||||||
- return 0;
|
|
||||||
+ return failed;
|
|
||||||
if (!(flags & FL_NOREMOUNT)) {
|
|
||||||
/* Now we try to remount fs read-only to prevent races when scanning filesystem */
|
|
||||||
if (mount
|
|
||||||
@@ -978,8 +987,11 @@ start_scan:
|
|
||||||
!strcmp(mnt->me_type, MNTTYPE_EXT3) ||
|
|
||||||
!strcmp(mnt->me_type, MNTTYPE_NEXT3) ||
|
|
||||||
!strcmp(mnt->me_type, MNTTYPE_EXT4)) {
|
|
||||||
- if ((failed = ext2_direct_scan(mnt->me_devname)) < 0)
|
|
||||||
+ ret = ext2_direct_scan(mnt->me_devname);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ failed |= ret;
|
|
||||||
goto out;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#else
|
|
||||||
@@ -987,8 +999,11 @@ start_scan:
|
|
||||||
#endif
|
|
||||||
if (flags & FL_VERYVERBOSE)
|
|
||||||
putchar('\n');
|
|
||||||
- if ((failed = scan_dir(mnt->me_dir)) < 0)
|
|
||||||
+ ret = scan_dir(mnt->me_dir);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ failed |= ret;
|
|
||||||
goto out;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
dirs_done++;
|
|
||||||
if (flags & FL_VERBOSE || flags & FL_DEBUG)
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
From 0f255ef2570478a855361937445a57a168c8629d Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Thu, 23 Aug 2018 11:23:43 +0200
|
|
||||||
Subject: [PATCH 2/3] quotackeck: Fix a directory descriptor leak in scan_dir()
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotacheck.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/quotacheck.c b/quotacheck.c
|
|
||||||
index fd01dfc..2cdf475 100644
|
|
||||||
--- a/quotacheck.c
|
|
||||||
+++ b/quotacheck.c
|
|
||||||
@@ -538,6 +538,7 @@ static int scan_dir(const char *pathname)
|
|
||||||
if ((lstat(de->d_name, &st)) == -1) {
|
|
||||||
errstr(_("lstat: Cannot stat `%s/%s': %s\nGuess you'd better run fsck first !\nexiting...\n"),
|
|
||||||
pathname, de->d_name, strerror(errno));
|
|
||||||
+ closedir(dp);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.14.4
|
|
||||||
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
From 1806ee01060d363beac01fda28c613ab27dbc4df Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Kara <jack@suse.cz>
|
|
||||||
Date: Wed, 10 Jan 2018 10:18:43 +0100
|
|
||||||
Subject: [PATCH] repquota: Fix output when user -2 exists
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Vladimit Meshkov reported that when user -2 exists and user namespaces
|
|
||||||
are enabled in the kernel, repquota(8) fails to output anything. He also
|
|
||||||
analyzed this is because in such case repquota(8) tries to query info
|
|
||||||
for user -1 which is invalid ID, gets error from the kernel, and bails
|
|
||||||
out.
|
|
||||||
|
|
||||||
Fix the problem by stopping iteration over IDs when we reach ID -1.
|
|
||||||
|
|
||||||
Reported-by: Vladimir Meshkov <ubob74@gmail.com>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotaio_generic.c | 5 +++++
|
|
||||||
quotaio_xfs.c | 5 +++++
|
|
||||||
2 files changed, 10 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/quotaio_generic.c b/quotaio_generic.c
|
|
||||||
index 025d712..5b23955 100644
|
|
||||||
--- a/quotaio_generic.c
|
|
||||||
+++ b/quotaio_generic.c
|
|
||||||
@@ -204,6 +204,11 @@ int vfs_scan_dquots(struct quota_handle *h,
|
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
id = kdqblk.dqb_id + 1;
|
|
||||||
+ /* id -1 is invalid and the last one... */
|
|
||||||
+ if (id == -1) {
|
|
||||||
+ errno = ENOENT;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
free(dquot);
|
|
||||||
|
|
||||||
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
|
||||||
index 1374cf4..56daf89 100644
|
|
||||||
--- a/quotaio_xfs.c
|
|
||||||
+++ b/quotaio_xfs.c
|
|
||||||
@@ -219,6 +219,11 @@ static int xfs_kernel_scan_dquots(struct quota_handle *h,
|
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
id = xdqblk.d_id + 1;
|
|
||||||
+ /* id -1 is invalid and the last one... */
|
|
||||||
+ if (id == -1) {
|
|
||||||
+ errno = ENOENT;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
free(dquot);
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
From d7694c952073bf2ebb852014d9f979b5e3e7c018 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Kara <jack@suse.cz>
|
|
||||||
Date: Mon, 28 May 2018 18:08:24 +0200
|
|
||||||
Subject: [PATCH] rpc: Fix wrong limit for space usage
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Limit of maximum allowable space usage for RPC transfer was wrongly set
|
|
||||||
to ~4GB instead of ~4TB due to overflow in constant initialization. Fix
|
|
||||||
it.
|
|
||||||
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotaio_rpc.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/quotaio_rpc.c b/quotaio_rpc.c
|
|
||||||
index 6f25144..edc1e9f 100644
|
|
||||||
--- a/quotaio_rpc.c
|
|
||||||
+++ b/quotaio_rpc.c
|
|
||||||
@@ -33,7 +33,8 @@ static int rpc_init_io(struct quota_handle *h)
|
|
||||||
#ifdef RPC
|
|
||||||
h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
|
|
||||||
h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
|
|
||||||
- h->qh_info.dqi_max_b_usage = (~(uint32_t)0) << QUOTABLOCK_BITS;
|
|
||||||
+ h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0))
|
|
||||||
+ << QUOTABLOCK_BITS;
|
|
||||||
h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
--
|
|
||||||
2.14.3
|
|
||||||
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
From eeef53917864600e0f5ac42ce5c3d884967012a1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Mon, 5 Feb 2018 10:31:47 +0100
|
|
||||||
Subject: [PATCH 1/2] warnquota: Check snprintf() for overflows
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
GCC 8 with GNU libc 2.27 prerelease warns:
|
|
||||||
|
|
||||||
gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -fPIC -I/usr/include/tirpc -c -o warnquota.o warnquota.c
|
|
||||||
warnquota.c: In function ‘lookup_user’:
|
|
||||||
warnquota.c:415:29: warning: ‘%s’ directive output may be truncated writing up to 2047 bytes into a region of size 255 [-Wformat-truncation=]
|
|
||||||
snprintf(searchbuf, 256, "(%s=%s)", config->ldap_search_attr, user);
|
|
||||||
^~
|
|
||||||
warnquota.c:415:2: note: ‘snprintf’ output 4 or more bytes (assuming 2051) into a destination of size 256
|
|
||||||
snprintf(searchbuf, 256, "(%s=%s)", config->ldap_search_attr, user);
|
|
||||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
warnquota.c: In function ‘warn_quota’:
|
|
||||||
warnquota.c:896:51: warning: ‘%s’ directive output may be truncated writing up to 2047 bytes into a region of size 2041 [-Wformat-truncation=]
|
|
||||||
snprintf(config->ldap_uri, CNF_BUFFER, "ldap://%s:%d", config->ldap_host, config->ldap_port);
|
|
||||||
^~ ~~~~~~~~~~~~~~~~~
|
|
||||||
warnquota.c:896:4: note: ‘snprintf’ output between 10 and 2067 bytes into a destination of size 2048
|
|
||||||
snprintf(config->ldap_uri, CNF_BUFFER, "ldap://%s:%d", config->ldap_host, config->ldap_port);
|
|
||||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
This is patch fixes it by catching the cases when snprintf() truncates and
|
|
||||||
reporting an error.
|
|
||||||
|
|
||||||
Perfect fix would fall back into dynamically allocated buffers but
|
|
||||||
I think that would make these corner case too complicated provided
|
|
||||||
nobody had yet complained about them.
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
warnquota.c | 17 +++++++++++++++--
|
|
||||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/warnquota.c b/warnquota.c
|
|
||||||
index 073c45e..bc11055 100644
|
|
||||||
--- a/warnquota.c
|
|
||||||
+++ b/warnquota.c
|
|
||||||
@@ -412,7 +412,13 @@ static char *lookup_user(struct configparams *config, char *user)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* search for the offender_name in ldap */
|
|
||||||
- snprintf(searchbuf, 256, "(%s=%s)", config->ldap_search_attr, user);
|
|
||||||
+ if (256 <= snprintf(searchbuf, 256, "(%s=%s)", config->ldap_search_attr,
|
|
||||||
+ user)) {
|
|
||||||
+ errstr(_("Could not format LDAP search filter for %s user and "
|
|
||||||
+ "%s search attribute due to excessive length.\n"),
|
|
||||||
+ user, config->ldap_search_attr);
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
ret = ldap_search_ext_s(ldapconn,
|
|
||||||
config->ldap_basedn, LDAP_SCOPE_SUBTREE,
|
|
||||||
searchbuf, NULL, 0, NULL, NULL, NULL,
|
|
||||||
@@ -893,7 +899,14 @@ cc_parse_err:
|
|
||||||
if (config->use_ldap_mail)
|
|
||||||
{
|
|
||||||
if (!config->ldap_uri[0]) {
|
|
||||||
- snprintf(config->ldap_uri, CNF_BUFFER, "ldap://%s:%d", config->ldap_host, config->ldap_port);
|
|
||||||
+ if (CNF_BUFFER <= snprintf(config->ldap_uri, CNF_BUFFER,
|
|
||||||
+ "ldap://%s:%d", config->ldap_host,
|
|
||||||
+ config->ldap_port)) {
|
|
||||||
+ errstr(_("Could not format LDAP URI because "
|
|
||||||
+ "it's longer than %d bytes.\n"),
|
|
||||||
+ CNF_BUFFER);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
errstr(_("LDAP library version >= 2.3 detected. Please use LDAP_URI instead of hostname and port.\nGenerated URI %s\n"), config->ldap_uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
From 59b280ebe22eceaf4250cb3b776674619a4d4ece Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Mon, 5 Feb 2018 11:07:41 +0100
|
|
||||||
Subject: [PATCH] warnquota: Fix comparing user name to non-null-terminated
|
|
||||||
utmp.ut_user
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
GCC 8 with GNU libc 2.27 warns:
|
|
||||||
|
|
||||||
gcc -DHAVE_CONFIG_H -I. -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/libnl3 -g -O2 -Wall -fPIC -I/usr/include/tirpc -c -o quota_nld-quota_nld.o `test -f 'quota_nld.c' || echo './'`quota_nld.c
|
|
||||||
quota_nld.c: In function ‘write_console_warning’:
|
|
||||||
quota_nld.c:273:7: warning: ‘strcmp’ argument 2 declared attribute ‘nonstring’ [-Wstringop-overflow=]
|
|
||||||
if (strcmp(user, uent->ut_user))
|
|
||||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
In file included from /usr/include/utmp.h:29,
|
|
||||||
from quota_nld.c:23:
|
|
||||||
/usr/include/bits/utmp.h:65:8: note: argument ‘ut_user’ declared here
|
|
||||||
char ut_user[UT_NAMESIZE]
|
|
||||||
^~~~~~~
|
|
||||||
|
|
||||||
This is because ut_user value misses the terminating null byte if it
|
|
||||||
fits exactly into ut_user array, as document in utmp(5):
|
|
||||||
|
|
||||||
String fields are terminated by a null byte ('\0') if they are
|
|
||||||
shorter than the size of the field.
|
|
||||||
|
|
||||||
Recent GCC and glibc recevied compile-time checks and annotations
|
|
||||||
(__attribute_nonstring_) that catches these mistakes.
|
|
||||||
|
|
||||||
This patch fixes it by using strncmp(3) and by ignoring user names
|
|
||||||
that does not fit into utmp log format. It's better not to warn than
|
|
||||||
spamming unrelated user.
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
---
|
|
||||||
quota_nld.c | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/quota_nld.c b/quota_nld.c
|
|
||||||
index ea541e0..8559f25 100644
|
|
||||||
--- a/quota_nld.c
|
|
||||||
+++ b/quota_nld.c
|
|
||||||
@@ -262,6 +262,8 @@ static void write_console_warning(struct quota_warning *warn)
|
|
||||||
warn->warntype == QUOTA_NL_BSOFTBELOW) && !(flags & FL_PRINTBELOW))
|
|
||||||
return;
|
|
||||||
uid2user(warn->caused_id, user);
|
|
||||||
+ if (strlen(user) > UT_NAMESIZE)
|
|
||||||
+ goto skip_utmp;
|
|
||||||
strcpy(dev, "/dev/");
|
|
||||||
|
|
||||||
setutent();
|
|
||||||
@@ -270,7 +272,7 @@ static void write_console_warning(struct quota_warning *warn)
|
|
||||||
if (uent->ut_type != USER_PROCESS)
|
|
||||||
continue;
|
|
||||||
/* Entry for a different user? */
|
|
||||||
- if (strcmp(user, uent->ut_user))
|
|
||||||
+ if (strncmp(user, uent->ut_user, UT_NAMESIZE))
|
|
||||||
continue;
|
|
||||||
sstrncpy(dev+5, uent->ut_line, PATH_MAX-5);
|
|
||||||
if (stat(dev, &st) < 0)
|
|
||||||
@@ -281,6 +283,7 @@ static void write_console_warning(struct quota_warning *warn)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!max_atime) {
|
|
||||||
+skip_utmp:
|
|
||||||
/*
|
|
||||||
* This can happen quite easily so don't spam syslog with
|
|
||||||
* the error
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
From 869f514310b72169a294baa37f5a90a291f719f3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Thu, 23 Aug 2018 11:51:47 +0200
|
|
||||||
Subject: [PATCH 3/3] xqmstats: Fix a file descriptor leak in main()
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
xqmstats.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/xqmstats.c b/xqmstats.c
|
|
||||||
index cdac4a6..59b1d66 100644
|
|
||||||
--- a/xqmstats.c
|
|
||||||
+++ b/xqmstats.c
|
|
||||||
@@ -35,6 +35,7 @@ int main(int argc, char **argv)
|
|
||||||
if ((stats = fopen(XQMSTATS, "r")) == NULL) {
|
|
||||||
if ((stats = fopen(STATFILE, "r")) == NULL) {
|
|
||||||
errstr(_("The running kernel does not support XFS\n"));
|
|
||||||
+ fclose(xqm);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.14.4
|
|
||||||
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
From 13bb8c2daca0f1c1099ce6ba9dcb23319f7955d0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jan Kara <jack@suse.cz>
|
|
||||||
Date: Wed, 20 May 2020 16:22:52 +0200
|
|
||||||
Subject: [PATCH 2/2] Fix limits setting on XFS filesystem
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
xfs_commit_dquot() always set FS_DQ_LIMIT_MASK when calling
|
|
||||||
Q_XFS_SETQLIM. So far this wasn't a problem since quota tools didn't
|
|
||||||
support setting of anything else for XFS but now that kernel will start
|
|
||||||
supporting setting of grace times for XFS, we need to be more careful
|
|
||||||
and set limits bits only if we really want to update them. Also
|
|
||||||
FS_DQ_LIMIT_MASK contains real-time limits as well. Quota tools
|
|
||||||
currently don't support them in any way so avoid telling kernel to set
|
|
||||||
them.
|
|
||||||
|
|
||||||
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotaio_xfs.c | 4 +++-
|
|
||||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
|
||||||
index a4d6f67..3333bb1 100644
|
|
||||||
--- a/quotaio_xfs.c
|
|
||||||
+++ b/quotaio_xfs.c
|
|
||||||
@@ -165,7 +165,9 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
|
|
||||||
if (flags & COMMIT_USAGE) /* block usage */
|
|
||||||
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
|
|
||||||
} else {
|
|
||||||
- xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
|
|
||||||
+ if (flags & COMMIT_LIMITS) /* warn/limit */
|
|
||||||
+ xdqblk.d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD |
|
|
||||||
+ FS_DQ_ISOFT | FS_DQ_IHARD;
|
|
||||||
if (flags & COMMIT_TIMES) /* indiv grace period */
|
|
||||||
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.25.4
|
|
||||||
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
From be96da2353669d433b0abddb85b26ccaf35e3451 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Eric Sandeen <sandeen@redhat.com>
|
|
||||||
Date: Thu, 14 May 2020 12:17:29 +0200
|
|
||||||
Subject: [PATCH 1/2] quota-tools: Set FS_DQ_TIMER_MASK for individual xfs
|
|
||||||
grace times
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
xfs quota code doesn't currently allow increasing an individual
|
|
||||||
user's grace time, but kernel patches are in development for this.
|
|
||||||
|
|
||||||
In order for setquota to be able to send this update via
|
|
||||||
setquota -T, we need to add the FS_DQ_TIMER_MASK when we are trying
|
|
||||||
to update the grace times on an individual user's dquot.
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotaio_xfs.c | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
|
||||||
index b22c7b4..a4d6f67 100644
|
|
||||||
--- a/quotaio_xfs.c
|
|
||||||
+++ b/quotaio_xfs.c
|
|
||||||
@@ -166,6 +166,8 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
|
|
||||||
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
|
|
||||||
} else {
|
|
||||||
xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
|
|
||||||
+ if (flags & COMMIT_TIMES) /* indiv grace period */
|
|
||||||
+ xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
|
|
||||||
--
|
|
||||||
2.25.4
|
|
||||||
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
From fdd774bf08e56872ae4c0420e0f01efa25e715d6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Eric Sandeen <sandeen@redhat.com>
|
|
||||||
Date: Fri, 8 May 2020 14:36:46 -0500
|
|
||||||
Subject: [PATCH] quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Older kernels ignored the type sent to Q_XFS_GETQSTAT, and returned
|
|
||||||
timer information for the first quota type which was found to be
|
|
||||||
enabled.
|
|
||||||
|
|
||||||
As of 555b2c3da1fc ("quota: honor quota type in Q_XGETQSTAT[V] calls")
|
|
||||||
the kernel now honors the quota type requested, so send that from the
|
|
||||||
Q_XFS_GETQSTAT calls in quota tools.
|
|
||||||
|
|
||||||
Older kernels ignore the type altogether, so this change should be
|
|
||||||
backwards compatible with no change in behavior.
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
||||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
||||||
---
|
|
||||||
quotaio_xfs.c | 2 +-
|
|
||||||
quotaon_xfs.c | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
|
||||||
index 56daf89..b22c7b4 100644
|
|
||||||
--- a/quotaio_xfs.c
|
|
||||||
+++ b/quotaio_xfs.c
|
|
||||||
@@ -81,7 +81,7 @@ static int xfs_init_io(struct quota_handle *h)
|
|
||||||
struct xfs_mem_dqinfo info;
|
|
||||||
int qcmd;
|
|
||||||
|
|
||||||
- qcmd = QCMD(Q_XFS_GETQSTAT, 0);
|
|
||||||
+ qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
|
|
||||||
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
|
|
||||||
if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0)
|
|
||||||
return -1;
|
|
||||||
diff --git a/quotaon_xfs.c b/quotaon_xfs.c
|
|
||||||
index d557a75..d137240 100644
|
|
||||||
--- a/quotaon_xfs.c
|
|
||||||
+++ b/quotaon_xfs.c
|
|
||||||
@@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r
|
|
||||||
if (flags & STATEFLAG_ALL)
|
|
||||||
return 0; /* noop */
|
|
||||||
|
|
||||||
- if (quotactl(QCMD(Q_XFS_GETQSTAT, 0), dev, 0, (void *)&info) < 0) {
|
|
||||||
+ if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) {
|
|
||||||
errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.25.4
|
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
From 67a0dbf6434552e720b0d311597553b3a76f779e Mon Sep 17 00:00:00 2001
|
From 6400cf65afed09c63d96cc62b1e7eee964bdb6cb Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||||
Date: Tue, 23 Aug 2011 13:45:15 +0200
|
Date: Tue, 23 Aug 2011 13:45:15 +0200
|
||||||
Subject: [PATCH] warnquota configuration tunes
|
Subject: [PATCH] warnquota configuration tunes
|
||||||
@ -8,19 +8,20 @@ Content-Transfer-Encoding: 8bit
|
|||||||
|
|
||||||
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
|
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
|
||||||
accepted by upstream (we had root@... addresses and more enterprise
|
accepted by upstream (we had root@... addresses and more enterprise
|
||||||
wordings usually there).
|
wordings usually there). Later improved by the upstream in
|
||||||
|
0efb2331f1c39c9665fb6e92e83c7d080b877de1.
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
---
|
---
|
||||||
warnquota.c | 2 +-
|
warnquota.c | 2 +-
|
||||||
warnquota.conf | 17 ++++++++---------
|
warnquota.conf | 16 ++++++++--------
|
||||||
2 files changed, 9 insertions(+), 10 deletions(-)
|
2 files changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
diff --git a/warnquota.c b/warnquota.c
|
diff --git a/warnquota.c b/warnquota.c
|
||||||
index 0d911e4..2c8e084 100644
|
index 2882fee..48d79c0 100644
|
||||||
--- a/warnquota.c
|
--- a/warnquota.c
|
||||||
+++ b/warnquota.c
|
+++ b/warnquota.c
|
||||||
@@ -837,7 +837,7 @@ cc_parse_err:
|
@@ -883,7 +883,7 @@ cc_parse_err:
|
||||||
}
|
}
|
||||||
#ifdef USE_LDAP_MAIL_LOOKUP
|
#ifdef USE_LDAP_MAIL_LOOKUP
|
||||||
else if (!strcmp(var, "LDAP_MAIL")) {
|
else if (!strcmp(var, "LDAP_MAIL")) {
|
||||||
@ -30,33 +31,36 @@ index 0d911e4..2c8e084 100644
|
|||||||
else
|
else
|
||||||
config->use_ldap_mail = 0;
|
config->use_ldap_mail = 0;
|
||||||
diff --git a/warnquota.conf b/warnquota.conf
|
diff --git a/warnquota.conf b/warnquota.conf
|
||||||
index b06f81f..7e00947 100644
|
index 5bbd0ab..366c3e0 100644
|
||||||
--- a/warnquota.conf
|
--- a/warnquota.conf
|
||||||
+++ b/warnquota.conf
|
+++ b/warnquota.conf
|
||||||
@@ -4,17 +4,16 @@
|
@@ -19,20 +19,20 @@ FAIL = "configure /etc/warnquota.conf before running warnquota"
|
||||||
# and even blank lines
|
#
|
||||||
|
# command used for sending mails
|
||||||
|
#
|
||||||
|
-MAIL_CMD = "/usr/lib/sendmail -t"
|
||||||
|
+MAIL_CMD = "/usr/sbin/sendmail -t"
|
||||||
|
|
||||||
# values can be quoted:
|
#
|
||||||
-#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
|
# Standard mail fields
|
||||||
-MAIL_CMD = "/bin/echo"
|
-FROM = "root@localhost"
|
||||||
-FROM = "bas@example.com"
|
-SUBJECT = "Your account quota has exceeded!"
|
||||||
+MAIL_CMD = "/usr/sbin/sendmail -t"
|
+FROM = "root@example.com"
|
||||||
+FROM = "root@example.com"
|
+SUBJECT = "You are exceeding your allocated disk space limits"
|
||||||
# but they don't have to be:
|
# Note that if LDAP is configured, the name in CC_TO gets looked up in LDAP
|
||||||
-SUBJECT = Hey, user, clean up your account!
|
# to obtain email address similarly to email recipient address.
|
||||||
-CC_TO = "sysadm@example.com"
|
-CC_TO = "root@localhost"
|
||||||
+SUBJECT = NOTE: You are exceeding your allocated disk space limits
|
|
||||||
+CC_TO = "root@example.com"
|
+CC_TO = "root@example.com"
|
||||||
# If you set this variable CC will be used only when user has less than
|
# If you set this variable CC will be used only when user has less than
|
||||||
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
|
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
|
||||||
# 12 hours, 5 days)
|
# 12 hours, 5 days)
|
||||||
# CC_BEFORE = 2 days
|
# CC_BEFORE = 2 days
|
||||||
-SUPPORT = "support@example.com"
|
-SUPPORT = "root@localhost"
|
||||||
+SUPPORT = "root@example.com"
|
+SUPPORT = "root@example.com"
|
||||||
PHONE = "(123) 456-1111 or (222) 333-4444"
|
PHONE = "123 456 789"
|
||||||
# Text in the beginning of the mail (if not specified, default text is used)
|
# Text in the beginning of the mail (if not specified, default text is used)
|
||||||
# This way text can be split to more lines
|
# This way text can be split to more lines
|
||||||
@@ -22,11 +21,11 @@ PHONE = "(123) 456-1111 or (222) 333-4444"
|
@@ -40,11 +40,11 @@ PHONE = "123 456 789"
|
||||||
# The expressions %i, %h, %d, and %% are substituted for user/group name,
|
# The expressions %i, %h, %d, and %% are substituted for user/group name,
|
||||||
# host name, domain name, and '%' respectively. For backward compatibility
|
# host name, domain name, and '%' respectively. For backward compatibility
|
||||||
# %s behaves as %i but is deprecated.
|
# %s behaves as %i but is deprecated.
|
||||||
@ -72,5 +76,5 @@ index b06f81f..7e00947 100644
|
|||||||
GROUP_MESSAGE = Hello,|\
|
GROUP_MESSAGE = Hello,|\
|
||||||
your group %i is using too much disk space at %h.|\
|
your group %i is using too much disk space at %h.|\
|
||||||
--
|
--
|
||||||
2.13.5
|
2.25.4
|
||||||
|
|
||||||
580
SOURCES/quota-4.10-Add-quotactl_fd-support.patch
Normal file
580
SOURCES/quota-4.10-Add-quotactl_fd-support.patch
Normal file
@ -0,0 +1,580 @@
|
|||||||
|
From ded570b1fffbeaefbecb6c191f0b5168f3b8ad0d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Maiolino <cem@kernel.org>
|
||||||
|
Date: Fri, 26 Jan 2024 19:02:10 +0100
|
||||||
|
Subject: [PATCH 2/3] Add quotactl_fd() support
|
||||||
|
|
||||||
|
To be able to set quotas on filesystems without a backing device, quota tools
|
||||||
|
should be able to use quotactl_fd().
|
||||||
|
To achieve that, add a new helper, do_quotactl(), to select between quotactl()
|
||||||
|
and quotactl_fd().
|
||||||
|
|
||||||
|
This shouldn't change the semantics of current code. quotactl_fd() will be
|
||||||
|
called if and only if the handlers contain an empty device, and a valid
|
||||||
|
mountpoint.
|
||||||
|
All current calls containing a value device should be still handled by quotactl().
|
||||||
|
The same is true for calls passing a NULL device on purpose, aiming to sync
|
||||||
|
active quotas.
|
||||||
|
|
||||||
|
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
|
||||||
|
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile.am | 1 +
|
||||||
|
quotacheck.c | 12 +++++------
|
||||||
|
quotaio.c | 4 ++--
|
||||||
|
quotaio_generic.c | 12 +++++------
|
||||||
|
quotaio_meta.c | 4 ++--
|
||||||
|
quotaio_v1.c | 10 ++++-----
|
||||||
|
quotaio_v2.c | 12 +++++------
|
||||||
|
quotaio_xfs.c | 21 ++++++++++--------
|
||||||
|
quotaon.c | 8 +++----
|
||||||
|
quotaon_xfs.c | 9 ++++----
|
||||||
|
quotasync.c | 2 +-
|
||||||
|
quotasys.c | 55 ++++++++++++++++++++++++++++++++++++-----------
|
||||||
|
quotasys.h | 3 +++
|
||||||
|
13 files changed, 96 insertions(+), 57 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile.am b/Makefile.am
|
||||||
|
index 372eafb..13a0f06 100644
|
||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -207,6 +207,7 @@ quotastats_SOURCES = \
|
||||||
|
pot.h
|
||||||
|
|
||||||
|
quotastats_LDADD = \
|
||||||
|
+ libquota.a \
|
||||||
|
$(INTLLIBS)
|
||||||
|
|
||||||
|
xqmstats_SOURCES = \
|
||||||
|
diff --git a/quotacheck.c b/quotacheck.c
|
||||||
|
index bd62d9a..e2c3bbd 100644
|
||||||
|
--- a/quotacheck.c
|
||||||
|
+++ b/quotacheck.c
|
||||||
|
@@ -648,8 +648,8 @@ Please turn quotas off or use -f to force checking.\n"),
|
||||||
|
type2name(type), mnt->me_dir);
|
||||||
|
}
|
||||||
|
/* At least sync quotas so damage will be smaller */
|
||||||
|
- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC)? Q_SYNC : Q_6_5_SYNC, type),
|
||||||
|
- mnt->me_devname, 0, NULL) < 0)
|
||||||
|
+ if (do_quotactl(QCMD((kernel_iface == IFACE_GENERIC)? Q_SYNC : Q_6_5_SYNC, type),
|
||||||
|
+ mnt->me_devname, mnt->me_dir, 0, NULL) < 0)
|
||||||
|
die(4, _("Error while syncing quotas on %s: %s\n"), mnt->me_devname, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -848,8 +848,8 @@ static int dump_to_file(struct mount_entry *mnt, int type)
|
||||||
|
if (get_qf_name(mnt, type, cfmt, NF_FORMAT, &filename) < 0)
|
||||||
|
errstr(_("Cannot find checked quota file for %ss on %s!\n"), _(type2name(type)), mnt->me_devname);
|
||||||
|
else {
|
||||||
|
- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_QUOTAOFF : Q_6_5_QUOTAOFF, type),
|
||||||
|
- mnt->me_devname, 0, NULL) < 0)
|
||||||
|
+ if (do_quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_QUOTAOFF : Q_6_5_QUOTAOFF, type),
|
||||||
|
+ mnt->me_devname, mnt->me_dir, 0, NULL) < 0)
|
||||||
|
errstr(_("Cannot turn %s quotas off on %s: %s\nKernel won't know about changes quotacheck did.\n"),
|
||||||
|
_(type2name(type)), mnt->me_devname, strerror(errno));
|
||||||
|
else {
|
||||||
|
@@ -859,9 +859,9 @@ static int dump_to_file(struct mount_entry *mnt, int type)
|
||||||
|
rename_files(mnt, type);
|
||||||
|
|
||||||
|
if (kernel_iface == IFACE_GENERIC)
|
||||||
|
- ret = quotactl(QCMD(Q_QUOTAON, type), mnt->me_devname, util2kernfmt(cfmt), filename);
|
||||||
|
+ ret = do_quotactl(QCMD(Q_QUOTAON, type), mnt->me_devname, mnt->me_dir, util2kernfmt(cfmt), filename);
|
||||||
|
else
|
||||||
|
- ret = quotactl(QCMD(Q_6_5_QUOTAON, type), mnt->me_devname, 0, filename);
|
||||||
|
+ ret = do_quotactl(QCMD(Q_6_5_QUOTAON, type), mnt->me_devname, mnt->me_dir, 0, filename);
|
||||||
|
if (ret < 0)
|
||||||
|
errstr(_("Cannot turn %s quotas on on %s: %s\nKernel won't know about changes quotacheck did.\n"),
|
||||||
|
_(type2name(type)), mnt->me_devname, strerror(errno));
|
||||||
|
diff --git a/quotaio.c b/quotaio.c
|
||||||
|
index 94ae458..9bebb5e 100644
|
||||||
|
--- a/quotaio.c
|
||||||
|
+++ b/quotaio.c
|
||||||
|
@@ -140,8 +140,8 @@ struct quota_handle *init_io(struct mount_entry *mnt, int type, int fmt, int fla
|
||||||
|
if (QIO_ENABLED(h)) { /* Kernel uses same file? */
|
||||||
|
unsigned int cmd =
|
||||||
|
(kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC;
|
||||||
|
- if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
|
||||||
|
- 0, NULL) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
|
||||||
|
+ h->qh_dir, 0, NULL) < 0) {
|
||||||
|
die(4, _("Cannot sync quotas on device %s: %s\n"),
|
||||||
|
h->qh_quotadev, strerror(errno));
|
||||||
|
}
|
||||||
|
diff --git a/quotaio_generic.c b/quotaio_generic.c
|
||||||
|
index 5b23955..3c95872 100644
|
||||||
|
--- a/quotaio_generic.c
|
||||||
|
+++ b/quotaio_generic.c
|
||||||
|
@@ -50,7 +50,7 @@ int vfs_get_info(struct quota_handle *h)
|
||||||
|
{
|
||||||
|
struct if_dqinfo kinfo;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_GETINFO, h->qh_type), h->qh_quotadev, 0, (void *)&kinfo) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_GETINFO, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kinfo) < 0) {
|
||||||
|
errstr(_("Cannot get info for %s quota file from kernel on %s: %s\n"), type2name(h->qh_type), h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -68,7 +68,7 @@ int vfs_set_info(struct quota_handle *h, int flags)
|
||||||
|
kinfo.dqi_igrace = h->qh_info.dqi_igrace;
|
||||||
|
kinfo.dqi_valid = flags;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_SETINFO, h->qh_type), h->qh_quotadev, 0, (void *)&kinfo) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_SETINFO, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kinfo) < 0) {
|
||||||
|
errstr(_("Cannot set info for %s quota file from kernel on %s: %s\n"), type2name(h->qh_type), h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -80,7 +80,7 @@ int vfs_get_dquot(struct dquot *dquot)
|
||||||
|
{
|
||||||
|
struct if_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_GETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_GETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev, dquot->dq_h->qh_dir, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
errstr(_("Cannot get quota for %s %d from kernel on %s: %s\n"), type2name(dquot->dq_h->qh_type), dquot->dq_id, dquot->dq_h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -95,7 +95,7 @@ int vfs_set_dquot(struct dquot *dquot, int flags)
|
||||||
|
|
||||||
|
generic_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
|
||||||
|
kdqblk.dqb_valid = flags;
|
||||||
|
- if (quotactl(QCMD(Q_SETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_SETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev, dquot->dq_h->qh_dir, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
errstr(_("Cannot set quota for %s %d from kernel on %s: %s\n"), type2name(dquot->dq_h->qh_type), dquot->dq_id, dquot->dq_h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -188,8 +188,8 @@ int vfs_scan_dquots(struct quota_handle *h,
|
||||||
|
|
||||||
|
dquot->dq_h = h;
|
||||||
|
while (1) {
|
||||||
|
- ret = quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type),
|
||||||
|
- h->qh_quotadev, id, (void *)&kdqblk);
|
||||||
|
+ ret = do_quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type),
|
||||||
|
+ h->qh_quotadev, h->qh_dir, id, (void *)&kdqblk);
|
||||||
|
if (ret < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
diff --git a/quotaio_meta.c b/quotaio_meta.c
|
||||||
|
index ad6ff7a..51ebbcf 100644
|
||||||
|
--- a/quotaio_meta.c
|
||||||
|
+++ b/quotaio_meta.c
|
||||||
|
@@ -59,8 +59,8 @@ static int meta_scan_dquots(struct quota_handle *h, int (*process_dquot)(struct
|
||||||
|
struct if_nextdqblk kdqblk;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- ret = quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type), h->qh_quotadev, 0,
|
||||||
|
- (void *)&kdqblk);
|
||||||
|
+ ret = do_quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type), h->qh_quotadev,
|
||||||
|
+ h->qh_dir, 0, (void *)&kdqblk);
|
||||||
|
/*
|
||||||
|
* Fall back to scanning using passwd if Q_GETNEXTQUOTA is not
|
||||||
|
* supported
|
||||||
|
diff --git a/quotaio_v1.c b/quotaio_v1.c
|
||||||
|
index 6a6dc78..187a5a5 100644
|
||||||
|
--- a/quotaio_v1.c
|
||||||
|
+++ b/quotaio_v1.c
|
||||||
|
@@ -118,7 +118,7 @@ static int v1_init_io(struct quota_handle *h)
|
||||||
|
else {
|
||||||
|
struct v1_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, 0, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqblk) < 0) {
|
||||||
|
if (errno == EPERM) { /* We have no permission to get this information? */
|
||||||
|
h->qh_info.dqi_bgrace = h->qh_info.dqi_igrace = 0; /* It hopefully won't be needed */
|
||||||
|
}
|
||||||
|
@@ -193,11 +193,11 @@ static int v1_write_info(struct quota_handle *h)
|
||||||
|
else {
|
||||||
|
struct v1_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, 0, (void *)&kdqblk) < 0)
|
||||||
|
+ if (do_quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
kdqblk.dqb_btime = h->qh_info.dqi_bgrace;
|
||||||
|
kdqblk.dqb_itime = h->qh_info.dqi_igrace;
|
||||||
|
- if (quotactl(QCMD(Q_V1_SETQUOTA, h->qh_type), h->qh_quotadev, 0, (void *)&kdqblk) < 0)
|
||||||
|
+ if (do_quotactl(QCMD(Q_V1_SETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -237,7 +237,7 @@ static struct dquot *v1_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
else {
|
||||||
|
struct v1_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, id, (void *)&kdqblk) < 0) {
|
||||||
|
free(dquot);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -299,7 +299,7 @@ static int v1_commit_dquot(struct dquot *dquot, int flags)
|
||||||
|
else
|
||||||
|
cmd = Q_V1_SETQUOTA;
|
||||||
|
v1_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
|
||||||
|
- if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev, dquot->dq_id,
|
||||||
|
+ if (do_quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev, h->qh_dir, dquot->dq_id,
|
||||||
|
(void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
diff --git a/quotaio_v2.c b/quotaio_v2.c
|
||||||
|
index 56a549f..b0fe7bf 100644
|
||||||
|
--- a/quotaio_v2.c
|
||||||
|
+++ b/quotaio_v2.c
|
||||||
|
@@ -275,7 +275,7 @@ static int v2_init_io(struct quota_handle *h)
|
||||||
|
else {
|
||||||
|
struct v2_kern_dqinfo kdqinfo;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_V2_GETINFO, h->qh_type), h->qh_quotadev, 0, (void *)&kdqinfo) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_V2_GETINFO, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqinfo) < 0) {
|
||||||
|
/* Temporary check just before fix gets to kernel */
|
||||||
|
if (errno == EPERM) /* Don't have permission to get information? */
|
||||||
|
return 0;
|
||||||
|
@@ -403,8 +403,8 @@ static int v2_write_info(struct quota_handle *h)
|
||||||
|
kdqinfo.dqi_blocks = h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks;
|
||||||
|
kdqinfo.dqi_free_blk = h->qh_info.u.v2_mdqi.dqi_qtree.dqi_free_blk;
|
||||||
|
kdqinfo.dqi_free_entry = h->qh_info.u.v2_mdqi.dqi_qtree.dqi_free_entry;
|
||||||
|
- if (quotactl(QCMD(Q_V2_SETGRACE, h->qh_type), h->qh_quotadev, 0, (void *)&kdqinfo) < 0 ||
|
||||||
|
- quotactl(QCMD(Q_V2_SETFLAGS, h->qh_type), h->qh_quotadev, 0, (void *)&kdqinfo) < 0)
|
||||||
|
+ if (do_quotactl(QCMD(Q_V2_SETGRACE, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqinfo) < 0 ||
|
||||||
|
+ do_quotactl(QCMD(Q_V2_SETFLAGS, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqinfo) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -441,7 +441,7 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
else {
|
||||||
|
struct v2_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_V2_GETQUOTA, h->qh_type), h->qh_quotadev, id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_V2_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, id, (void *)&kdqblk) < 0) {
|
||||||
|
free(dquot);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -485,8 +485,8 @@ static int v2_commit_dquot(struct dquot *dquot, int flags)
|
||||||
|
else
|
||||||
|
cmd = Q_V2_SETQUOTA;
|
||||||
|
v2_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
|
||||||
|
- if (quotactl(QCMD(cmd, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
|
||||||
|
- dquot->dq_id, (void *)&kdqblk) < 0)
|
||||||
|
+ if (do_quotactl(QCMD(cmd, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
|
||||||
|
+ dquot->dq_h->qh_dir, dquot->dq_id, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
||||||
|
index 5abb2c2..0bf6f34 100644
|
||||||
|
--- a/quotaio_xfs.c
|
||||||
|
+++ b/quotaio_xfs.c
|
||||||
|
@@ -128,7 +128,7 @@ static int xfs_init_io(struct quota_handle *h)
|
||||||
|
|
||||||
|
qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
|
||||||
|
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
|
||||||
|
- if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0)
|
||||||
|
+ if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir, 0, (void *)&info) < 0)
|
||||||
|
return -1;
|
||||||
|
h->qh_info.dqi_bgrace = info.qs_btimelimit;
|
||||||
|
h->qh_info.dqi_igrace = info.qs_itimelimit;
|
||||||
|
@@ -153,7 +153,7 @@ static int xfs_write_info(struct quota_handle *h)
|
||||||
|
xdqblk.d_itimer = h->qh_info.dqi_igrace;
|
||||||
|
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
|
||||||
|
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
|
||||||
|
- if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&xdqblk) < 0)
|
||||||
|
+ if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir, 0, (void *)&xdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -174,7 +174,8 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
return dquot;
|
||||||
|
|
||||||
|
qcmd = QCMD(Q_XFS_GETQUOTA, h->qh_type);
|
||||||
|
- if (quotactl(qcmd, h->qh_quotadev, id, (void *)&xdqblk) < 0) {
|
||||||
|
+ if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir,
|
||||||
|
+ id, (void *)&xdqblk) < 0) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@@ -219,7 +220,7 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
|
||||||
|
- if (quotactl(qcmd, h->qh_quotadev, id, (void *)&xdqblk) < 0)
|
||||||
|
+ if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir, id, (void *)&xdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -234,7 +235,9 @@ static int xfs_get_dquot(struct dquot *dq)
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
memset(&d, 0, sizeof(d));
|
||||||
|
- ret = quotactl(qcmd, dq->dq_h->qh_quotadev, dq->dq_id, (void *)&d);
|
||||||
|
+ ret = do_quotactl(qcmd, dq->dq_h->qh_quotadev, dq->dq_h->qh_dir,
|
||||||
|
+ dq->dq_id, (void *)&d);
|
||||||
|
+
|
||||||
|
if (ret < 0) {
|
||||||
|
if (errno == ENOENT)
|
||||||
|
return 0;
|
||||||
|
@@ -254,8 +257,8 @@ static int xfs_kernel_scan_dquots(struct quota_handle *h,
|
||||||
|
|
||||||
|
dquot->dq_h = h;
|
||||||
|
while (1) {
|
||||||
|
- ret = quotactl(QCMD(Q_XGETNEXTQUOTA, h->qh_type),
|
||||||
|
- h->qh_quotadev, id, (void *)&xdqblk);
|
||||||
|
+ ret = do_quotactl(QCMD(Q_XGETNEXTQUOTA, h->qh_type),
|
||||||
|
+ h->qh_quotadev, h->qh_dir, id, (void *)&xdqblk);
|
||||||
|
if (ret < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
@@ -286,8 +289,8 @@ static int xfs_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct
|
||||||
|
int ret;
|
||||||
|
struct xfs_kern_dqblk xdqblk;
|
||||||
|
|
||||||
|
- ret = quotactl(QCMD(Q_XGETNEXTQUOTA, h->qh_type), h->qh_quotadev, 0,
|
||||||
|
- (void *)&xdqblk);
|
||||||
|
+ ret = do_quotactl(QCMD(Q_XGETNEXTQUOTA, h->qh_type), h->qh_quotadev,
|
||||||
|
+ h->qh_dir, 0, (void *)&xdqblk);
|
||||||
|
if (ret < 0 && (errno == ENOSYS || errno == EINVAL)) {
|
||||||
|
if (!XFS_USRQUOTA(h) && !XFS_GRPQUOTA(h) && !XFS_PRJQUOTA(h))
|
||||||
|
return 0;
|
||||||
|
diff --git a/quotaon.c b/quotaon.c
|
||||||
|
index 125b934..351c851 100644
|
||||||
|
--- a/quotaon.c
|
||||||
|
+++ b/quotaon.c
|
||||||
|
@@ -152,13 +152,13 @@ static int quotarsquashonoff(const char *quotadev, int type, int flags)
|
||||||
|
|
||||||
|
info.dqi_flags = V1_DQF_RSQUASH;
|
||||||
|
info.dqi_valid = IIF_FLAGS;
|
||||||
|
- ret = quotactl(qcmd, quotadev, 0, (void *)&info);
|
||||||
|
+ ret = do_quotactl(qcmd, quotadev, NULL, 0, (void *)&info);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int mode = (flags & STATEFLAG_OFF) ? 0 : 1;
|
||||||
|
int qcmd = QCMD(Q_V1_RSQUASH, type);
|
||||||
|
|
||||||
|
- ret = quotactl(qcmd, quotadev, 0, (void *)&mode);
|
||||||
|
+ ret = do_quotactl(qcmd, quotadev, NULL, 0, (void *)&mode);
|
||||||
|
}
|
||||||
|
if (ret < 0) {
|
||||||
|
errstr(_("set root_squash on %s: %s\n"), quotadev, strerror(errno));
|
||||||
|
@@ -184,7 +184,7 @@ static int quotaonoff(const char *quotadev, const char *quotadir, char *quotafil
|
||||||
|
qcmd = QCMD(Q_QUOTAOFF, type);
|
||||||
|
else
|
||||||
|
qcmd = QCMD(Q_6_5_QUOTAOFF, type);
|
||||||
|
- if (quotactl(qcmd, quotadev, 0, NULL) < 0) {
|
||||||
|
+ if (do_quotactl(qcmd, quotadev, quotadir, 0, NULL) < 0) {
|
||||||
|
errstr(_("quotactl on %s [%s]: %s\n"), quotadev, quotadir, strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
@@ -199,7 +199,7 @@ static int quotaonoff(const char *quotadev, const char *quotadir, char *quotafil
|
||||||
|
qcmd = QCMD(Q_6_5_QUOTAON, type);
|
||||||
|
kqf = 0;
|
||||||
|
}
|
||||||
|
- if (quotactl(qcmd, quotadev, kqf, (void *)quotafile) < 0) {
|
||||||
|
+ if (do_quotactl(qcmd, quotadev, quotadir, kqf, (void *)quotafile) < 0) {
|
||||||
|
if (errno == ENOENT)
|
||||||
|
errstr(_("cannot find %s on %s [%s]\n"), quotafile, quotadev, quotadir);
|
||||||
|
else
|
||||||
|
diff --git a/quotaon_xfs.c b/quotaon_xfs.c
|
||||||
|
index d137240..dda3023 100644
|
||||||
|
--- a/quotaon_xfs.c
|
||||||
|
+++ b/quotaon_xfs.c
|
||||||
|
@@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r
|
||||||
|
if (flags & STATEFLAG_ALL)
|
||||||
|
return 0; /* noop */
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, NULL, 0, (void *)&info) < 0) {
|
||||||
|
errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -156,7 +156,7 @@ static int xfs_onoff(const char *dev, int type, int flags, int roothack, int xop
|
||||||
|
if (check != 1)
|
||||||
|
return (check < 0);
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(qcmd, type), dev, 0, (void *)&xopts) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(qcmd, type), dev, NULL, 0, (void *)&xopts) < 0) {
|
||||||
|
errstr(_("quotactl on %s: %s\n"), dev, strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
@@ -176,7 +176,7 @@ static int xfs_delete(const char *dev, int type, int flags, int roothack, int xo
|
||||||
|
if (check != 1)
|
||||||
|
return (check < 0);
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(qcmd, type), dev, 0, (void *)&xopts) < 0) {
|
||||||
|
+ if (do_quotactl(QCMD(qcmd, type), dev, NULL, 0, (void *)&xopts) < 0) {
|
||||||
|
errstr(_("Failed to delete quota: %s\n"),
|
||||||
|
strerror(errno));
|
||||||
|
return 1;
|
||||||
|
@@ -208,7 +208,8 @@ int xfs_newstate(struct mount_entry *mnt, int type, char *xarg, int flags)
|
||||||
|
struct xfs_mem_dqinfo info;
|
||||||
|
u_int16_t sbflags = 0;
|
||||||
|
|
||||||
|
- if (!quotactl(QCMD(Q_XFS_GETQSTAT, type), mnt->me_devname, 0, (void *)&info))
|
||||||
|
+ if (!quotactl(QCMD(Q_XFS_GETQSTAT, type), mnt->me_devname,
|
||||||
|
+ mnt->me_dir, 0, (void *)&info))
|
||||||
|
sbflags = (info.qs_flags & 0xff00) >> 8;
|
||||||
|
|
||||||
|
if ((type == USRQUOTA && (sbflags & XFS_QUOTA_UDQ_ACCT)) &&
|
||||||
|
diff --git a/quotasync.c b/quotasync.c
|
||||||
|
index 80f7e9e..cad2a20 100644
|
||||||
|
--- a/quotasync.c
|
||||||
|
+++ b/quotasync.c
|
||||||
|
@@ -100,7 +100,7 @@ static int sync_one(int type, char *dev)
|
||||||
|
{
|
||||||
|
int qcmd = QCMD(Q_SYNC, type);
|
||||||
|
|
||||||
|
- return quotactl(qcmd, dev, 0, NULL);
|
||||||
|
+ return do_quotactl(qcmd, dev, NULL, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int syncquotas(int type)
|
||||||
|
diff --git a/quotasys.c b/quotasys.c
|
||||||
|
index 9af9932..903816b 100644
|
||||||
|
--- a/quotasys.c
|
||||||
|
+++ b/quotasys.c
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
#include <sys/vfs.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
+#include <sys/syscall.h>
|
||||||
|
|
||||||
|
#include "pot.h"
|
||||||
|
#include "bylabel.h"
|
||||||
|
@@ -670,6 +671,36 @@ const char *str2number(const char *string, qsize_t *inodes)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Wrappers for quotactl syscalls
|
||||||
|
+ */
|
||||||
|
+#ifdef SYS_quotactl_fd
|
||||||
|
+int do_quotactl(int cmd, const char *dev, const char *mnt, int id, caddr_t addr)
|
||||||
|
+{
|
||||||
|
+ int ret = -EINVAL;
|
||||||
|
+
|
||||||
|
+ if (mnt && !dev) {
|
||||||
|
+ int fd = open(mnt, O_DIRECTORY | O_PATH);
|
||||||
|
+
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ errstr(_("Unable to get a filedescriptor from mountpoint: %s\n"), mnt);
|
||||||
|
+ return fd;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = syscall(SYS_quotactl_fd, fd, cmd, id, addr);
|
||||||
|
+ close(fd);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return quotactl(cmd, dev, id, addr);
|
||||||
|
+}
|
||||||
|
+#else
|
||||||
|
+int do_quotactl(int cmd, const char *dev, const char *mnt, int id, caddr_t addr)
|
||||||
|
+{
|
||||||
|
+ return quotactl(cmd, dev, id, addr);
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Wrappers for mount options processing functions
|
||||||
|
*/
|
||||||
|
@@ -685,7 +716,7 @@ static int hasxfsquota(const char *dev, struct mntent *mnt, int type, int flags)
|
||||||
|
return QF_XFS;
|
||||||
|
|
||||||
|
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
|
||||||
|
- if (!quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info)) {
|
||||||
|
+ if (!do_quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, mnt->mnt_dir, 0, (void *)&info)) {
|
||||||
|
#ifdef XFS_ROOTHACK
|
||||||
|
int sbflags = (info.qs_flags & 0xff00) >> 8;
|
||||||
|
#endif /* XFS_ROOTHACK */
|
||||||
|
@@ -719,7 +750,7 @@ static int hasvfsmetaquota(const char *dev, struct mntent *mnt, int type, int fl
|
||||||
|
{
|
||||||
|
uint32_t fmt;
|
||||||
|
|
||||||
|
- if (!quotactl(QCMD(Q_GETFMT, type), dev, 0, (void *)&fmt))
|
||||||
|
+ if (!do_quotactl(QCMD(Q_GETFMT, type), dev, mnt->mnt_dir, 0, (void *)&fmt))
|
||||||
|
return QF_META;
|
||||||
|
return QF_ERROR;
|
||||||
|
}
|
||||||
|
@@ -796,7 +827,7 @@ static int hasquota(const char *dev, struct mntent *mnt, int type, int flags)
|
||||||
|
if (!strcmp(mnt->mnt_type, MNTTYPE_EXT4) || !strcmp(mnt->mnt_type, MNTTYPE_F2FS)) {
|
||||||
|
struct if_dqinfo kinfo;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_GETINFO, type), dev, 0, (void *)&kinfo) == 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_GETINFO, type), dev, mnt->mnt_dir, 0, (void *)&kinfo) == 0) {
|
||||||
|
if (kinfo.dqi_flags & DQF_SYS_FILE)
|
||||||
|
return QF_META;
|
||||||
|
}
|
||||||
|
@@ -1069,11 +1100,11 @@ void init_kernel_interface(void)
|
||||||
|
else {
|
||||||
|
fs_quota_stat_t dummy;
|
||||||
|
|
||||||
|
- if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) ||
|
||||||
|
+ if (!do_quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", NULL, 0, (void *)&dummy) ||
|
||||||
|
(errno != EINVAL && errno != ENOSYS))
|
||||||
|
kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
|
||||||
|
}
|
||||||
|
- if (quotactl(QCMD(Q_V2_GETSTATS, 0), NULL, 0, (void *)&v2_stats) >= 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_V2_GETSTATS, 0), NULL, NULL, 0, (void *)&v2_stats) >= 0) {
|
||||||
|
kernel_qfmt[kernel_qfmt_num++] = QF_VFSV0;
|
||||||
|
kernel_iface = IFACE_VFSV0;
|
||||||
|
}
|
||||||
|
@@ -1085,9 +1116,9 @@ void init_kernel_interface(void)
|
||||||
|
int err_quota = 0;
|
||||||
|
char tmp[1024]; /* Just temporary buffer */
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, 0, tmp))
|
||||||
|
+ if (do_quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, NULL, 0, tmp))
|
||||||
|
err_stat = errno;
|
||||||
|
- if (quotactl(QCMD(Q_V1_GETQUOTA, 0), "/dev/null", 0, tmp))
|
||||||
|
+ if (do_quotactl(QCMD(Q_V1_GETQUOTA, 0), "/dev/null", NULL, 0, tmp))
|
||||||
|
err_quota = errno;
|
||||||
|
|
||||||
|
/* On a RedHat 2.4.2-2 we expect 0, EINVAL
|
||||||
|
@@ -1127,7 +1158,7 @@ static int v1_kern_quota_on(const char *dev, int type)
|
||||||
|
char tmp[1024]; /* Just temporary buffer */
|
||||||
|
qid_t id = (type == USRQUOTA) ? getuid() : getgid();
|
||||||
|
|
||||||
|
- if (!quotactl(QCMD(Q_V1_GETQUOTA, type), dev, id, tmp)) /* OK? */
|
||||||
|
+ if (!do_quotactl(QCMD(Q_V1_GETQUOTA, type), dev, NULL, id, tmp)) /* OK? */
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -1138,7 +1169,7 @@ static int v2_kern_quota_on(const char *dev, int type)
|
||||||
|
char tmp[1024]; /* Just temporary buffer */
|
||||||
|
qid_t id = (type == USRQUOTA) ? getuid() : getgid();
|
||||||
|
|
||||||
|
- if (!quotactl(QCMD(Q_V2_GETQUOTA, type), dev, id, tmp)) /* OK? */
|
||||||
|
+ if (!do_quotactl(QCMD(Q_V2_GETQUOTA, type), dev, NULL, id, tmp)) /* OK? */
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -1155,7 +1186,7 @@ int kern_quota_state_xfs(const char *dev, int type)
|
||||||
|
{
|
||||||
|
struct xfs_mem_dqinfo info;
|
||||||
|
|
||||||
|
- if (!quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info)) {
|
||||||
|
+ if (!do_quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, NULL, 0, (void *)&info)) {
|
||||||
|
if (type == USRQUOTA) {
|
||||||
|
return !!(info.qs_flags & XFS_QUOTA_UDQ_ACCT) +
|
||||||
|
!!(info.qs_flags & XFS_QUOTA_UDQ_ENFD);
|
||||||
|
@@ -1199,8 +1230,8 @@ int kern_quota_on(struct mount_entry *mnt, int type, int fmt)
|
||||||
|
if (kernel_iface == IFACE_GENERIC) {
|
||||||
|
int actfmt;
|
||||||
|
|
||||||
|
- if (quotactl(QCMD(Q_GETFMT, type), mnt->me_devname, 0,
|
||||||
|
- (void *)&actfmt) >= 0) {
|
||||||
|
+ if (do_quotactl(QCMD(Q_GETFMT, type), mnt->me_devname,
|
||||||
|
+ mnt->me_dir, 0, (void *)&actfmt) >= 0) {
|
||||||
|
actfmt = kern2utilfmt(actfmt);
|
||||||
|
if (actfmt >= 0)
|
||||||
|
return actfmt;
|
||||||
|
diff --git a/quotasys.h b/quotasys.h
|
||||||
|
index 841251e..b166ad2 100644
|
||||||
|
--- a/quotasys.h
|
||||||
|
+++ b/quotasys.h
|
||||||
|
@@ -206,6 +206,9 @@ void end_mounts_scan(void);
|
||||||
|
/* Parse kernel version and return 1 if ext4 supports quota feature */
|
||||||
|
int ext4_supports_quota_feature(void);
|
||||||
|
|
||||||
|
+/* Wrapper around quota syscalls, either call quotactl or quotactl_fd */
|
||||||
|
+int do_quotactl(int cmd, const char *dev, const char *mnt, int id, caddr_t addr);
|
||||||
|
+
|
||||||
|
/* Quota output formats */
|
||||||
|
#define QOF_ERROR -1
|
||||||
|
#define QOF_DEFAULT 0
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
||||||
336
SOURCES/quota-4.10-Enable-support-for-tmpfs-quotas.patch
Normal file
336
SOURCES/quota-4.10-Enable-support-for-tmpfs-quotas.patch
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
From 00534e79856c8ce385ea1fdcdc2dcb32b1ed5de6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Maiolino <cem@kernel.org>
|
||||||
|
Date: Fri, 26 Jan 2024 19:02:11 +0100
|
||||||
|
Subject: [PATCH 3/3] Enable support for tmpfs quotas
|
||||||
|
|
||||||
|
To achieve so, add a new function quotactl_handle() to the quotaio subsystem,
|
||||||
|
this will call do_quotactl() with or without a valid quotadev, according to the
|
||||||
|
filesystem type.
|
||||||
|
|
||||||
|
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
|
||||||
|
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||||
|
---
|
||||||
|
mntopt.h | 1 +
|
||||||
|
quotaio.c | 19 +++++++++++++++++--
|
||||||
|
quotaio.h | 2 ++
|
||||||
|
quotaio_generic.c | 11 +++++------
|
||||||
|
quotaio_meta.c | 3 +--
|
||||||
|
quotaio_v1.c | 11 +++++------
|
||||||
|
quotaio_v2.c | 11 +++++------
|
||||||
|
quotaio_xfs.c | 4 ++--
|
||||||
|
quotasys.c | 27 +++++++++++++++++++++------
|
||||||
|
9 files changed, 59 insertions(+), 30 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mntopt.h b/mntopt.h
|
||||||
|
index 0f3b0c5..9b71990 100644
|
||||||
|
--- a/mntopt.h
|
||||||
|
+++ b/mntopt.h
|
||||||
|
@@ -22,6 +22,7 @@
|
||||||
|
#define MNTTYPE_MPFS "mpfs" /* EMC Celerra MPFS filesystem */
|
||||||
|
#define MNTTYPE_OCFS2 "ocfs2" /* Oracle Cluster filesystem */
|
||||||
|
#define MNTTYPE_GFS2 "gfs2" /* Red Hat Global filesystem 2 */
|
||||||
|
+#define MNTTYPE_TMPFS "tmpfs" /* tmpfs filesystem */
|
||||||
|
|
||||||
|
#ifndef MNTTYPE_NFS
|
||||||
|
#define MNTTYPE_NFS "nfs" /* Network file system. */
|
||||||
|
diff --git a/quotaio.c b/quotaio.c
|
||||||
|
index 9bebb5e..ae40d2a 100644
|
||||||
|
--- a/quotaio.c
|
||||||
|
+++ b/quotaio.c
|
||||||
|
@@ -34,6 +34,22 @@ struct disk_dqheader {
|
||||||
|
u_int32_t dqh_version;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
+int quotactl_handle(int cmd, struct quota_handle *h, int id, void *addr)
|
||||||
|
+{
|
||||||
|
+ int err = -EINVAL;
|
||||||
|
+
|
||||||
|
+ if (!h)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ if (!strcmp(h->qh_fstype, MNTTYPE_TMPFS))
|
||||||
|
+ err = do_quotactl(QCMD(cmd, h->qh_type), NULL, h->qh_dir,
|
||||||
|
+ id, addr);
|
||||||
|
+ else
|
||||||
|
+ err = do_quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
|
||||||
|
+ h->qh_dir, id, addr);
|
||||||
|
+
|
||||||
|
+ return err;
|
||||||
|
+}
|
||||||
|
/*
|
||||||
|
* Detect quota format and initialize quota IO
|
||||||
|
*/
|
||||||
|
@@ -140,8 +156,7 @@ struct quota_handle *init_io(struct mount_entry *mnt, int type, int fmt, int fla
|
||||||
|
if (QIO_ENABLED(h)) { /* Kernel uses same file? */
|
||||||
|
unsigned int cmd =
|
||||||
|
(kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC;
|
||||||
|
- if (do_quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
|
||||||
|
- h->qh_dir, 0, NULL) < 0) {
|
||||||
|
+ if (quotactl_handle(cmd, h, 0, NULL) < 0) {
|
||||||
|
die(4, _("Cannot sync quotas on device %s: %s\n"),
|
||||||
|
h->qh_quotadev, strerror(errno));
|
||||||
|
}
|
||||||
|
diff --git a/quotaio.h b/quotaio.h
|
||||||
|
index 2c373b2..91689d9 100644
|
||||||
|
--- a/quotaio.h
|
||||||
|
+++ b/quotaio.h
|
||||||
|
@@ -182,4 +182,6 @@ struct dquot *get_empty_dquot(void);
|
||||||
|
/* Check whether values in current dquot can be stored on disk */
|
||||||
|
int check_dquot_range(struct dquot *dquot);
|
||||||
|
|
||||||
|
+/* Uses do_quotactl() to call quotactl() or quotactl_fd() */
|
||||||
|
+int quotactl_handle(int cmd, struct quota_handle *h, int id, void *addr);
|
||||||
|
#endif /* GUARD_QUOTAIO_H */
|
||||||
|
diff --git a/quotaio_generic.c b/quotaio_generic.c
|
||||||
|
index 3c95872..cf03b59 100644
|
||||||
|
--- a/quotaio_generic.c
|
||||||
|
+++ b/quotaio_generic.c
|
||||||
|
@@ -50,7 +50,7 @@ int vfs_get_info(struct quota_handle *h)
|
||||||
|
{
|
||||||
|
struct if_dqinfo kinfo;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_GETINFO, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kinfo) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_GETINFO, h, 0, (void *)&kinfo) < 0) {
|
||||||
|
errstr(_("Cannot get info for %s quota file from kernel on %s: %s\n"), type2name(h->qh_type), h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -68,7 +68,7 @@ int vfs_set_info(struct quota_handle *h, int flags)
|
||||||
|
kinfo.dqi_igrace = h->qh_info.dqi_igrace;
|
||||||
|
kinfo.dqi_valid = flags;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_SETINFO, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kinfo) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_SETINFO, h, 0, (void *)&kinfo) < 0) {
|
||||||
|
errstr(_("Cannot set info for %s quota file from kernel on %s: %s\n"), type2name(h->qh_type), h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -80,7 +80,7 @@ int vfs_get_dquot(struct dquot *dquot)
|
||||||
|
{
|
||||||
|
struct if_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_GETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev, dquot->dq_h->qh_dir, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_GETQUOTA, dquot->dq_h, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
errstr(_("Cannot get quota for %s %d from kernel on %s: %s\n"), type2name(dquot->dq_h->qh_type), dquot->dq_id, dquot->dq_h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -95,7 +95,7 @@ int vfs_set_dquot(struct dquot *dquot, int flags)
|
||||||
|
|
||||||
|
generic_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
|
||||||
|
kdqblk.dqb_valid = flags;
|
||||||
|
- if (do_quotactl(QCMD(Q_SETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev, dquot->dq_h->qh_dir, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_SETQUOTA, dquot->dq_h, dquot->dq_id, (void *)&kdqblk) < 0) {
|
||||||
|
errstr(_("Cannot set quota for %s %d from kernel on %s: %s\n"), type2name(dquot->dq_h->qh_type), dquot->dq_id, dquot->dq_h->qh_quotadev, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -188,8 +188,7 @@ int vfs_scan_dquots(struct quota_handle *h,
|
||||||
|
|
||||||
|
dquot->dq_h = h;
|
||||||
|
while (1) {
|
||||||
|
- ret = do_quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type),
|
||||||
|
- h->qh_quotadev, h->qh_dir, id, (void *)&kdqblk);
|
||||||
|
+ ret = quotactl_handle(Q_GETNEXTQUOTA, h, id, (void *)&kdqblk);
|
||||||
|
if (ret < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
diff --git a/quotaio_meta.c b/quotaio_meta.c
|
||||||
|
index 51ebbcf..99fdaf8 100644
|
||||||
|
--- a/quotaio_meta.c
|
||||||
|
+++ b/quotaio_meta.c
|
||||||
|
@@ -59,8 +59,7 @@ static int meta_scan_dquots(struct quota_handle *h, int (*process_dquot)(struct
|
||||||
|
struct if_nextdqblk kdqblk;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- ret = do_quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type), h->qh_quotadev,
|
||||||
|
- h->qh_dir, 0, (void *)&kdqblk);
|
||||||
|
+ ret = quotactl_handle(Q_GETNEXTQUOTA, h, 0, (void *)&kdqblk);
|
||||||
|
/*
|
||||||
|
* Fall back to scanning using passwd if Q_GETNEXTQUOTA is not
|
||||||
|
* supported
|
||||||
|
diff --git a/quotaio_v1.c b/quotaio_v1.c
|
||||||
|
index 187a5a5..0b88d0c 100644
|
||||||
|
--- a/quotaio_v1.c
|
||||||
|
+++ b/quotaio_v1.c
|
||||||
|
@@ -118,7 +118,7 @@ static int v1_init_io(struct quota_handle *h)
|
||||||
|
else {
|
||||||
|
struct v1_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_V1_GETQUOTA, h, 0, (void *)&kdqblk) < 0) {
|
||||||
|
if (errno == EPERM) { /* We have no permission to get this information? */
|
||||||
|
h->qh_info.dqi_bgrace = h->qh_info.dqi_igrace = 0; /* It hopefully won't be needed */
|
||||||
|
}
|
||||||
|
@@ -193,11 +193,11 @@ static int v1_write_info(struct quota_handle *h)
|
||||||
|
else {
|
||||||
|
struct v1_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqblk) < 0)
|
||||||
|
+ if (quotactl_handle(Q_V1_GETQUOTA, h, 0, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
kdqblk.dqb_btime = h->qh_info.dqi_bgrace;
|
||||||
|
kdqblk.dqb_itime = h->qh_info.dqi_igrace;
|
||||||
|
- if (do_quotactl(QCMD(Q_V1_SETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqblk) < 0)
|
||||||
|
+ if (quotactl_handle(Q_V1_SETQUOTA, h, 0, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -237,7 +237,7 @@ static struct dquot *v1_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
else {
|
||||||
|
struct v1_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_V1_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_V1_GETQUOTA, h, id, (void *)&kdqblk) < 0) {
|
||||||
|
free(dquot);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -299,8 +299,7 @@ static int v1_commit_dquot(struct dquot *dquot, int flags)
|
||||||
|
else
|
||||||
|
cmd = Q_V1_SETQUOTA;
|
||||||
|
v1_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
|
||||||
|
- if (do_quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev, h->qh_dir, dquot->dq_id,
|
||||||
|
- (void *)&kdqblk) < 0)
|
||||||
|
+ if (quotactl_handle(cmd, h, dquot->dq_id, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/quotaio_v2.c b/quotaio_v2.c
|
||||||
|
index b0fe7bf..9927cad 100644
|
||||||
|
--- a/quotaio_v2.c
|
||||||
|
+++ b/quotaio_v2.c
|
||||||
|
@@ -275,7 +275,7 @@ static int v2_init_io(struct quota_handle *h)
|
||||||
|
else {
|
||||||
|
struct v2_kern_dqinfo kdqinfo;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_V2_GETINFO, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqinfo) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_V2_GETINFO, h, 0, (void *)&kdqinfo) < 0) {
|
||||||
|
/* Temporary check just before fix gets to kernel */
|
||||||
|
if (errno == EPERM) /* Don't have permission to get information? */
|
||||||
|
return 0;
|
||||||
|
@@ -403,8 +403,8 @@ static int v2_write_info(struct quota_handle *h)
|
||||||
|
kdqinfo.dqi_blocks = h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks;
|
||||||
|
kdqinfo.dqi_free_blk = h->qh_info.u.v2_mdqi.dqi_qtree.dqi_free_blk;
|
||||||
|
kdqinfo.dqi_free_entry = h->qh_info.u.v2_mdqi.dqi_qtree.dqi_free_entry;
|
||||||
|
- if (do_quotactl(QCMD(Q_V2_SETGRACE, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqinfo) < 0 ||
|
||||||
|
- do_quotactl(QCMD(Q_V2_SETFLAGS, h->qh_type), h->qh_quotadev, h->qh_dir, 0, (void *)&kdqinfo) < 0)
|
||||||
|
+ if (quotactl_handle(Q_V2_SETGRACE, h, 0, (void *)&kdqinfo) < 0 ||
|
||||||
|
+ quotactl_handle(Q_V2_SETFLAGS, h, 0, (void *)&kdqinfo) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -441,7 +441,7 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
else {
|
||||||
|
struct v2_kern_dqblk kdqblk;
|
||||||
|
|
||||||
|
- if (do_quotactl(QCMD(Q_V2_GETQUOTA, h->qh_type), h->qh_quotadev, h->qh_dir, id, (void *)&kdqblk) < 0) {
|
||||||
|
+ if (quotactl_handle(Q_V2_GETQUOTA, h, id, (void *)&kdqblk) < 0) {
|
||||||
|
free(dquot);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -485,8 +485,7 @@ static int v2_commit_dquot(struct dquot *dquot, int flags)
|
||||||
|
else
|
||||||
|
cmd = Q_V2_SETQUOTA;
|
||||||
|
v2_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
|
||||||
|
- if (do_quotactl(QCMD(cmd, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
|
||||||
|
- dquot->dq_h->qh_dir, dquot->dq_id, (void *)&kdqblk) < 0)
|
||||||
|
+ if (quotactl_handle(cmd, dquot->dq_h, dquot->dq_id, (void *)&kdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
||||||
|
index 0bf6f34..d742f9c 100644
|
||||||
|
--- a/quotaio_xfs.c
|
||||||
|
+++ b/quotaio_xfs.c
|
||||||
|
@@ -128,7 +128,7 @@ static int xfs_init_io(struct quota_handle *h)
|
||||||
|
|
||||||
|
qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
|
||||||
|
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
|
||||||
|
- if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir, 0, (void *)&info) < 0)
|
||||||
|
+ if (quotactl_handle(qcmd, h, 0, (void *)&info) < 0)
|
||||||
|
return -1;
|
||||||
|
h->qh_info.dqi_bgrace = info.qs_btimelimit;
|
||||||
|
h->qh_info.dqi_igrace = info.qs_itimelimit;
|
||||||
|
@@ -153,7 +153,7 @@ static int xfs_write_info(struct quota_handle *h)
|
||||||
|
xdqblk.d_itimer = h->qh_info.dqi_igrace;
|
||||||
|
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
|
||||||
|
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
|
||||||
|
- if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir, 0, (void *)&xdqblk) < 0)
|
||||||
|
+ if (quotactl_handle(qcmd, h, 0, (void *)&xdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
diff --git a/quotasys.c b/quotasys.c
|
||||||
|
index 903816b..afe5f6d 100644
|
||||||
|
--- a/quotasys.c
|
||||||
|
+++ b/quotasys.c
|
||||||
|
@@ -70,7 +70,15 @@ int nfs_fstype(char *type)
|
||||||
|
*/
|
||||||
|
int meta_qf_fstype(char *type)
|
||||||
|
{
|
||||||
|
- return !strcmp(type, MNTTYPE_OCFS2);
|
||||||
|
+ return !strcmp(type, MNTTYPE_OCFS2) || !strcmp(type, MNTTYPE_TMPFS);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Check whether the filesystem is not using block device as a backing
|
||||||
|
+ */
|
||||||
|
+int nodev_fstype(char *type)
|
||||||
|
+{
|
||||||
|
+ return !strcmp(type, MNTTYPE_TMPFS) || nfs_fstype(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -752,6 +760,7 @@ static int hasvfsmetaquota(const char *dev, struct mntent *mnt, int type, int fl
|
||||||
|
|
||||||
|
if (!do_quotactl(QCMD(Q_GETFMT, type), dev, mnt->mnt_dir, 0, (void *)&fmt))
|
||||||
|
return QF_META;
|
||||||
|
+
|
||||||
|
return QF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -816,8 +825,13 @@ static int hasquota(const char *dev, struct mntent *mnt, int type, int flags)
|
||||||
|
!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
|
||||||
|
!strcmp(mnt->mnt_type, MNTTYPE_EXFS))
|
||||||
|
return hasxfsquota(dev, mnt, type, flags);
|
||||||
|
+
|
||||||
|
if (!strcmp(mnt->mnt_type, MNTTYPE_OCFS2))
|
||||||
|
return hasvfsmetaquota(dev, mnt, type, flags);
|
||||||
|
+
|
||||||
|
+ /* tmpfs has no device, pass null here so quotactl_fd() is called */
|
||||||
|
+ if (!strcmp(mnt->mnt_type, MNTTYPE_TMPFS))
|
||||||
|
+ return hasvfsmetaquota(NULL, mnt, type, flags);
|
||||||
|
/*
|
||||||
|
* For ext4 we check whether it has quota in system files and if not,
|
||||||
|
* we fall back on checking standard quotas. Furthermore we cannot use
|
||||||
|
@@ -1384,7 +1398,7 @@ alloc:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!nfs_fstype(mnt->mnt_type)) {
|
||||||
|
+ if (!nodev_fstype(mnt->mnt_type)) {
|
||||||
|
if (stat(devname, &st) < 0) { /* Can't stat mounted device? */
|
||||||
|
errstr(_("Cannot stat() mounted device %s: %s\n"), devname, strerror(errno));
|
||||||
|
free((char *)devname);
|
||||||
|
@@ -1398,15 +1412,16 @@ alloc:
|
||||||
|
dev = st.st_rdev;
|
||||||
|
for (i = 0; i < mnt_entries_cnt && mnt_entries[i].me_dev != dev; i++);
|
||||||
|
}
|
||||||
|
- /* Cope with network filesystems or new mountpoint */
|
||||||
|
- if (nfs_fstype(mnt->mnt_type) || i == mnt_entries_cnt) {
|
||||||
|
+
|
||||||
|
+ /* Cope with filesystems without a block device or new mountpoint */
|
||||||
|
+ if (nodev_fstype(mnt->mnt_type) || i == mnt_entries_cnt) {
|
||||||
|
if (stat(mnt->mnt_dir, &st) < 0) { /* Can't stat mountpoint? We have better ignore it... */
|
||||||
|
errstr(_("Cannot stat() mountpoint %s: %s\n"), mnt->mnt_dir, strerror(errno));
|
||||||
|
free((char *)devname);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- if (nfs_fstype(mnt->mnt_type)) {
|
||||||
|
- /* For network filesystems we must get device from root */
|
||||||
|
+ if (nodev_fstype(mnt->mnt_type)) {
|
||||||
|
+ /* For filesystems without block device we must get device from root */
|
||||||
|
dev = st.st_dev;
|
||||||
|
if (!(flags & MS_NFS_ALL)) {
|
||||||
|
for (i = 0; i < mnt_entries_cnt && mnt_entries[i].me_dev != dev; i++);
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
From c18e5a1b1e51c0382f5d1431120fe65f7e9c982c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Carlos Maiolino <cem@kernel.org>
|
||||||
|
Date: Fri, 26 Jan 2024 19:02:09 +0100
|
||||||
|
Subject: [PATCH 1/3] Rename searched_dir->sd_dir to sd_isdir
|
||||||
|
|
||||||
|
The field holds information if we are searching a directory mountpoint or a
|
||||||
|
device, rename the field to something more meaningful.
|
||||||
|
|
||||||
|
We could switch it to bool, but it seems pointless to include a whole header
|
||||||
|
just for it, so keep the int type.
|
||||||
|
|
||||||
|
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||||
|
---
|
||||||
|
quotasys.c | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/quotasys.c b/quotasys.c
|
||||||
|
index 3f50e32..9af9932 100644
|
||||||
|
--- a/quotasys.c
|
||||||
|
+++ b/quotasys.c
|
||||||
|
@@ -1223,7 +1223,7 @@ int kern_quota_on(struct mount_entry *mnt, int type, int fmt)
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct searched_dir {
|
||||||
|
- int sd_dir; /* Is searched dir mountpoint or in fact device? */
|
||||||
|
+ int sd_isdir; /* Is searched dir mountpoint or in fact device? */
|
||||||
|
dev_t sd_dev; /* Device mountpoint lies on */
|
||||||
|
ino_t sd_ino; /* Inode number of mountpoint */
|
||||||
|
const char *sd_name; /* Name of given dir/device */
|
||||||
|
@@ -1454,7 +1454,7 @@ static int process_dirs(int dcnt, char **dirs, int flags)
|
||||||
|
errstr(_("Cannot stat() given mountpoint %s: %s\nSkipping...\n"), dirs[i], strerror(errno));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- check_dirs[check_dirs_cnt].sd_dir = S_ISDIR(st.st_mode);
|
||||||
|
+ check_dirs[check_dirs_cnt].sd_isdir = S_ISDIR(st.st_mode);
|
||||||
|
if (S_ISDIR(st.st_mode)) {
|
||||||
|
const char *realmnt = dirs[i];
|
||||||
|
|
||||||
|
@@ -1538,7 +1538,7 @@ restart:
|
||||||
|
return 0;
|
||||||
|
sd = check_dirs + act_checked;
|
||||||
|
for (i = 0; i < mnt_entries_cnt; i++) {
|
||||||
|
- if (sd->sd_dir) {
|
||||||
|
+ if (sd->sd_isdir) {
|
||||||
|
if (sd->sd_dev == mnt_entries[i].me_dev && sd->sd_ino == mnt_entries[i].me_ino)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
From dba8c5ca95516b9550fc44b2a476ceca60ee4b38 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Kara <jack@suse.cz>
|
||||||
|
Date: Tue, 7 May 2024 12:55:30 +0200
|
||||||
|
Subject: [PATCH] quotaio_xfs: Fix error handling in xfs_read_dquot()
|
||||||
|
|
||||||
|
When quotactl(2) fails, xfs_read_dquot() will happily return zero-filled
|
||||||
|
structure. This is fine when the user structure does not exist but it is
|
||||||
|
wrong when there's other error (like EACCESS). Fix the error handling.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||||
|
---
|
||||||
|
quotaio_xfs.c | 7 ++++++-
|
||||||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
||||||
|
index d742f9c..040e7d8 100644
|
||||||
|
--- a/quotaio_xfs.c
|
||||||
|
+++ b/quotaio_xfs.c
|
||||||
|
@@ -176,7 +176,12 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
qcmd = QCMD(Q_XFS_GETQUOTA, h->qh_type);
|
||||||
|
if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir,
|
||||||
|
id, (void *)&xdqblk) < 0) {
|
||||||
|
- ;
|
||||||
|
+ /*
|
||||||
|
+ * ENOENT means the structure just does not exist - return all
|
||||||
|
+ * zeros. Otherwise return failure.
|
||||||
|
+ */
|
||||||
|
+ if (errno != ENOENT)
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xfs_kern2utildqblk(&dquot->dq_dqb, &xdqblk);
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
||||||
64
SOURCES/quota-4.10-quotaio_xfs-Fix-quota-tools-on-XFS.patch
Normal file
64
SOURCES/quota-4.10-quotaio_xfs-Fix-quota-tools-on-XFS.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From bd13b74e6d181638023d8a89316417643d9e7fd8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Kara <jack@suse.cz>
|
||||||
|
Date: Tue, 7 May 2024 14:21:45 +0200
|
||||||
|
Subject: [PATCH] quotaio_xfs: Fix quota-tools on XFS
|
||||||
|
|
||||||
|
Patches implementing tmpfs quota support, commit 00534e79856c ("Enable
|
||||||
|
support for tmpfs quotas") in particular, broke quota-tools on XFS
|
||||||
|
because quotactl(2) syscall got called with wrong arguments. Fix it.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||||
|
---
|
||||||
|
quotaio_xfs.c | 11 ++++-------
|
||||||
|
1 file changed, 4 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
||||||
|
index 040e7d8..c10534d 100644
|
||||||
|
--- a/quotaio_xfs.c
|
||||||
|
+++ b/quotaio_xfs.c
|
||||||
|
@@ -124,11 +124,9 @@ static inline int xfs_util2kerndqblk(struct xfs_kern_dqblk *k, struct util_dqblk
|
||||||
|
static int xfs_init_io(struct quota_handle *h)
|
||||||
|
{
|
||||||
|
struct xfs_mem_dqinfo info;
|
||||||
|
- int qcmd;
|
||||||
|
|
||||||
|
- qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
|
||||||
|
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
|
||||||
|
- if (quotactl_handle(qcmd, h, 0, (void *)&info) < 0)
|
||||||
|
+ if (quotactl_handle(Q_XFS_GETQSTAT, h, 0, (void *)&info) < 0)
|
||||||
|
return -1;
|
||||||
|
h->qh_info.dqi_bgrace = info.qs_btimelimit;
|
||||||
|
h->qh_info.dqi_igrace = info.qs_itimelimit;
|
||||||
|
@@ -142,7 +140,6 @@ static int xfs_init_io(struct quota_handle *h)
|
||||||
|
static int xfs_write_info(struct quota_handle *h)
|
||||||
|
{
|
||||||
|
struct xfs_kern_dqblk xdqblk;
|
||||||
|
- int qcmd;
|
||||||
|
|
||||||
|
if (!XFS_USRQUOTA(h) && !XFS_GRPQUOTA(h) && !XFS_PRJQUOTA(h))
|
||||||
|
return 0;
|
||||||
|
@@ -152,8 +149,7 @@ static int xfs_write_info(struct quota_handle *h)
|
||||||
|
xdqblk.d_btimer = h->qh_info.dqi_bgrace;
|
||||||
|
xdqblk.d_itimer = h->qh_info.dqi_igrace;
|
||||||
|
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
|
||||||
|
- qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
|
||||||
|
- if (quotactl_handle(qcmd, h, 0, (void *)&xdqblk) < 0)
|
||||||
|
+ if (quotactl_handle(Q_XFS_SETQLIM, h, 0, (void *)&xdqblk) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -180,8 +176,9 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
* ENOENT means the structure just does not exist - return all
|
||||||
|
* zeros. Otherwise return failure.
|
||||||
|
*/
|
||||||
|
- if (errno != ENOENT)
|
||||||
|
+ if (errno != ENOENT) {
|
||||||
|
return NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xfs_kern2utildqblk(&dquot->dq_dqb, &xdqblk);
|
||||||
|
--
|
||||||
|
2.45.2
|
||||||
|
|
||||||
30
SOURCES/quota-master-quotaio_xfs-Fix-memory-leak.patch
Normal file
30
SOURCES/quota-master-quotaio_xfs-Fix-memory-leak.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From c59b85805ee64c7ee2937b91533eb96f56d87738 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Reichl <preichl@redhat.com>
|
||||||
|
Date: Tue, 30 Jul 2024 00:18:13 +0200
|
||||||
|
Subject: [PATCH] quotaio_xfs: Fix memory leak
|
||||||
|
|
||||||
|
Error: RESOURCE_LEAK (CWE-772):
|
||||||
|
quota-4.09/quotaio_xfs.c:162:2: alloc_fn: Storage is returned from allocation function "get_empty_dquot".
|
||||||
|
quota-4.09/quotaio_xfs.c:162:2: var_assign: Assigning: "dquot" = storage returned from "get_empty_dquot()".
|
||||||
|
quota-4.09/quotaio_xfs.c:180:4: leaked_storage: Variable "dquot" going out of scope leaks the storage it points to.
|
||||||
|
|
||||||
|
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||||
|
---
|
||||||
|
quotaio_xfs.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
||||||
|
index 2df27b5..5446bc5 100644
|
||||||
|
--- a/quotaio_xfs.c
|
||||||
|
+++ b/quotaio_xfs.c
|
||||||
|
@@ -174,6 +174,7 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
|
||||||
|
* zeros. Otherwise return failure.
|
||||||
|
*/
|
||||||
|
if (errno != ENOENT) {
|
||||||
|
+ free(dquot);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.46.0
|
||||||
|
|
||||||
@ -6,7 +6,8 @@ After=syslog.target
|
|||||||
Type=forking
|
Type=forking
|
||||||
EnvironmentFile=-/etc/sysconfig/quota_nld
|
EnvironmentFile=-/etc/sysconfig/quota_nld
|
||||||
ExecStart=/usr/sbin/quota_nld $QUOTA_NLD_OPTS
|
ExecStart=/usr/sbin/quota_nld $QUOTA_NLD_OPTS
|
||||||
PIDFile=/var/run/quota_nld.pid
|
PIDFile=/run/quota_nld.pid
|
||||||
|
Group=tty
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
268
SPECS/quota.spec
268
SPECS/quota.spec
@ -1,35 +1,42 @@
|
|||||||
|
# Scan ext file systems directly to increase the performace of a quota
|
||||||
|
# initialization and check
|
||||||
|
%bcond_without quota_enables_extdirect
|
||||||
# Use netlink to monitor quota usage and warn interactive users
|
# Use netlink to monitor quota usage and warn interactive users
|
||||||
%bcond_without quota_enables_netlink
|
%bcond_without quota_enables_netlink
|
||||||
# Enable getting quotas over remotely
|
# Enable getting quotas remotely over network
|
||||||
%bcond_without quota_enables_rpc
|
%bcond_without quota_enables_rpc
|
||||||
# Allow setting quota remotely
|
# Allow setting quota remotely over network
|
||||||
%bcond_without quota_enables_rpcsetquota
|
%bcond_without quota_enables_rpcsetquota
|
||||||
# Disable TCP Wrappers guard in RPC quota daemon
|
# Disable TCP Wrappers guard in the RPC quota daemon
|
||||||
%bcond_with quota_enables_tcpwrappers
|
%bcond_with quota_enables_tcpwrappers
|
||||||
|
|
||||||
Name: quota
|
Name: quota
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 4.04
|
Version: 4.09
|
||||||
Release: 14%{?dist}
|
Release: 4%{?dist}
|
||||||
Summary: System administration tools for monitoring users' disk usage
|
Summary: System administration tools for monitoring users' disk usage
|
||||||
# quota_nld.c, quotaio_xfs.h: GPLv2
|
# quota_nld.c, quotaio_xfs.h: GPLv2
|
||||||
# bylabel.c copied from util-linux: GPLv2+
|
# bylabel.c copied from util-linux: GPLv2+
|
||||||
# doc/quotas.ms, quotaops.c, quot.c, quotaon.c, edquota.c, quot.h, quota.c,
|
# COPYING: GPLv2 text and a license declaration
|
||||||
# quotaio_v1.c: BSD
|
## Only in quota-rpc binary package
|
||||||
# COPYING: GPLv2 text and license declaration
|
# rquota_server.c: GPLv2+
|
||||||
## Only in quota-rpc and quota-nls binary package
|
## Only in quota-rpc and quota-nls binary packages
|
||||||
|
# rquota_svc.c: GPLv2+
|
||||||
# svc_socket.c copied from glibc: LGPLv2+
|
# svc_socket.c copied from glibc: LGPLv2+
|
||||||
## Only in quota-nls binary package
|
## Only in quota-nls binary package
|
||||||
# po/cs.po: GPLv2+
|
# po/cs.po: GPLv2+
|
||||||
## Not involved in the binary package
|
## Only in quota-warnquota binary package
|
||||||
|
# warnquota.c: GPLv2+
|
||||||
|
## Not involved in any binary package
|
||||||
# aclocal.m4: FSFULLR and (GPLv2+ with exception)
|
# aclocal.m4: FSFULLR and (GPLv2+ with exception)
|
||||||
# ar-lib: GPLv2 with exception
|
# ar-lib: GPLv2 with exception
|
||||||
# depcomp: GPLv2+ with exception
|
# depcomp: GPLv2+ with exception
|
||||||
|
# compile: GPLv2+ with exception
|
||||||
# config.guess: GPLv3+ with exception
|
# config.guess: GPLv3+ with exception
|
||||||
# config.rpath: GPLv2+ with exception
|
# config.rpath: GPLv2+ with exception
|
||||||
# config.sub: GPLv3+ with exception
|
# config.sub: GPLv3+ with exception
|
||||||
# configure: FSFUL
|
# configure: FSFUL
|
||||||
# install-sh: MIT
|
# install-sh: MIT and Public Domain
|
||||||
# m4/gettext.m4: GPL with exception
|
# m4/gettext.m4: GPL with exception
|
||||||
# m4/iconv.m4: GPL with exception
|
# m4/iconv.m4: GPL with exception
|
||||||
# m4/lib-ld.m4: GPL with exception
|
# m4/lib-ld.m4: GPL with exception
|
||||||
@ -41,67 +48,24 @@ Summary: System administration tools for monitoring users' disk usage
|
|||||||
# Makefile.in: FSFULLR
|
# Makefile.in: FSFULLR
|
||||||
# missing: GPLv2+ with exception
|
# missing: GPLv2+ with exception
|
||||||
# mkinstalldirs: Public Domain
|
# mkinstalldirs: Public Domain
|
||||||
License: BSD and GPLv2 and GPLv2+
|
License: GPLv2 and GPLv2+
|
||||||
URL: http://sourceforge.net/projects/linuxquota/
|
URL: http://sourceforge.net/projects/linuxquota/
|
||||||
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
|
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
|
||||||
Source1: quota_nld.service
|
Source1: quota_nld.service
|
||||||
Source2: quota_nld.sysconfig
|
Source2: quota_nld.sysconfig
|
||||||
Source3: rpc-rquotad.service
|
Source3: rpc-rquotad.service
|
||||||
Source4: rpc-rquotad.sysconfig
|
Source4: rpc-rquotad.sysconfig
|
||||||
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa)
|
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa), bug #680919
|
||||||
Patch0: quota-4.04-warnquota-configuration-tunes.patch
|
Patch0: quota-4.06-warnquota-configuration-tunes.patch
|
||||||
Patch1: quota-4.03-Validate-upper-bound-of-RPC-port.patch
|
# Fix parsing a TCP port number
|
||||||
# Install rquotad(3) only if RPC is enabled,
|
Patch1: quota-4.03-Validate-upper-bound-of-RPC-port.patch
|
||||||
# <https://sourceforge.net/p/linuxquota/patches/45/>, in upstream after 4.04
|
Patch2: quota-4.10-Rename-searched_dir-sd_dir-to-sd_isdir.patch
|
||||||
Patch2: quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch
|
Patch3: quota-4.10-Add-quotactl_fd-support.patch
|
||||||
# Pass TIRPC header files location to all RPC compilation units,
|
Patch4: quota-4.10-Enable-support-for-tmpfs-quotas.patch
|
||||||
# <https://sourceforge.net/p/linuxquota/patches/46/>, in upstream after 4.04
|
Patch5: quota-4.10-quotaio_xfs-Fix-error-handling-in-xfs_read_dquot.patch
|
||||||
Patch3: quota-4.04-Add-TIRPC_CFLAGS-globally-to-CFLAGS-for-RPC-support-.patch
|
Patch6: quota-4.10-quotaio_xfs-Fix-quota-tools-on-XFS.patch
|
||||||
# Do not iterate over negative UIDs in repquota,
|
Patch7: quota-master-quotaio_xfs-Fix-memory-leak.patch
|
||||||
# <https://sourceforge.net/p/linuxquota/patches/47/>, in upstream after 4.04
|
|
||||||
Patch4: quota-4.04-repquota-Fix-output-when-user-2-exists.patch
|
|
||||||
# Fix snprintf overflows in warnquota,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/patches/48/>, in upstream after 4.04
|
|
||||||
Patch5: quota-4.04-warnquota-Check-snprintf-for-overflows.patch
|
|
||||||
# Fix user name search in utmp log,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/patches/48/>, in upstream after 4.04
|
|
||||||
Patch6: quota-4.04-warnquota-Fix-comparing-user-name-to-non-null-termin.patch
|
|
||||||
# Avoid questions in quotacheck non-interactive mode, in upstream after 4.04
|
|
||||||
Patch7: quota-4.04-quotacheck-Avoid-question-in-non-interactive-mode.patch
|
|
||||||
# Report an error when quotacheck fails to cache quota files,
|
|
||||||
# in upstream after 4.04
|
|
||||||
Patch8: quota-4.04-quotacheck-Report-error-when-caching-of-quota-file-f.patch
|
|
||||||
# Report an error if quota file magic is invalid, in upstream after 4.04
|
|
||||||
Patch9: quota-4.04-quotacheck-Fail-check-if-quota-file-magic-is-invalid.patch
|
|
||||||
# Fix busy loop in rpc.rquotad, bug #1575956,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/feature-requests/16/>
|
|
||||||
Patch10: quota-4.04-Listen-on-a-TCP-socket.patch
|
|
||||||
# Fix current block usage limit in RPC client, in upstream after 4.04,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/bugs/127/>
|
|
||||||
Patch11: quota-4.04-rpc-Fix-wrong-limit-for-space-usage.patch
|
|
||||||
# Distinguish between none quota limits and no allocated resources in quota(1)
|
|
||||||
# tool output, proposed to upstream,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/bugs/128/>
|
|
||||||
Patch12: quota-4.04-quota-1-Distinguish-between-none-quota-limits-and-no.patch
|
|
||||||
# Fix a descriptor leak, bug #1602674, proposed to upstream,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/bugs/129/>
|
|
||||||
Patch13: quota-4.04-convertquota-Fix-a-file-descriptor-leak-in-convert_e.patch
|
|
||||||
# Fix a descriptor leak, bug #1602674, proposed to upstream,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/bugs/129/>
|
|
||||||
Patch14: quota-4.04-quotackeck-Fix-a-directory-descriptor-leak-in-scan_d.patch
|
|
||||||
# Fix a descriptor leak, bug #1602674, proposed to upstream,
|
|
||||||
# <https://sourceforge.net/p/linuxquota/bugs/129/>
|
|
||||||
Patch15: quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch
|
|
||||||
# Pass quota type for Q_XFS_GETQSTAT, bug #1898549, in upstream after 4.05
|
|
||||||
Patch16: quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch
|
|
||||||
# 1/2 Support setting individual grace times for XFS, bug #1898549,
|
|
||||||
# in upstream after 4.05
|
|
||||||
Patch17: quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch
|
|
||||||
# 2/2 Support setting individual grace times for XFS, bug #1898549,
|
|
||||||
# in upstream after 4.05
|
|
||||||
Patch18: quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch
|
|
||||||
# Add support for HPE XFS, bug #1945408, in upstream 4.05
|
|
||||||
Patch19: quota-4.04-Aadd-HPE-XFS-support.patch
|
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: bash
|
BuildRequires: bash
|
||||||
@ -111,15 +75,20 @@ BuildRequires: gcc
|
|||||||
BuildRequires: gettext-devel
|
BuildRequires: gettext-devel
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
BuildRequires: openldap-devel
|
BuildRequires: openldap-devel
|
||||||
|
%if %{with quota_enables_extdirect}
|
||||||
|
BuildRequires: pkgconfig(com_err)
|
||||||
|
BuildRequires: pkgconfig(ext2fs)
|
||||||
|
%endif
|
||||||
%if %{with quota_enables_netlink}
|
%if %{with quota_enables_netlink}
|
||||||
BuildRequires: pkgconfig(dbus-1)
|
BuildRequires: pkgconfig(dbus-1)
|
||||||
BuildRequires: pkgconfig(libnl-3.0) >= 3.1
|
BuildRequires: pkgconfig(libnl-3.0) >= 3.1
|
||||||
BuildRequires: pkgconfig(libnl-genl-3.0)
|
BuildRequires: pkgconfig(libnl-genl-3.0)
|
||||||
|
BuildRequires: systemd-rpm-macros
|
||||||
%endif
|
%endif
|
||||||
%if %{with quota_enables_rpc}
|
%if %{with quota_enables_rpc}
|
||||||
BuildRequires: rpcgen
|
BuildRequires: rpcgen
|
||||||
BuildRequires: pkgconfig(libtirpc)
|
BuildRequires: pkgconfig(libtirpc)
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd-rpm-macros
|
||||||
%if %{with quota_enables_tcpwrappers}
|
%if %{with quota_enables_tcpwrappers}
|
||||||
BuildRequires: tcp_wrappers-devel
|
BuildRequires: tcp_wrappers-devel
|
||||||
%endif
|
%endif
|
||||||
@ -135,10 +104,10 @@ and limiting user and or group disk usage per file system.
|
|||||||
%if %{with quota_enables_netlink}
|
%if %{with quota_enables_netlink}
|
||||||
%package nld
|
%package nld
|
||||||
Summary: quota_nld daemon
|
Summary: quota_nld daemon
|
||||||
|
License: GPLv2 and GPLv2+
|
||||||
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
||||||
Requires(post): systemd
|
# For %%{_unitdir} directory
|
||||||
Requires(preun): systemd
|
Requires: systemd
|
||||||
Requires(postun): systemd
|
|
||||||
|
|
||||||
%description nld
|
%description nld
|
||||||
Daemon that listens on netlink socket and processes received quota warnings.
|
Daemon that listens on netlink socket and processes received quota warnings.
|
||||||
@ -152,15 +121,14 @@ a dialog) and writing them to the terminal user has last accessed.
|
|||||||
%if %{with quota_enables_rpc}
|
%if %{with quota_enables_rpc}
|
||||||
%package rpc
|
%package rpc
|
||||||
Summary: RPC quota daemon
|
Summary: RPC quota daemon
|
||||||
License: BSD and LGPLv2+ and GPLv2 and GPLv2+
|
License: LGPLv2+ and GPLv2 and GPLv2+
|
||||||
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
||||||
Requires: rpcbind
|
Requires: rpcbind
|
||||||
|
# For %%{_unitdir} directory
|
||||||
|
Requires: systemd
|
||||||
%if %{with quota_enables_tcpwrappers}
|
%if %{with quota_enables_tcpwrappers}
|
||||||
Requires: tcp_wrappers
|
Requires: tcp_wrappers
|
||||||
%endif
|
%endif
|
||||||
Requires(post): systemd
|
|
||||||
Requires(preun): systemd
|
|
||||||
Requires(postun): systemd
|
|
||||||
Conflicts: quota < 1:4.02-3
|
Conflicts: quota < 1:4.02-3
|
||||||
|
|
||||||
%description rpc
|
%description rpc
|
||||||
@ -172,6 +140,7 @@ NFS client.
|
|||||||
|
|
||||||
%package warnquota
|
%package warnquota
|
||||||
Summary: Send e-mail to users over quota
|
Summary: Send e-mail to users over quota
|
||||||
|
License: GPLv2 and GPLv2+
|
||||||
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
||||||
|
|
||||||
%description warnquota
|
%description warnquota
|
||||||
@ -182,7 +151,7 @@ via cron(8).
|
|||||||
|
|
||||||
%package nls
|
%package nls
|
||||||
Summary: Gettext catalogs for disk quota tools
|
Summary: Gettext catalogs for disk quota tools
|
||||||
License: BSD and LGPLv2+ and GPLv2 and GPLv2+
|
License: LGPLv2+ and GPLv2 and GPLv2+
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description nls
|
%description nls
|
||||||
@ -225,18 +194,6 @@ Linux/UNIX environment.
|
|||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
%patch6 -p1
|
%patch6 -p1
|
||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
%patch8 -p1
|
|
||||||
%patch9 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
|
||||||
%patch12 -p1
|
|
||||||
%patch13 -p1
|
|
||||||
%patch14 -p1
|
|
||||||
%patch15 -p1
|
|
||||||
%patch16 -p1
|
|
||||||
%patch17 -p1
|
|
||||||
%patch18 -p1
|
|
||||||
%patch19 -p1
|
|
||||||
# Regenerate build scripts
|
# Regenerate build scripts
|
||||||
autoreconf -f -i
|
autoreconf -f -i
|
||||||
|
|
||||||
@ -244,7 +201,11 @@ autoreconf -f -i
|
|||||||
%global _hardened_build 1
|
%global _hardened_build 1
|
||||||
%configure \
|
%configure \
|
||||||
--enable-bsd-behaviour \
|
--enable-bsd-behaviour \
|
||||||
|
%if %{with quota_enables_extdirect}
|
||||||
--enable-ext2direct=yes \
|
--enable-ext2direct=yes \
|
||||||
|
%else
|
||||||
|
--enable-ext2direct=no \
|
||||||
|
%endif
|
||||||
--enable-ldapmail=yes \
|
--enable-ldapmail=yes \
|
||||||
%if %{with quota_enables_tcpwrappers}
|
%if %{with quota_enables_tcpwrappers}
|
||||||
--enable-libwrap=yes \
|
--enable-libwrap=yes \
|
||||||
@ -257,6 +218,7 @@ autoreconf -f -i
|
|||||||
--disable-netlink \
|
--disable-netlink \
|
||||||
%endif
|
%endif
|
||||||
--enable-nls \
|
--enable-nls \
|
||||||
|
--with-pid-dir=/run \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
%if %{with quota_enables_rpc}
|
%if %{with quota_enables_rpc}
|
||||||
--enable-rpc=yes \
|
--enable-rpc=yes \
|
||||||
@ -270,11 +232,11 @@ autoreconf -f -i
|
|||||||
%endif
|
%endif
|
||||||
--disable-silent-rules \
|
--disable-silent-rules \
|
||||||
--disable-xfs-roothack
|
--disable-xfs-roothack
|
||||||
make
|
%{make_build}
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make install DESTDIR=%{buildroot}
|
%{make_install}
|
||||||
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
|
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
|
||||||
|
|
||||||
%if %{with quota_enables_netlink}
|
%if %{with quota_enables_netlink}
|
||||||
@ -381,20 +343,118 @@ make check
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Apr 28 2021 Petr Pisar <ppisar@redhat.com> - 1:4.04-14
|
* Thu Sep 12 2024 Pavel Reichl <preichl@redhat.com> - 1:4.09-4
|
||||||
- Rebuild with binutils > 2.30-99 (bug #1954446)
|
- Fix patch application
|
||||||
|
- Related: RHEL-50914
|
||||||
|
|
||||||
* Tue Apr 06 2021 Petr Pisar <ppisar@redhat.com> - 1:4.04-13
|
* Thu Sep 12 2024 Pavel Reichl <preichl@redhat.com> - 1:4.09-3
|
||||||
- Add support for HPE XFS (bug #1945408)
|
- Fix memory leak
|
||||||
|
- Related: RHEL-50914
|
||||||
|
|
||||||
* Wed Nov 18 2020 Petr Pisar <ppisar@redhat.com> - 1:4.04-12
|
* Fri Jul 26 2024 Pavel Reichl <preichl@redhat.com> - 1:4.09-2
|
||||||
- Support setting individual grace times for XFS (bug #1898549)
|
- Fix regression
|
||||||
|
- Related: RHEL-50644
|
||||||
|
|
||||||
* Wed Sep 02 2020 Petr Pisar <ppisar@redhat.com> - 1:4.04-11
|
* Mon Jun 10 2024 Pavel Reichl <preichl@redhat.com> - 1:4.09-1
|
||||||
- Require libtirpc-devel by quota-devel because of rpc/rpc.h (bug #1868671)
|
- Update to new upstream version
|
||||||
|
- Add tmpfs quota support
|
||||||
|
- Remove rhel-only patches that were merged upstream
|
||||||
|
|
||||||
|
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1:4.06-6
|
||||||
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
|
Related: rhbz#1991688
|
||||||
|
|
||||||
|
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:4.06-5
|
||||||
|
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||||
|
|
||||||
|
* Wed Mar 17 2021 Petr Pisar <ppisar@redhat.com> - 1:4.06-4
|
||||||
|
- Fix sa_mask initialization when registering PID file removal
|
||||||
|
(upstream bug #141)
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.06-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Dec 14 2020 Petr Pisar <ppisar@redhat.com> - 1:4.06-2
|
||||||
|
- Remove a dead code from process_file() (upstream bug #54)
|
||||||
|
- Fix a compilation warning in quotaops.c
|
||||||
|
- Warn when kernel XFS large time stamp does fit into (32-bit) user-space
|
||||||
|
time_t
|
||||||
|
- Do not use a pointless compiler-internal __P() macro
|
||||||
|
|
||||||
|
* Tue Nov 10 2020 Petr Pisar <ppisar@redhat.com> - 1:4.06-1
|
||||||
|
- 4.06 bump
|
||||||
|
|
||||||
|
* Fri Nov 06 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-17
|
||||||
|
- Support grace period expirations past 2038 year for XFS
|
||||||
|
- Add a synopsis for a project quota option in the quota tool
|
||||||
|
- Add a --filesystem option to the quota tool
|
||||||
|
- Complain that ext4 external quota files are deprecated
|
||||||
|
|
||||||
|
* Wed Sep 02 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-16
|
||||||
|
- Require libtirpc-devel by quota-devel because of rpc/rpc.h
|
||||||
|
|
||||||
|
* Mon Aug 24 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-15
|
||||||
|
- Fix setting individual limits for XFS
|
||||||
|
- Modernize systemd unit packaging
|
||||||
|
|
||||||
|
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.05-14
|
||||||
|
- Second attempt - Rebuilt for
|
||||||
|
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.05-13
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon May 18 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-12
|
||||||
|
- Set kernel option when setting XFS grace times
|
||||||
|
|
||||||
|
* Mon May 11 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-11
|
||||||
|
- Pass quota type for Q_XFS_GETQSTAT
|
||||||
|
|
||||||
|
* Thu Mar 26 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-10
|
||||||
|
- Use an upstream's patch for ignoring disabled quotas (bug #1805110)
|
||||||
|
|
||||||
|
* Fri Feb 21 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-9
|
||||||
|
- Fix ignoring disabled quotas (bug #1805110)
|
||||||
|
|
||||||
|
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.05-8
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Nov 06 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-7
|
||||||
|
- Remove a patch for freeing a parsed configuration in warnquota
|
||||||
|
|
||||||
|
* Tue Nov 05 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-6
|
||||||
|
- Optimize out useless checking of file systems with hidden quota files
|
||||||
|
- Fix warnquota --help output
|
||||||
|
- Fix checking for the LDAP failures in the warnquota tool
|
||||||
|
- Report detailed LDAP failures
|
||||||
|
- Document CC_TO in warquota.conf is looked up with LDAP
|
||||||
|
- Initialize all members of a configparams structure in warnquota
|
||||||
|
- Free parsed configuration in warnquota
|
||||||
|
|
||||||
|
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.05-5
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu May 30 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-4
|
||||||
|
- Move quota_nld.pid file to /run (upstream patch #49)
|
||||||
|
|
||||||
|
* Wed May 29 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-3
|
||||||
|
- Run quota_nld service as tty group
|
||||||
|
|
||||||
|
* Mon May 27 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-2
|
||||||
|
- Report an error if an RPC fails on an explicitly requested file system
|
||||||
|
(upstream bug #134)
|
||||||
|
- Fix Free Software Foundation's postal address (upstream bug #133)
|
||||||
|
|
||||||
|
* Tue Apr 02 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-1
|
||||||
|
- 4.05 bump
|
||||||
|
- License changed (only edquota tool contains a BSD code now)
|
||||||
|
- quot tool was removed
|
||||||
|
|
||||||
|
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.04-11
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
* Thu Aug 23 2018 Petr Pisar <ppisar@redhat.com> - 1:4.04-10
|
* Thu Aug 23 2018 Petr Pisar <ppisar@redhat.com> - 1:4.04-10
|
||||||
- Fix file descriptor leaks in error code paths (bug #1602674)
|
- Fix file descriptor leaks in error code paths
|
||||||
|
|
||||||
* Tue Jul 24 2018 Petr Pisar <ppisar@redhat.com> - 1:4.04-9
|
* Tue Jul 24 2018 Petr Pisar <ppisar@redhat.com> - 1:4.04-9
|
||||||
- Distinguish between none quota limits and no allocated resources in quota(1)
|
- Distinguish between none quota limits and no allocated resources in quota(1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user