nfs-quota: do not fail on ECONNREFUSED
authorUri Simchoni <uri@samba.org>
Wed, 30 Mar 2016 10:21:58 +0000 (13:21 +0300)
committerJeremy Allison <jra@samba.org>
Thu, 31 Mar 2016 18:30:11 +0000 (20:30 +0200)
Trying to differentiate between "no quota" and real
error conditions - if the connection to rpc.quotad
is refused it could simply mean that the remote host
has no quota and therefore report this as success with
no quota.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/sysquotas_nfs.c

index 4b37e34e624d5ca5f83a1a009f45141d7f018bce..fe46d3fa36a3f12fd4465fe626877aa30533ab9a 100644 (file)
@@ -180,8 +180,20 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
                              timeout);
 
        if (clnt_stat != RPC_SUCCESS) {
-               DEBUG(3, ("sys_get_nfs_quotas: clnt_call failed\n"));
-               ret = -1;
+               if (errno == ECONNREFUSED) {
+                       /* If we cannot connect with rpc.quotad, it may
+                        * simply be because there's no quota on the remote
+                        * system
+                        */
+                       DBG_INFO("clnt_call failed with ECONNREFUSED - "
+                                "assuming no quotas on server\n");
+                       ret = 0;
+               } else {
+                       int save_errno = errno;
+                       DBG_NOTICE("clnt_call failed - %s\n", strerror(errno));
+                       errno = save_errno;
+                       ret = -1;
+               }
                goto out;
        }