import quota-4.04-14.el8

c8 imports/c8/quota-4.04-14.el8
CentOS Sources 3 years ago committed by MSVSphere Packaging Team
commit 2a238df5dc

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/quota-4.04.tar.gz

@ -0,0 +1 @@
38e6cc7538d504891a8454bbdabef058bd1adc11 SOURCES/quota-4.04.tar.gz

@ -0,0 +1,29 @@
From c9a2a6fea0668579f5fb8d77cb219f51d104581f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 6 Jan 2016 17:58:22 +0100
Subject: [PATCH] Validate upper bound of RPC port
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
rquota_svc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rquota_svc.c b/rquota_svc.c
index 338b70f..93472e0 100644
--- a/rquota_svc.c
+++ b/rquota_svc.c
@@ -142,7 +142,7 @@ static void parse_options(int argc, char **argv)
break;
case 'p':
port = strtol(optarg, &endptr, 0);
- if (*endptr || port <= 0) {
+ if (*endptr || port <= 0 || port > 0xffff) {
errstr(_("Illegal port number: %s\n"), optarg);
show_help();
exit(1);
--
2.5.0

@ -0,0 +1,180 @@
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

@ -0,0 +1,43 @@
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

@ -0,0 +1,44 @@
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

@ -0,0 +1,77 @@
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

@ -0,0 +1,29 @@
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

@ -0,0 +1,72 @@
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

@ -0,0 +1,36 @@
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

@ -0,0 +1,35 @@
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

@ -0,0 +1,88 @@
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

@ -0,0 +1,28 @@
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

@ -0,0 +1,59 @@
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

@ -0,0 +1,35 @@
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

@ -0,0 +1,76 @@
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

@ -0,0 +1,74 @@
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

@ -0,0 +1,76 @@
From 67a0dbf6434552e720b0d311597553b3a76f779e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Aug 2011 13:45:15 +0200
Subject: [PATCH] warnquota configuration tunes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
accepted by upstream (we had root@... addresses and more enterprise
wordings usually there).
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 2 +-
warnquota.conf | 17 ++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 0d911e4..2c8e084 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -837,7 +837,7 @@ cc_parse_err:
}
#ifdef USE_LDAP_MAIL_LOOKUP
else if (!strcmp(var, "LDAP_MAIL")) {
- if(strcasecmp(value, "true") == 0)
+ if(strncasecmp(value, "true", 4) == 0)
config->use_ldap_mail = 1;
else
config->use_ldap_mail = 0;
diff --git a/warnquota.conf b/warnquota.conf
index b06f81f..7e00947 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -4,17 +4,16 @@
# and even blank lines
# values can be quoted:
-#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
-MAIL_CMD = "/bin/echo"
-FROM = "bas@example.com"
+MAIL_CMD = "/usr/sbin/sendmail -t"
+FROM = "root@example.com"
# but they don't have to be:
-SUBJECT = Hey, user, clean up your account!
-CC_TO = "sysadm@example.com"
+SUBJECT = NOTE: You are exceeding your allocated disk space limits
+CC_TO = "root@example.com"
# 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,
# 12 hours, 5 days)
# CC_BEFORE = 2 days
-SUPPORT = "support@example.com"
+SUPPORT = "root@example.com"
PHONE = "(123) 456-1111 or (222) 333-4444"
# Text in the beginning of the mail (if not specified, default text is used)
# This way text can be split to more lines
@@ -22,11 +21,11 @@ PHONE = "(123) 456-1111 or (222) 333-4444"
# The expressions %i, %h, %d, and %% are substituted for user/group name,
# host name, domain name, and '%' respectively. For backward compatibility
# %s behaves as %i but is deprecated.
-MESSAGE = Hello user %i, I've noticed you use too much space\
- on my disk in %h.%d.|Delete your files on the following filesystems:|
+MESSAGE = Your disk usage has exceeded the agreed limits\
+ on this server|Please delete any unnecessary files on following filesystems:|
# Text in the end of the mail (if not specified, default text using SUPPORT and PHONE
# is created)
-SIGNATURE = See you!| Your admin of %h|
+SIGNATURE = root@example.com
# Following text is used for mails about group exceeding quotas
GROUP_MESSAGE = Hello,|\
your group %i is using too much disk space at %h.|\
--
2.13.5

@ -0,0 +1,28 @@
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

@ -0,0 +1,42 @@
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

@ -0,0 +1,39 @@
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

@ -0,0 +1,56 @@
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

@ -0,0 +1,12 @@
[Unit]
Description=Disk quota netlink message daemon
After=syslog.target
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/quota_nld
ExecStart=/usr/sbin/quota_nld $QUOTA_NLD_OPTS
PIDFile=/var/run/quota_nld.pid
[Install]
WantedBy=multi-user.target

@ -0,0 +1,5 @@
# Arguments to pass to quota_nld daemon.
# -b, --print-below Inform about falling usage bellow limits too
# -C, --no-console Do not print messages on last user's terminal
# -D, --no-dbus Do not forward messages to D-Bus
QUOTA_NLD_OPTS=""

@ -0,0 +1,15 @@
[Unit]
Description=Remote quota server
Documentation=man:rpc.rquotad(8)
Requires=rpcbind.service
PartOf=rpcbind.service
After=rpcbind.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/rpc-rquotad
ExecStart=/usr/sbin/rpc.rquotad $RPCRQUOTADOPTS
[Install]
WantedBy=multi-user.target
WantedBy=nfs-server.service

@ -0,0 +1,8 @@
# Optionas to pass to rpc.rquotad daemon. See rpc.rquotad(8) manual page for
# more details.
# -I, --autofs Ignore autofs mount points
# -p port, --port port Listen on alternative port
# -s, --no-setquota Don't allow setting quotas with RPC (default)
# -S, --setquota Allow setting quotas with RPC
# -x path, --xtab path Use alternative NFSD export table
RPCRQUOTADOPTS=""

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save