|
|
7c06a3 |
From bffaeb028ee716ed46e5b74a45162f2ef45b2963 Mon Sep 17 00:00:00 2001
|
|
|
7c06a3 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
7c06a3 |
Date: Thu, 23 Oct 2014 14:12:01 +0200
|
|
|
7c06a3 |
Subject: [PATCH] Skip NFS mounts without rquotad RPC service silently
|
|
|
7c06a3 |
MIME-Version: 1.0
|
|
|
7c06a3 |
Content-Type: text/plain; charset=UTF-8
|
|
|
7c06a3 |
Content-Transfer-Encoding: 8bit
|
|
|
7c06a3 |
|
|
|
7c06a3 |
If NFS server does uses quotas, then it's high chance the RCP rquotad
|
|
|
7c06a3 |
service is not running at all. Then listing quotas for such NFS mount
|
|
|
7c06a3 |
point results into a warning about "connection refused".
|
|
|
7c06a3 |
|
|
|
7c06a3 |
This warning can be obtrusive if a host has mounted various mixture of
|
|
|
7c06a3 |
NFS exports with and without quotas.
|
|
|
7c06a3 |
|
|
|
7c06a3 |
This patch recognizes this special error state (after performing
|
|
|
7c06a3 |
a query to a client without running rquotad) and considers such
|
|
|
7c06a3 |
server as having quotas disabled. This silents the warning
|
|
|
7c06a3 |
effectively.
|
|
|
7c06a3 |
|
|
|
7c06a3 |
JK: Some coding style fixes, treat also rpc_set_quota() this way.
|
|
|
7c06a3 |
|
|
|
7c06a3 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
7c06a3 |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
7c06a3 |
---
|
|
|
7c06a3 |
rquota_client.c | 38 ++++++++++++++++++++++++++++++++++----
|
|
|
7c06a3 |
1 file changed, 34 insertions(+), 4 deletions(-)
|
|
|
7c06a3 |
|
|
|
7c06a3 |
diff --git a/rquota_client.c b/rquota_client.c
|
|
|
7c06a3 |
index 9d4055e..a3a4ae3 100644
|
|
|
7c06a3 |
--- a/rquota_client.c
|
|
|
7c06a3 |
+++ b/rquota_client.c
|
|
|
7c06a3 |
@@ -148,6 +148,8 @@ int rpc_rquota_get(struct dquot *dquot)
|
|
|
7c06a3 |
} args;
|
|
|
7c06a3 |
char *fsname_tmp, *host, *pathname;
|
|
|
7c06a3 |
struct timeval timeout = { 2, 0 };
|
|
|
7c06a3 |
+ int rquotaprog_not_registered = 0;
|
|
|
7c06a3 |
+ int ret;
|
|
|
7c06a3 |
|
|
|
7c06a3 |
/*
|
|
|
7c06a3 |
* Initialize with NULL.
|
|
|
7c06a3 |
@@ -206,8 +208,11 @@ int rpc_rquota_get(struct dquot *dquot)
|
|
|
7c06a3 |
auth_destroy(clnt->cl_auth);
|
|
|
7c06a3 |
clnt_destroy(clnt);
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
- else
|
|
|
7c06a3 |
+ else {
|
|
|
7c06a3 |
result = NULL;
|
|
|
7c06a3 |
+ if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
|
|
|
7c06a3 |
+ rquotaprog_not_registered = 1;
|
|
|
7c06a3 |
+ }
|
|
|
7c06a3 |
|
|
|
7c06a3 |
if (result == NULL || !result->status) {
|
|
|
7c06a3 |
if (dquot->dq_h->qh_type == USRQUOTA) {
|
|
|
7c06a3 |
@@ -244,11 +249,21 @@ int rpc_rquota_get(struct dquot *dquot)
|
|
|
7c06a3 |
*/
|
|
|
7c06a3 |
auth_destroy(clnt->cl_auth);
|
|
|
7c06a3 |
clnt_destroy(clnt);
|
|
|
7c06a3 |
+ } else {
|
|
|
7c06a3 |
+ result = NULL;
|
|
|
7c06a3 |
+ if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
|
|
|
7c06a3 |
+ rquotaprog_not_registered = 1;
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
free(fsname_tmp);
|
|
|
7c06a3 |
- return rquota_err(result?result->status:-1);
|
|
|
7c06a3 |
+ if (result)
|
|
|
7c06a3 |
+ ret = result->status;
|
|
|
7c06a3 |
+ else if (rquotaprog_not_registered)
|
|
|
7c06a3 |
+ ret = Q_NOQUOTA;
|
|
|
7c06a3 |
+ else
|
|
|
7c06a3 |
+ ret = -1;
|
|
|
7c06a3 |
+ return rquota_err(ret);
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
|
|
|
7c06a3 |
/*
|
|
|
7c06a3 |
@@ -265,6 +280,8 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
|
|
|
7c06a3 |
} args;
|
|
|
7c06a3 |
char *fsname_tmp, *host, *pathname;
|
|
|
7c06a3 |
struct timeval timeout = { 2, 0 };
|
|
|
7c06a3 |
+ int rquotaprog_not_registered = 0;
|
|
|
7c06a3 |
+ int ret;
|
|
|
7c06a3 |
|
|
|
7c06a3 |
/* RPC limits values to 32b variables. Prevent value wrapping. */
|
|
|
7c06a3 |
if (check_dquot_range(dquot) < 0)
|
|
|
7c06a3 |
@@ -321,8 +338,11 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
|
|
|
7c06a3 |
auth_destroy(clnt->cl_auth);
|
|
|
7c06a3 |
clnt_destroy(clnt);
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
- else
|
|
|
7c06a3 |
+ else {
|
|
|
7c06a3 |
result = NULL;
|
|
|
7c06a3 |
+ if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
|
|
|
7c06a3 |
+ rquotaprog_not_registered = 1;
|
|
|
7c06a3 |
+ }
|
|
|
7c06a3 |
|
|
|
7c06a3 |
if (result == NULL || !result->status) {
|
|
|
7c06a3 |
if (dquot->dq_h->qh_type == USRQUOTA) {
|
|
|
7c06a3 |
@@ -361,11 +381,21 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
|
|
|
7c06a3 |
*/
|
|
|
7c06a3 |
auth_destroy(clnt->cl_auth);
|
|
|
7c06a3 |
clnt_destroy(clnt);
|
|
|
7c06a3 |
+ } else {
|
|
|
7c06a3 |
+ result = NULL;
|
|
|
7c06a3 |
+ if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
|
|
|
7c06a3 |
+ rquotaprog_not_registered = 1;
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
free(fsname_tmp);
|
|
|
7c06a3 |
- return rquota_err(result?result->status:-1);
|
|
|
7c06a3 |
+ if (result)
|
|
|
7c06a3 |
+ ret = result->status;
|
|
|
7c06a3 |
+ else if (rquotaprog_not_registered)
|
|
|
7c06a3 |
+ ret = Q_NOQUOTA;
|
|
|
7c06a3 |
+ else
|
|
|
7c06a3 |
+ ret = -1;
|
|
|
7c06a3 |
+ return rquota_err(ret);
|
|
|
7c06a3 |
#endif
|
|
|
7c06a3 |
return -1;
|
|
|
7c06a3 |
}
|
|
|
7c06a3 |
--
|
|
|
7c06a3 |
1.9.3
|
|
|
7c06a3 |
|