21ab4e
From fd06789693cbd634676f6d8292b32ce1fa7e6bb7 Mon Sep 17 00:00:00 2001
21ab4e
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
21ab4e
Date: Wed, 22 Mar 2017 15:02:12 +0530
21ab4e
Subject: [PATCH 417/426] Fixes quota aux mount failure
21ab4e
21ab4e
The aux mount is created on the first limit/remove_limit/list command
21ab4e
and it remains until volume is stopped / deleted / (quota is disabled)
21ab4e
, where we do a lazy unmount. If the process is uncleanly terminated,
21ab4e
then the mount entry remains and we get (Transport disconnected) error
21ab4e
on subsequent attempts to run quota list/limit-usage/remove commands.
21ab4e
21ab4e
Second issue, There is also a risk of inadvertent rm -rf on the
21ab4e
/var/run/gluster causing data loss for the user. Ideally, /var/run is
21ab4e
a temp path for application use and should not cause any data loss to
21ab4e
persistent storage.
21ab4e
21ab4e
Solution:
21ab4e
1) unmount the aux mount after each use.
21ab4e
2) clean stale mount before mounting, if any.
21ab4e
21ab4e
One caveat with doing mount/unmount on each command is that we cannot
21ab4e
use same mount point for both list and limit commands.
21ab4e
The reason for this is that list command needs mount to be accessible
21ab4e
in cli after response from glusterd, So it could be unmounted by a
21ab4e
limit command if executed in parallel (had we used same mount point)
21ab4e
Hence we use separate mount points for list and limit commands.
21ab4e
21ab4e
>Reviewed-on: https://review.gluster.org/16938
21ab4e
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
>Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
>Reviewed-by: Manikandan Selvaganesh <manikandancs333@gmail.com>
21ab4e
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
>Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
21ab4e
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
21ab4e
Change-Id: I4f9e39da2ac2b65941399bffb6440db8a6ba59d0
21ab4e
BUG: 1414758
21ab4e
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/105515
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 cli/src/cli-rpc-ops.c                              | 29 +++++++++++-
21ab4e
 cli/src/cli.h                                      |  7 +--
21ab4e
 tests/basic/ec/quota.t                             |  1 -
21ab4e
 tests/basic/quota-ancestry-building.t              |  1 -
21ab4e
 tests/basic/quota-anon-fd-nfs.t                    |  1 -
21ab4e
 tests/basic/quota-nfs.t                            |  1 -
21ab4e
 tests/basic/quota.t                                |  6 ---
21ab4e
 tests/basic/quota_aux_mount.t                      | 53 ++++++++++++++++++++++
21ab4e
 tests/bugs/cli/bug-1022905.t                       |  1 -
21ab4e
 tests/bugs/distribute/bug-1099890.t                |  1 -
21ab4e
 tests/bugs/distribute/bug-1161156.t                |  1 -
21ab4e
 ...ve-quota-related-option-after-disabling-quota.t |  1 -
21ab4e
 tests/bugs/glusterfs/bug-848251.t                  |  1 -
21ab4e
 tests/bugs/posix/bug-990028.t                      |  1 -
21ab4e
 tests/bugs/quota/bug-1087198.t                     |  1 -
21ab4e
 ...436-calculate-quota-cksum-during-snap-restore.t |  1 -
21ab4e
 tests/volume.rc                                    | 19 +++++++-
21ab4e
 xlators/mgmt/glusterd/src/glusterd-quota.c         | 49 +++++++++++---------
21ab4e
 xlators/mgmt/glusterd/src/glusterd-utils.c         | 11 +----
21ab4e
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c    | 24 ----------
21ab4e
 xlators/mgmt/glusterd/src/glusterd.h               | 24 ++++++++--
21ab4e
 21 files changed, 151 insertions(+), 83 deletions(-)
21ab4e
 create mode 100755 tests/basic/quota_aux_mount.t
21ab4e
21ab4e
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
21ab4e
index 280605c..4c5c3bb 100644
21ab4e
--- a/cli/src/cli-rpc-ops.c
21ab4e
+++ b/cli/src/cli-rpc-ops.c
21ab4e
@@ -3620,6 +3620,26 @@ out:
21ab4e
 }
21ab4e
 
21ab4e
 int
21ab4e
+gluster_remove_auxiliary_mount (char *volname)
21ab4e
+{
21ab4e
+        int       ret                = -1;
21ab4e
+        char      mountdir[PATH_MAX] = {0,};
21ab4e
+        xlator_t  *this               = NULL;
21ab4e
+
21ab4e
+        this = THIS;
21ab4e
+        GF_ASSERT (this);
21ab4e
+
21ab4e
+        GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH (mountdir, volname, "/");
21ab4e
+        ret = gf_umount_lazy (this->name, mountdir, 1);
21ab4e
+        if (ret) {
21ab4e
+                gf_log("cli", GF_LOG_ERROR, "umount on %s failed, "
21ab4e
+                        "reason : %s", mountdir, strerror (errno));
21ab4e
+        }
21ab4e
+
21ab4e
+        return ret;
21ab4e
+}
21ab4e
+
21ab4e
+int
21ab4e
 gf_cli_print_limit_list_from_dict (cli_local_t *local, char *volname,
21ab4e
                                    dict_t *dict, char *default_sl, int count,
21ab4e
                                    int op_ret, int op_errno, char *op_errstr)
21ab4e
@@ -3667,7 +3687,7 @@ gf_cli_print_limit_list_from_dict (cli_local_t *local, char *volname,
21ab4e
                 ret = gf_canonicalize_path (path);
21ab4e
                 if (ret)
21ab4e
                         goto out;
21ab4e
-                GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, path);
21ab4e
+                GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH (mountdir, volname, path);
21ab4e
                 ret = print_quota_list_from_mountdir (local, mountdir,
21ab4e
                                                       default_sl, path, type);
21ab4e
         }
21ab4e
@@ -4153,6 +4173,7 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
21ab4e
         }
21ab4e
 
21ab4e
 xml_output:
21ab4e
+
21ab4e
         if (global_state->mode & GLUSTER_MODE_XML) {
21ab4e
                 ret = cli_xml_output_str ("volQuota", NULL, rsp.op_ret,
21ab4e
                                           rsp.op_errno, rsp.op_errstr);
21ab4e
@@ -4168,6 +4189,12 @@ xml_output:
21ab4e
 
21ab4e
         ret = rsp.op_ret;
21ab4e
 out:
21ab4e
+
21ab4e
+        if ((type == GF_QUOTA_OPTION_TYPE_LIST)
21ab4e
+            || (type == GF_QUOTA_OPTION_TYPE_LIST_OBJECTS)) {
21ab4e
+                gluster_remove_auxiliary_mount (volname);
21ab4e
+        }
21ab4e
+
21ab4e
         cli_cmd_broadcast_response (ret);
21ab4e
         if (dict)
21ab4e
                 dict_unref (dict);
21ab4e
diff --git a/cli/src/cli.h b/cli/src/cli.h
21ab4e
index ba0d845..d61d170 100644
21ab4e
--- a/cli/src/cli.h
21ab4e
+++ b/cli/src/cli.h
21ab4e
@@ -62,9 +62,10 @@ typedef enum {
21ab4e
 #define GLUSTER_MODE_WIGNORE   (1 << 3)
21ab4e
 
21ab4e
 
21ab4e
-#define GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH(abspath, volname, path)      \
21ab4e
-        snprintf (abspath, sizeof (abspath)-1,                          \
21ab4e
-                  DEFAULT_VAR_RUN_DIRECTORY"/%s%s", volname, path);
21ab4e
+#define GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH(abspath, volname, path) do {       \
21ab4e
+        snprintf (abspath, sizeof (abspath)-1,                                \
21ab4e
+                  DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_list%s", volname, path);\
21ab4e
+        } while (0)
21ab4e
 
21ab4e
 struct cli_state;
21ab4e
 struct cli_cmd_word;
21ab4e
diff --git a/tests/basic/ec/quota.t b/tests/basic/ec/quota.t
21ab4e
index b023240..c9612c8 100755
21ab4e
--- a/tests/basic/ec/quota.t
21ab4e
+++ b/tests/basic/ec/quota.t
21ab4e
@@ -40,7 +40,6 @@ EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quotausage "/test"
21ab4e
 TEST rm $M0/test/file2.txt
21ab4e
 EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quotausage "/test"
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 cleanup;
21ab4e
diff --git a/tests/basic/quota-ancestry-building.t b/tests/basic/quota-ancestry-building.t
21ab4e
index 99c9718..5d2f4a7 100755
21ab4e
--- a/tests/basic/quota-ancestry-building.t
21ab4e
+++ b/tests/basic/quota-ancestry-building.t
21ab4e
@@ -65,7 +65,6 @@ exec 5>&-
21ab4e
 exec 6>&-
21ab4e
 
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 cleanup;
21ab4e
diff --git a/tests/basic/quota-anon-fd-nfs.t b/tests/basic/quota-anon-fd-nfs.t
21ab4e
index ea07b52..279700d 100755
21ab4e
--- a/tests/basic/quota-anon-fd-nfs.t
21ab4e
+++ b/tests/basic/quota-anon-fd-nfs.t
21ab4e
@@ -107,7 +107,6 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
21ab4e
 sleep 3
21ab4e
 
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 
21ab4e
diff --git a/tests/basic/quota-nfs.t b/tests/basic/quota-nfs.t
21ab4e
index 74fde40..663a8da 100755
21ab4e
--- a/tests/basic/quota-nfs.t
21ab4e
+++ b/tests/basic/quota-nfs.t
21ab4e
@@ -58,7 +58,6 @@ TEST rm -f $N0/$deep/newfile_2
21ab4e
 EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0
21ab4e
 
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 cleanup;
21ab4e
diff --git a/tests/basic/quota.t b/tests/basic/quota.t
21ab4e
index 17d5710..7f8b21d 100755
21ab4e
--- a/tests/basic/quota.t
21ab4e
+++ b/tests/basic/quota.t
21ab4e
@@ -40,12 +40,8 @@ EXPECT 'on' volinfo_field $V0 'features.quota'
21ab4e
 EXPECT 'on' volinfo_field $V0 'features.inode-quota'
21ab4e
 EXPECT 'on' volinfo_field $V0 'features.quota-deem-statfs'
21ab4e
 
21ab4e
-#Wait for the auxiliarymount to come up
21ab4e
-sleep 3
21ab4e
 
21ab4e
 TEST $CLI volume quota $V0 limit-usage /test_dir 100MB
21ab4e
-# Checking for auxiliary mount
21ab4e
-EXPECT "0"  get_aux
21ab4e
 
21ab4e
 TEST $CLI volume quota $V0 limit-usage /test_dir/in_test_dir 150MB
21ab4e
 
21ab4e
@@ -231,9 +227,7 @@ EXPECT 'off' volinfo_field $V0 'features.quota'
21ab4e
 EXPECT 'off' volinfo_field $V0 'features.inode-quota'
21ab4e
 EXPECT '' volinfo_field $V0 'features.quota-deem-statfs'
21ab4e
 
21ab4e
-# aux mount should be removed
21ab4e
 TEST $CLI volume stop $V0;
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 cleanup;
21ab4e
diff --git a/tests/basic/quota_aux_mount.t b/tests/basic/quota_aux_mount.t
21ab4e
new file mode 100755
21ab4e
index 0000000..78d7f47
21ab4e
--- /dev/null
21ab4e
+++ b/tests/basic/quota_aux_mount.t
21ab4e
@@ -0,0 +1,53 @@
21ab4e
+#!/bin/bash
21ab4e
+
21ab4e
+. $(dirname $0)/../include.rc
21ab4e
+. $(dirname $0)/../volume.rc
21ab4e
+
21ab4e
+cleanup;
21ab4e
+
21ab4e
+##-------------------------------------------------------------
21ab4e
+## Tests to verify that aux mount is unmounted after each quota
21ab4e
+## command executes.
21ab4e
+##-------------------------------------------------------------
21ab4e
+
21ab4e
+TEST glusterd
21ab4e
+TEST pidof glusterd
21ab4e
+TEST $CLI volume info;
21ab4e
+
21ab4e
+TEST $CLI volume create $V0 replica 2  $H0:$B0/${V0}{1,2,3,4};
21ab4e
+
21ab4e
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
21ab4e
+EXPECT 'Created' volinfo_field $V0 'Status';
21ab4e
+EXPECT '4' brick_count $V0
21ab4e
+
21ab4e
+TEST $CLI volume start $V0;
21ab4e
+EXPECT 'Started' volinfo_field $V0 'Status';
21ab4e
+
21ab4e
+TEST $GFS -s $H0 --volfile-id $V0 $M0;
21ab4e
+
21ab4e
+TEST mkdir -p $M0/test_dir/
21ab4e
+
21ab4e
+TEST $CLI volume quota $V0 enable
21ab4e
+EXPECT 'on' volinfo_field $V0 'features.quota'
21ab4e
+EXPECT 'on' volinfo_field $V0 'features.inode-quota'
21ab4e
+
21ab4e
+TEST $CLI volume quota $V0 limit-usage /test_dir 150MB
21ab4e
+EXPECT "1"  get_limit_aux
21ab4e
+TEST $CLI volume quota $V0 limit-objects /test_dir 10
21ab4e
+EXPECT "1"  get_limit_aux
21ab4e
+EXPECT "150.0MB" quota_hard_limit "/test_dir";
21ab4e
+EXPECT "1"  get_list_aux
21ab4e
+EXPECT "10" quota_object_hard_limit "/test_dir";
21ab4e
+EXPECT "1"  get_list_aux
21ab4e
+
21ab4e
+TEST $CLI volume quota $V0 remove /test_dir/
21ab4e
+EXPECT "1"  get_limit_aux
21ab4e
+TEST $CLI volume quota $V0 remove-objects /test_dir
21ab4e
+EXPECT "1"  get_limit_aux
21ab4e
+
21ab4e
+TEST $CLI volume quota $V0 disable
21ab4e
+
21ab4e
+TEST $CLI volume stop $V0;
21ab4e
+
21ab4e
+cleanup;
21ab4e
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=1447344
21ab4e
diff --git a/tests/bugs/cli/bug-1022905.t b/tests/bugs/cli/bug-1022905.t
21ab4e
index 1d8981e..ee629e9 100644
21ab4e
--- a/tests/bugs/cli/bug-1022905.t
21ab4e
+++ b/tests/bugs/cli/bug-1022905.t
21ab4e
@@ -32,7 +32,6 @@ TEST $CLI volume set $V0 diagnostics.client-log-level DEBUG
21ab4e
 TEST $CLI volume reset $V0 force;
21ab4e
 
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 TEST $CLI volume delete $V0
21ab4e
 
21ab4e
 cleanup;
21ab4e
diff --git a/tests/bugs/distribute/bug-1099890.t b/tests/bugs/distribute/bug-1099890.t
21ab4e
index 40f70d4..1a19ba8 100644
21ab4e
--- a/tests/bugs/distribute/bug-1099890.t
21ab4e
+++ b/tests/bugs/distribute/bug-1099890.t
21ab4e
@@ -123,7 +123,6 @@ EXPECT "1" is_dht_linkfile "$B0/${V0}1/zz"
21ab4e
 
21ab4e
 force_umount $M0
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 UMOUNT_LOOP ${B0}/${V0}{1,2}
21ab4e
 rm -f ${B0}/brick{1,2}
21ab4e
 
21ab4e
diff --git a/tests/bugs/distribute/bug-1161156.t b/tests/bugs/distribute/bug-1161156.t
21ab4e
index 44a234c..fed90e7 100755
21ab4e
--- a/tests/bugs/distribute/bug-1161156.t
21ab4e
+++ b/tests/bugs/distribute/bug-1161156.t
21ab4e
@@ -50,7 +50,6 @@ TEST ! mv $N0/dir/newfile_3 $N0/newdir/
21ab4e
 
21ab4e
 umount_nfs $N0
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 
21ab4e
diff --git a/tests/bugs/glusterd/bug-765230-remove-quota-related-option-after-disabling-quota.t b/tests/bugs/glusterd/bug-765230-remove-quota-related-option-after-disabling-quota.t
21ab4e
index 9fe55a3..de48c09 100755
21ab4e
--- a/tests/bugs/glusterd/bug-765230-remove-quota-related-option-after-disabling-quota.t
21ab4e
+++ b/tests/bugs/glusterd/bug-765230-remove-quota-related-option-after-disabling-quota.t
21ab4e
@@ -54,7 +54,6 @@ EXPECT '' volinfo_field $V0 'features.quota-deem-statfs'
21ab4e
 
21ab4e
 ## Finish up
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 EXPECT 'Stopped' volinfo_field $V0 'Status';
21ab4e
 
21ab4e
 TEST $CLI volume delete $V0;
21ab4e
diff --git a/tests/bugs/glusterfs/bug-848251.t b/tests/bugs/glusterfs/bug-848251.t
21ab4e
index ed3caa3..69ffe68 100644
21ab4e
--- a/tests/bugs/glusterfs/bug-848251.t
21ab4e
+++ b/tests/bugs/glusterfs/bug-848251.t
21ab4e
@@ -48,6 +48,5 @@ EXPECT "80%" quota_list
21ab4e
 EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $MOUNTDIR
21ab4e
 TEST   rm -rf $MOUNTDIR
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 cleanup;
21ab4e
diff --git a/tests/bugs/posix/bug-990028.t b/tests/bugs/posix/bug-990028.t
21ab4e
index d04bb2b..c864214 100755
21ab4e
--- a/tests/bugs/posix/bug-990028.t
21ab4e
+++ b/tests/bugs/posix/bug-990028.t
21ab4e
@@ -153,6 +153,5 @@ __init;
21ab4e
 links_in_same_directory;
21ab4e
 links_across_directories;
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 cleanup
21ab4e
diff --git a/tests/bugs/quota/bug-1087198.t b/tests/bugs/quota/bug-1087198.t
21ab4e
index 0694b25..9513308 100644
21ab4e
--- a/tests/bugs/quota/bug-1087198.t
21ab4e
+++ b/tests/bugs/quota/bug-1087198.t
21ab4e
@@ -78,7 +78,6 @@ TEST grep -e "\"Usage is above soft limit:.*used by /\"" -- $BRICK_LOG_DIR/*
21ab4e
 EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
21ab4e
 
21ab4e
 TEST $CLI volume stop $V0
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 rm -f $QDD
21ab4e
 
21ab4e
diff --git a/tests/bugs/snapshot/bug-1202436-calculate-quota-cksum-during-snap-restore.t b/tests/bugs/snapshot/bug-1202436-calculate-quota-cksum-during-snap-restore.t
21ab4e
index 3669372..addc059 100644
21ab4e
--- a/tests/bugs/snapshot/bug-1202436-calculate-quota-cksum-during-snap-restore.t
21ab4e
+++ b/tests/bugs/snapshot/bug-1202436-calculate-quota-cksum-during-snap-restore.t
21ab4e
@@ -27,7 +27,6 @@ EXPECT '1' get_snap_count CLI_1 $V0
21ab4e
 
21ab4e
 TEST $CLI_1 volume stop $V0
21ab4e
 EXPECT 'Stopped' volinfo_field $V0 'Status'
21ab4e
-EXPECT "1" get_aux
21ab4e
 
21ab4e
 TEST $CLI_1 snapshot restore $($CLI_1 snapshot list)
21ab4e
 EXPECT '0' get_snap_count CLI_1 $V0
21ab4e
diff --git a/tests/volume.rc b/tests/volume.rc
21ab4e
index 7b13e13..336d9df 100644
21ab4e
--- a/tests/volume.rc
21ab4e
+++ b/tests/volume.rc
21ab4e
@@ -591,8 +591,9 @@ function num_graphs
21ab4e
 function get_aux()
21ab4e
 {
21ab4e
 ##Check if a auxiliary mount is there
21ab4e
+local aux_suffix=$1
21ab4e
 local rundir=$(gluster --print-statedumpdir)
21ab4e
-local pidfile="${rundir}/${V0}.pid"
21ab4e
+local pidfile="${rundir}/${V0}$aux_suffix.pid"
21ab4e
 if [ -f $pidfile ];
21ab4e
 then
21ab4e
         local pid=$(cat ${rundir}/${V0}.pid)
21ab4e
@@ -609,6 +610,18 @@ else
21ab4e
 fi
21ab4e
 }
21ab4e
 
21ab4e
+function get_list_aux()
21ab4e
+{
21ab4e
+# check for quota list aux mount
21ab4e
+	get_aux "_quota_list"
21ab4e
+}
21ab4e
+
21ab4e
+function get_limit_aux()
21ab4e
+{
21ab4e
+# check for quota list aux mount
21ab4e
+	get_aux "_quota_limit"
21ab4e
+}
21ab4e
+
21ab4e
 function check_for_xattr {
21ab4e
         local xattr=$1
21ab4e
         local filepath=$2
21ab4e
@@ -693,6 +706,10 @@ function quota_hl_exceeded()
21ab4e
 
21ab4e
 }
21ab4e
 
21ab4e
+function quota_object_hard_limit()
21ab4e
+{
21ab4e
+        quota_object_list_field $1 2
21ab4e
+}
21ab4e
 
21ab4e
 function scrub_status()
21ab4e
 {
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
21ab4e
index 451eb86..a31e037 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
21ab4e
@@ -702,11 +702,6 @@ glusterd_quota_disable (glusterd_volinfo_t *volinfo, char **op_errstr,
21ab4e
                 }
21ab4e
         }
21ab4e
 
21ab4e
-        //Remove aux mount of the volume on every node in the cluster
21ab4e
-        ret = glusterd_remove_auxiliary_mount (volinfo->volname);
21ab4e
-        if (ret)
21ab4e
-                goto out;
21ab4e
-
21ab4e
         *crawl = _gf_true;
21ab4e
 
21ab4e
         (void) glusterd_clean_up_quota_store (volinfo);
21ab4e
@@ -736,7 +731,7 @@ glusterd_set_quota_limit (char *volname, char *path, char *hard_limit,
21ab4e
         priv = this->private;
21ab4e
         GF_ASSERT (priv);
21ab4e
 
21ab4e
-        GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (abspath, volname, path);
21ab4e
+        GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH (abspath, volname, path);
21ab4e
         ret = gf_lstat_dir (abspath, NULL);
21ab4e
         if (ret) {
21ab4e
                 gf_asprintf (op_errstr, "Failed to find the directory %s. "
21ab4e
@@ -1364,7 +1359,7 @@ glusterd_remove_quota_limit (char *volname, char *path, char **op_errstr,
21ab4e
         priv = this->private;
21ab4e
         GF_ASSERT (priv);
21ab4e
 
21ab4e
-        GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (abspath, volname, path);
21ab4e
+        GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH (abspath, volname, path);
21ab4e
         ret = gf_lstat_dir (abspath, NULL);
21ab4e
         if (ret) {
21ab4e
                 gf_asprintf (op_errstr, "Failed to find the directory %s. "
21ab4e
@@ -1695,6 +1690,16 @@ glusterd_op_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
21ab4e
 
21ab4e
         ret = 0;
21ab4e
 out:
21ab4e
+        if (type == GF_QUOTA_OPTION_TYPE_LIMIT_USAGE ||
21ab4e
+            type == GF_QUOTA_OPTION_TYPE_LIMIT_OBJECTS ||
21ab4e
+            type == GF_QUOTA_OPTION_TYPE_REMOVE ||
21ab4e
+            type == GF_QUOTA_OPTION_TYPE_REMOVE_OBJECTS) {
21ab4e
+                /* During a list operation we need the aux mount to be
21ab4e
+                 * accessible until the listing is done at the cli
21ab4e
+                 */
21ab4e
+                glusterd_remove_auxiliary_mount (volinfo->volname);
21ab4e
+        }
21ab4e
+
21ab4e
         return ret;
21ab4e
 }
21ab4e
 
21ab4e
@@ -1853,7 +1858,7 @@ out:
21ab4e
 }
21ab4e
 
21ab4e
 static int
21ab4e
-glusterd_create_quota_auxiliary_mount (xlator_t *this, char *volname)
21ab4e
+glusterd_create_quota_auxiliary_mount (xlator_t *this, char *volname, int type)
21ab4e
 {
21ab4e
         int                ret                     = -1;
21ab4e
         int                retry                   = 0;
21ab4e
@@ -1864,28 +1869,30 @@ glusterd_create_quota_auxiliary_mount (xlator_t *this, char *volname)
21ab4e
         char              *volfileserver           = NULL;
21ab4e
         glusterd_conf_t   *priv                    = NULL;
21ab4e
         struct stat        buf                     = {0,};
21ab4e
+        FILE              *file                    = NULL;
21ab4e
 
21ab4e
         GF_VALIDATE_OR_GOTO ("glusterd", this, out);
21ab4e
         priv = this->private;
21ab4e
         GF_VALIDATE_OR_GOTO (this->name, priv, out);
21ab4e
 
21ab4e
-        GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile_path, volname);
21ab4e
 
21ab4e
-        if (gf_is_service_running (pidfile_path, NULL)) {
21ab4e
-                gf_msg_debug (this->name, 0, "Aux mount of volume %s is running"
21ab4e
-                              " already", volname);
21ab4e
-                ret = 0;
21ab4e
-                goto out;
21ab4e
+        if (type == GF_QUOTA_OPTION_TYPE_LIST ||
21ab4e
+            type == GF_QUOTA_OPTION_TYPE_LIST_OBJECTS) {
21ab4e
+                GLUSTERFS_GET_QUOTA_LIST_MOUNT_PIDFILE (pidfile_path, volname);
21ab4e
+                GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH (mountdir, volname, "/");
21ab4e
+        } else {
21ab4e
+                GLUSTERFS_GET_QUOTA_LIMIT_MOUNT_PIDFILE (pidfile_path, volname);
21ab4e
+                GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH (mountdir, volname, "/");
21ab4e
         }
21ab4e
 
21ab4e
-        if (glusterd_is_fuse_available () == _gf_false) {
21ab4e
-                gf_msg (this->name, GF_LOG_ERROR, 0,
21ab4e
-                        GD_MSG_MOUNT_REQ_FAIL, "Fuse unavailable");
21ab4e
-                ret = -1;
21ab4e
-                goto out;
21ab4e
+        file = fopen (pidfile_path, "r");
21ab4e
+        if (file) {
21ab4e
+                /* Previous command did not clean up pid file.
21ab4e
+                 * remove aux mount if it exists*/
21ab4e
+                gf_umount_lazy (this->name, mountdir, 1);
21ab4e
+                fclose(file);
21ab4e
         }
21ab4e
 
21ab4e
-        GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/");
21ab4e
         ret = sys_mkdir (mountdir, 0777);
21ab4e
         if (ret && errno != EEXIST) {
21ab4e
                 gf_msg (this->name, GF_LOG_ERROR, errno,
21ab4e
@@ -2039,7 +2046,7 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
21ab4e
                  */
21ab4e
                 if (is_origin_glusterd (dict)) {
21ab4e
                         ret = glusterd_create_quota_auxiliary_mount (this,
21ab4e
-                                                                     volname);
21ab4e
+                                                            volname, type);
21ab4e
                         if (ret) {
21ab4e
                                 *op_errstr = gf_strdup ("Failed to start aux "
21ab4e
                                                         "mount");
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
index 19b6dcc..9eb6502 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
@@ -11200,21 +11200,12 @@ glusterd_remove_auxiliary_mount (char *volname)
21ab4e
 {
21ab4e
         int       ret                = -1;
21ab4e
         char      mountdir[PATH_MAX] = {0,};
21ab4e
-        char      pidfile[PATH_MAX]  = {0,};
21ab4e
         xlator_t *this               = NULL;
21ab4e
 
21ab4e
         this = THIS;
21ab4e
         GF_ASSERT (this);
21ab4e
 
21ab4e
-        GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile, volname);
21ab4e
-
21ab4e
-        if (!gf_is_service_running (pidfile, NULL)) {
21ab4e
-                gf_msg_debug (this->name, 0, "Aux mount of volume %s "
21ab4e
-                        "absent, hence returning", volname);
21ab4e
-                return 0;
21ab4e
-        }
21ab4e
-
21ab4e
-        GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/");
21ab4e
+        GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH (mountdir, volname, "/");
21ab4e
         ret = gf_umount_lazy (this->name, mountdir, 1);
21ab4e
         if (ret) {
21ab4e
                 gf_msg (this->name, GF_LOG_ERROR, errno,
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
21ab4e
index dd1a39a..f6dec07 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
21ab4e
@@ -2680,8 +2680,6 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo)
21ab4e
 {
21ab4e
         int                     ret                     = -1;
21ab4e
         glusterd_brickinfo_t    *brickinfo              = NULL;
21ab4e
-        char                    mountdir[PATH_MAX]      = {0,};
21ab4e
-        char                    pidfile[PATH_MAX]       = {0,};
21ab4e
         xlator_t                *this                   = NULL;
21ab4e
         glusterd_svc_t          *svc                    = NULL;
21ab4e
 
21ab4e
@@ -2710,24 +2708,6 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo)
21ab4e
                 goto out;
21ab4e
         }
21ab4e
 
21ab4e
-        /* If quota auxiliary mount is present, unmount it */
21ab4e
-        GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile, volinfo->volname);
21ab4e
-
21ab4e
-        if (!gf_is_service_running (pidfile, NULL)) {
21ab4e
-                gf_msg_debug (this->name, 0, "Aux mount of volume %s "
21ab4e
-                        "absent", volinfo->volname);
21ab4e
-        } else {
21ab4e
-                GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volinfo->volname,
21ab4e
-                                                   "/");
21ab4e
-
21ab4e
-                ret = gf_umount_lazy (this->name, mountdir, 0);
21ab4e
-                if (ret)
21ab4e
-                        gf_msg (this->name, GF_LOG_ERROR, errno,
21ab4e
-                                GD_MSG_UNOUNT_FAILED,
21ab4e
-                                "umount on %s failed",
21ab4e
-                                mountdir);
21ab4e
-        }
21ab4e
-
21ab4e
         if (!volinfo->is_snap_volume) {
21ab4e
                 svc = &(volinfo->snapd.svc);
21ab4e
                 ret = svc->manager (svc, volinfo, PROC_START_NO_WAIT);
21ab4e
@@ -2809,10 +2789,6 @@ glusterd_op_delete_volume (dict_t *dict)
21ab4e
                 goto out;
21ab4e
         }
21ab4e
 
21ab4e
-        ret = glusterd_remove_auxiliary_mount (volname);
21ab4e
-        if (ret)
21ab4e
-                goto out;
21ab4e
-
21ab4e
         if (glusterd_check_ganesha_export (volinfo)) {
21ab4e
                 ret = manage_export_config (volname, "off", NULL);
21ab4e
                 if (ret)
21ab4e
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
21ab4e
index 0a97657..e3cc6ee 100644
21ab4e
--- a/xlators/mgmt/glusterd/src/glusterd.h
21ab4e
+++ b/xlators/mgmt/glusterd/src/glusterd.h
21ab4e
@@ -599,9 +599,15 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args);
21ab4e
 #define GLUSTERD_GET_QUOTAD_DIR(path, priv) \
21ab4e
         snprintf (path, PATH_MAX, "%s/quotad", priv->workdir);
21ab4e
 
21ab4e
-#define GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH(abspath, volname, path)      \
21ab4e
-        snprintf (abspath, sizeof (abspath)-1,                          \
21ab4e
-                  DEFAULT_VAR_RUN_DIRECTORY"/%s%s", volname, path);
21ab4e
+#define GLUSTERD_GET_QUOTA_LIMIT_MOUNT_PATH(abspath, volname, path) do {      \
21ab4e
+        snprintf (abspath, sizeof (abspath)-1,                                \
21ab4e
+                 DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_limit%s", volname, path);\
21ab4e
+        } while (0)
21ab4e
+
21ab4e
+#define GLUSTERD_GET_QUOTA_LIST_MOUNT_PATH(abspath, volname, path) do {       \
21ab4e
+        snprintf (abspath, sizeof (abspath)-1,                                \
21ab4e
+                  DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_list%s", volname, path);\
21ab4e
+        } while (0)
21ab4e
 
21ab4e
 #define GLUSTERD_GET_TMP_PATH(abspath, path) do {                       \
21ab4e
         snprintf (abspath, sizeof (abspath)-1,                          \
21ab4e
@@ -690,11 +696,19 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args);
21ab4e
                            uuid_utoa(MY_UUID));                         \
21ab4e
         } while (0)
21ab4e
 
21ab4e
-#define GLUSTERFS_GET_AUX_MOUNT_PIDFILE(pidfile, volname) {               \
21ab4e
+#define GLUSTERFS_GET_QUOTA_LIMIT_MOUNT_PIDFILE(pidfile, volname) {       \
21ab4e
                 snprintf (pidfile, PATH_MAX-1,                            \
21ab4e
-                          DEFAULT_VAR_RUN_DIRECTORY"/%s.pid", volname);   \
21ab4e
+                          DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_limit.pid", \
21ab4e
+                           volname);                                      \
21ab4e
         }
21ab4e
 
21ab4e
+#define GLUSTERFS_GET_QUOTA_LIST_MOUNT_PIDFILE(pidfile, volname) {    \
21ab4e
+                snprintf (pidfile, PATH_MAX-1,                            \
21ab4e
+                          DEFAULT_VAR_RUN_DIRECTORY"/%s_quota_list.pid",  \
21ab4e
+                          volname);                                       \
21ab4e
+        }
21ab4e
+
21ab4e
+
21ab4e
 #define GLUSTERD_GET_UUID_NOHYPHEN(ret_string, uuid) do {               \
21ab4e
                 char *snap_volname_ptr = ret_string;                    \
21ab4e
                 char  tmp_uuid[64];                                     \
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e