summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mount')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c34
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h3
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in2
3 files changed, 35 insertions, 4 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index a0a09a4ec57..03f766082e2 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -5150,7 +5150,7 @@ fuse_thread_proc (void *data)
ZR_MOUNTPOINT_OPT));
if (mount_point) {
gf_log (this->name, GF_LOG_INFO,
- "unmounting %s", mount_point);
+ "initating unmount of %s", mount_point);
}
/* Kill the whole process, not just this thread. */
@@ -5779,6 +5779,24 @@ init (xlator_t *this_xl)
if (!mnt_args)
goto cleanup_exit;
+ {
+ char *mnt_tok = NULL;
+ token_iter_t tit = {0,};
+ gf_boolean_t iter_end = _gf_false;
+
+ for (mnt_tok = token_iter_init (mnt_args, ',', &tit) ;;) {
+ iter_end = next_token (&mnt_tok, &tit);
+
+ if (strcmp (mnt_tok, "auto_unmount") == 0) {
+ priv->auto_unmount = _gf_true;
+ drop_token (mnt_tok, &tit);
+ }
+
+ if (iter_end)
+ break;
+ }
+ }
+
if (pipe(priv->status_pipe) < 0) {
gf_log (this_xl->name, GF_LOG_ERROR,
"could not create pipe to separate mount process");
@@ -5790,6 +5808,11 @@ init (xlator_t *this_xl)
priv->status_pipe[1]);
if (priv->fd == -1)
goto cleanup_exit;
+ if (priv->auto_unmount) {
+ ret = gf_fuse_unmount_daemon (priv->mount_point, priv->fd);
+ if (ret ==-1)
+ goto cleanup_exit;
+ }
event = eh_new (FUSE_EVENT_HISTORY_SIZE, _gf_false, NULL);
if (!event) {
@@ -5867,10 +5890,15 @@ fini (xlator_t *this_xl)
mount_point = data_to_str (dict_get (this_xl->options,
ZR_MOUNTPOINT_OPT));
if (mount_point != NULL) {
+ if (!priv->auto_unmount) {
+ gf_log (this_xl->name, GF_LOG_INFO,
+ "Unmounting '%s'.", mount_point);
+ gf_fuse_unmount (mount_point, priv->fd);
+ }
+
gf_log (this_xl->name, GF_LOG_INFO,
- "Unmounting '%s'.", mount_point);
+ "Closing fuse connection to '%s'.", mount_point);
- gf_fuse_unmount (mount_point, priv->fd);
sys_close (priv->fuse_dump_fd);
dict_del (this_xl->options, ZR_MOUNTPOINT_OPT);
}
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index e4075c83f2c..201b7f6930f 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -134,6 +134,9 @@ struct fuse_private {
/* Enable or disable capability support */
gf_boolean_t capability;
+
+ /* whether to run the unmount daemon */
+ gf_boolean_t auto_unmount;
};
typedef struct fuse_private fuse_private_t;
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index b5c90ba1dff..66dd7cd960f 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -562,7 +562,7 @@ without_options()
"atime"|"noatime"|"diratime"|"nodiratime"|\
"relatime"|"norelatime"|\
"strictatime"|"nostrictatime"|"lazyatime"|"nolazyatime"|\
- "dev"|"nodev"|"exec"|"noexec"|"suid"|"nosuid")
+ "dev"|"nodev"|"exec"|"noexec"|"suid"|"nosuid"|"auto_unmount")
[ -z "$fuse_mountopts" ] || fuse_mountopts="$fuse_mountopts,"
fuse_mountopts="${fuse_mountopts}${option}"
;;