summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/bugs/bug-1049323.t64
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c27
2 files changed, 91 insertions, 0 deletions
diff --git a/tests/bugs/bug-1049323.t b/tests/bugs/bug-1049323.t
new file mode 100755
index 00000000000..203612e91f1
--- /dev/null
+++ b/tests/bugs/bug-1049323.t
@@ -0,0 +1,64 @@
+#!/bin/bash
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+function _init()
+{
+# Start glusterd
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume info;
+
+#Create a volume
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2};
+
+#Verify volume is created
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+#Start volume and verify
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0
+
+#Enable Quota
+TEST $CLI volume quota $V0 enable
+
+##Wait for the auxiliary mount to comeup
+sleep 3;
+}
+
+function get_aux()
+{
+##Check if a auxiliary mount is there
+df -h | grep "/var/run/gluster/$V0" -
+
+if [ $? -eq 0 ]
+then
+ echo "0"
+else
+ echo "1"
+fi
+}
+
+function create_data()
+{
+#set some limit on the volume
+TEST $CLI volume quota $V0 limit-usage / 50MB;
+
+#Auxiliary mount should be there before stopping the volume
+EXPECT "0" get_aux;
+
+TEST $CLI volume stop $V0;
+
+#Aux mount should have been removed
+EXPECT "1" get_aux;
+
+}
+
+
+_init;
+create_data;
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 85a53730602..051e7d7569e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1774,6 +1774,9 @@ glusterd_op_stop_volume (dict_t *dict)
glusterd_volinfo_t *volinfo = NULL;
glusterd_brickinfo_t *brickinfo = NULL;
xlator_t *this = NULL;
+ char mountdir[PATH_MAX] = {0,};
+ runner_t runner = {0,};
+ char pidfile[PATH_MAX] = {0,};
this = THIS;
GF_ASSERT (this);
@@ -1801,6 +1804,30 @@ glusterd_op_stop_volume (dict_t *dict)
if (ret)
goto out;
+ /* If quota auxiliary mount is present, unmount it */
+ GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile, volname);
+
+ if (!gf_is_service_running (pidfile, NULL)) {
+ gf_log (this->name, GF_LOG_DEBUG, "Aux mount of volume %s "
+ "absent", volname);
+ } else {
+ GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/");
+
+ runinit (&runner);
+ runner_add_args (&runner, "umount",
+
+ #if GF_LINUX_HOST_OS
+ "-l",
+ #endif
+ mountdir, NULL);
+ ret = runner_run_reuse (&runner);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR, "umount on %s failed, "
+ "reason : %s", mountdir, strerror (errno));
+
+ runner_end (&runner);
+ }
+
ret = glusterd_nodesvcs_handle_graph_change (volinfo);
out:
return ret;