|
|
5eda098 |
From a4b0af23e1e3761825e9d4ac075e3fcae8ab91cb Mon Sep 17 00:00:00 2001
|
|
|
5eda098 |
From: Jan Kara <jack@suse.cz>
|
|
|
5eda098 |
Date: Fri, 24 May 2019 12:03:27 +0200
|
|
|
5eda098 |
Subject: [PATCH 1/4] Make messages about failures for NFS consistent with
|
|
|
5eda098 |
local filesystems
|
|
|
5eda098 |
MIME-Version: 1.0
|
|
|
5eda098 |
Content-Type: text/plain; charset=UTF-8
|
|
|
5eda098 |
Content-Transfer-Encoding: 8bit
|
|
|
5eda098 |
|
|
|
5eda098 |
Currently, some types for failures when fetching quota information for
|
|
|
5eda098 |
NFS filesystem were silent (e.g. when rpc.rquotad was not running) while
|
|
|
5eda098 |
others were reporting error message (e.g. when rpc connection failed).
|
|
|
5eda098 |
There's no big difference in these for the user / administrator and also
|
|
|
5eda098 |
is inconsistent with how we deal with local filesystems - there we
|
|
|
5eda098 |
report error if the filesystem was explicitely specified on command line
|
|
|
5eda098 |
and silently ignore it for "scan all" operations.
|
|
|
5eda098 |
|
|
|
5eda098 |
So change error reporting for NFS to report errors about quota not being
|
|
|
5eda098 |
supported if and only if filesystem was explicitely specified on command
|
|
|
5eda098 |
line.
|
|
|
5eda098 |
|
|
|
5eda098 |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
5eda098 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
5eda098 |
---
|
|
|
5eda098 |
edquota.c | 4 ++--
|
|
|
5eda098 |
quota.c | 2 +-
|
|
|
5eda098 |
quotaops.c | 2 +-
|
|
|
5eda098 |
setquota.c | 6 +++---
|
|
|
5eda098 |
4 files changed, 7 insertions(+), 7 deletions(-)
|
|
|
5eda098 |
|
|
|
5eda098 |
diff --git a/edquota.c b/edquota.c
|
|
|
5eda098 |
index 912f833..a77106c 100644
|
|
|
5eda098 |
--- a/edquota.c
|
|
|
5eda098 |
+++ b/edquota.c
|
|
|
5eda098 |
@@ -176,7 +176,7 @@ static void copy_prototype(int argc, char **argv, struct quota_handle **handles)
|
|
|
5eda098 |
protoprivs = getprivs(protoid, handles, 0);
|
|
|
5eda098 |
while (argc-- > 0) {
|
|
|
5eda098 |
id = name2id(*argv, quotatype, !!(flags & FL_NUMNAMES), NULL);
|
|
|
5eda098 |
- curprivs = getprivs(id, handles, 0);
|
|
|
5eda098 |
+ curprivs = getprivs(id, handles, !dirname);
|
|
|
5eda098 |
if (!curprivs)
|
|
|
5eda098 |
die(1, _("Cannot get quota information for user %s\n"), *argv);
|
|
|
5eda098 |
argv++;
|
|
|
5eda098 |
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
|
|
|
5eda098 |
else {
|
|
|
5eda098 |
for (; argc > 0; argc--, argv++) {
|
|
|
5eda098 |
id = name2id(*argv, quotatype, !!(flags & FL_NUMNAMES), NULL);
|
|
|
5eda098 |
- curprivs = getprivs(id, handles, 0);
|
|
|
5eda098 |
+ curprivs = getprivs(id, handles, !dirname);
|
|
|
5eda098 |
if (!curprivs)
|
|
|
5eda098 |
die(1, _("Cannot get quota information for user %s.\n"), *argv);
|
|
|
5eda098 |
if (flags & FL_EDIT_TIMES) {
|
|
|
5eda098 |
diff --git a/quota.c b/quota.c
|
|
|
5eda098 |
index 8235013..be494e3 100644
|
|
|
5eda098 |
--- a/quota.c
|
|
|
5eda098 |
+++ b/quota.c
|
|
|
5eda098 |
@@ -168,7 +168,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
|
5eda098 |
((flags & FL_NOAUTOFS) ? MS_NO_AUTOFS : 0)
|
|
|
5eda098 |
| ((flags & FL_LOCALONLY) ? MS_LOCALONLY : 0)
|
|
|
5eda098 |
| ((flags & FL_NFSALL) ? MS_NFS_ALL : 0));
|
|
|
5eda098 |
- qlist = getprivs(id, handles, !!(flags & FL_QUIETREFUSE));
|
|
|
5eda098 |
+ qlist = getprivs(id, handles, !mntcnt || (flags & FL_QUIETREFUSE));
|
|
|
5eda098 |
if (!qlist) {
|
|
|
5eda098 |
over = 1;
|
|
|
5eda098 |
goto out_handles;
|
|
|
5eda098 |
diff --git a/quotaops.c b/quotaops.c
|
|
|
5eda098 |
index 976e6b3..ad29fd9 100644
|
|
|
5eda098 |
--- a/quotaops.c
|
|
|
5eda098 |
+++ b/quotaops.c
|
|
|
5eda098 |
@@ -125,7 +125,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
|
|
|
5eda098 |
|
|
|
5eda098 |
if (!(q = handles[i]->qh_ops->read_dquot(handles[i], id))) {
|
|
|
5eda098 |
/* If rpc.rquotad is not running filesystem might be just without quotas... */
|
|
|
5eda098 |
- if (errno != ENOENT && (errno != ECONNREFUSED || !quiet)) {
|
|
|
5eda098 |
+ if (!quiet || (errno != ENOENT && errno != ECONNREFUSED)) {
|
|
|
5eda098 |
int olderrno = errno;
|
|
|
5eda098 |
|
|
|
5eda098 |
id2name(id, handles[i]->qh_type, name);
|
|
|
5eda098 |
diff --git a/setquota.c b/setquota.c
|
|
|
5eda098 |
index bfd6682..08fdbfc 100644
|
|
|
5eda098 |
--- a/setquota.c
|
|
|
5eda098 |
+++ b/setquota.c
|
|
|
5eda098 |
@@ -314,7 +314,7 @@ static int setlimits(struct quota_handle **handles)
|
|
|
5eda098 |
struct dquot *q, *protoq, *protoprivs = NULL, *curprivs;
|
|
|
5eda098 |
int ret = 0;
|
|
|
5eda098 |
|
|
|
5eda098 |
- curprivs = getprivs(id, handles, 0);
|
|
|
5eda098 |
+ curprivs = getprivs(id, handles, !!(flags & FL_ALL));
|
|
|
5eda098 |
if (flags & FL_PROTO) {
|
|
|
5eda098 |
protoprivs = getprivs(protoid, handles, 0);
|
|
|
5eda098 |
for (q = curprivs, protoq = protoprivs; q && protoq; q = q->dq_next, protoq = protoq->dq_next) {
|
|
|
5eda098 |
@@ -435,7 +435,7 @@ static int batch_setlimits(struct quota_handle **handles)
|
|
|
5eda098 |
int ret = 0;
|
|
|
5eda098 |
|
|
|
5eda098 |
while (!read_entry(&id, &isoftlimit, &ihardlimit, &bsoftlimit, &bhardlimit)) {
|
|
|
5eda098 |
- curprivs = getprivs(id, handles, 0);
|
|
|
5eda098 |
+ curprivs = getprivs(id, handles, !!(flags & FL_ALL));
|
|
|
5eda098 |
for (q = curprivs; q; q = q->dq_next) {
|
|
|
5eda098 |
q->dq_dqb.dqb_bsoftlimit = bsoftlimit;
|
|
|
5eda098 |
q->dq_dqb.dqb_bhardlimit = bhardlimit;
|
|
|
5eda098 |
@@ -474,7 +474,7 @@ static int setindivgraces(struct quota_handle **handles)
|
|
|
5eda098 |
int ret = 0;
|
|
|
5eda098 |
struct dquot *q, *curprivs;
|
|
|
5eda098 |
|
|
|
5eda098 |
- curprivs = getprivs(id, handles, 0);
|
|
|
5eda098 |
+ curprivs = getprivs(id, handles, !!(flags & FL_ALL));
|
|
|
5eda098 |
for (q = curprivs; q; q = q->dq_next) {
|
|
|
5eda098 |
if (q->dq_dqb.dqb_bsoftlimit && toqb(q->dq_dqb.dqb_curspace) > q->dq_dqb.dqb_bsoftlimit)
|
|
|
5eda098 |
q->dq_dqb.dqb_btime = toset.dqb_btime;
|
|
|
5eda098 |
--
|
|
|
5eda098 |
2.20.1
|
|
|
5eda098 |
|