diff options
author | Jan Kara <jack@suse.cz> | 2019-05-24 12:21:46 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-05-24 12:21:46 +0200 |
commit | e6decbfe6c44935584954ab01c8be2f5d02acf1b (patch) | |
tree | efdd306d9a58f3031b1b141d17b6e47169545356 | |
parent | a4b0af23e1e3761825e9d4ac075e3fcae8ab91cb (diff) | |
download | linuxquota-e6decbfe6c44935584954ab01c8be2f5d02acf1b.tar.gz |
quotaops: Do not return partial list from getprivs()
When we failed to get some dquots from NFS server, we just reported
error, didn't include the dquot in the list built in getprivs() but
otherwise continued operation. Fail getprivs() in case of error instead
so that the failure propagates properly to the caller.
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | quotaops.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -61,7 +61,7 @@ void update_grace_times(struct dquot *q) /* * Collect the requested quota information. */ -struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet) +struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquota) { struct dquot *q, *qtail = NULL, *qhead = NULL; int i; @@ -124,15 +124,18 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet) #endif if (!(q = handles[i]->qh_ops->read_dquot(handles[i], id))) { + int olderrno = errno; + /* If rpc.rquotad is not running filesystem might be just without quotas... */ - if (!quiet || (errno != ENOENT && errno != ECONNREFUSED)) { - int olderrno = errno; + if (ignore_noquota && + (errno == ENOENT || errno == ECONNREFUSED)) + continue; - id2name(id, handles[i]->qh_type, name); - errstr(_("error while getting quota from %s for %s (id %u): %s\n"), - handles[i]->qh_quotadev, name, id, strerror(olderrno)); - } - continue; + id2name(id, handles[i]->qh_type, name); + errstr(_("error while getting quota from %s for %s (id %u): %s\n"), + handles[i]->qh_quotadev, name, id, strerror(olderrno)); + freeprivs(qhead); + return NULL; } if (qhead == NULL) qhead = q; |