summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-05-15 04:52:33 +0000
committerAnand Avati <avati@gluster.com>2011-05-19 15:41:47 -0700
commitc5d781e05599e9e7ad736d42c9c1033992c76ded (patch)
treeaff88649bc98a6c8babc3d75760fae2ef36b4cc3 /xlators
parent357df32e16dd21e7aedb699c7bd99cac9b95a040 (diff)
upon daemonizing, wait on mtab update to terminate in parent
This fixes the race in between the mtab update attempts of mount and umount when we do a lazy umount right after mounting, in order to hide the given fs instance; yet this way we still avoid the deadlock of the fs and mount which we can hit if we wait unconditionally for the mtab update to terminate (cf. bz #511). Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2690 (race between mtab updates of mount and umount) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2690
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index d34a747f4bb..dafc0a93cd3 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3485,6 +3485,8 @@ init (xlator_t *this_xl)
int i = 0;
int xl_name_allocated = 0;
int fsname_allocated = 0;
+ glusterfs_ctx_t *ctx = NULL;
+ gf_boolean_t sync_mtab = _gf_false;
if (this_xl == NULL)
return -1;
@@ -3492,6 +3494,10 @@ init (xlator_t *this_xl)
if (this_xl->options == NULL)
return -1;
+ ctx = glusterfs_ctx_get ();
+ if (!ctx)
+ return -1;
+
options = this_xl->options;
if (this_xl->name == NULL) {
@@ -3604,6 +3610,14 @@ init (xlator_t *this_xl)
priv->fuse_dump_fd = ret;
}
+ sync_mtab = _gf_false;
+ ret = dict_get_str (options, "sync-mtab", &value_string);
+ if (ret == 0) {
+ ret = gf_string2boolean (value_string,
+ &sync_mtab);
+ GF_ASSERT (ret == 0);
+ }
+
cmd_args = &this_xl->ctx->cmd_args;
fsname = cmd_args->volfile;
if (!fsname && cmd_args->volfile_server) {
@@ -3630,7 +3644,8 @@ init (xlator_t *this_xl)
priv->fd = gf_fuse_mount (priv->mount_point, fsname,
"allow_other,default_permissions,"
- "max_read=131072");
+ "max_read=131072",
+ sync_mtab ? &ctx->mtab_pid : NULL);
if (priv->fd == -1)
goto cleanup_exit;
@@ -3727,5 +3742,8 @@ struct volume_options options[] = {
{ .key = {"client-pid"},
.type = GF_OPTION_TYPE_INT
},
+ { .key = {"sync-mtab"},
+ .type = GF_OPTION_TYPE_BOOL
+ },
{ .key = {NULL} },
};