summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c28
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in55
2 files changed, 21 insertions, 62 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index f14ccf5c178..42190083a27 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3879,29 +3879,17 @@ int
fuse_get_mount_status (xlator_t *this)
{
int kid_status = -1;
- pid_t kid_pid = -1;
fuse_private_t *priv = this->private;
- int our_status = -1;
if (read(priv->status_pipe[0],&kid_status, sizeof(kid_status)) < 0) {
gf_log (this->name, GF_LOG_ERROR, "could not get mount status");
- goto out;
+ kid_status = -1;
}
gf_log (this->name, GF_LOG_DEBUG, "mount status is %d", kid_status);
- if (read(priv->status_pipe[0],&kid_pid, sizeof(kid_pid)) < 0) {
- gf_log (this->name, GF_LOG_ERROR, "could not get mount PID");
- goto out;
- }
- gf_log (this->name, GF_LOG_DEBUG, "mount PID is %d", kid_pid);
-
- (void)waitpid(kid_pid,NULL,0);
- our_status = kid_status;
-
-out:
close(priv->status_pipe[0]);
close(priv->status_pipe[1]);
- return our_status;
+ return kid_status;
}
static void *
@@ -4384,7 +4372,7 @@ init (xlator_t *this_xl)
int xl_name_allocated = 0;
int fsname_allocated = 0;
glusterfs_ctx_t *ctx = NULL;
- gf_boolean_t sync_mtab = _gf_false;
+ gf_boolean_t sync_to_mount = _gf_false;
char *mnt_args = NULL;
if (this_xl == NULL)
@@ -4532,11 +4520,11 @@ init (xlator_t *this_xl)
priv->fuse_dump_fd = ret;
}
- sync_mtab = _gf_false;
- ret = dict_get_str (options, "sync-mtab", &value_string);
+ sync_to_mount = _gf_false;
+ ret = dict_get_str (options, "sync-to-mount", &value_string);
if (ret == 0) {
ret = gf_string2boolean (value_string,
- &sync_mtab);
+ &sync_to_mount);
GF_ASSERT (ret == 0);
}
@@ -4582,7 +4570,7 @@ init (xlator_t *this_xl)
}
priv->fd = gf_fuse_mount (priv->mount_point, fsname, mnt_args,
- sync_mtab ? &ctx->mtab_pid : NULL,
+ sync_to_mount ? &ctx->mnt_pid : NULL,
priv->status_pipe[1]);
if (priv->fd == -1)
goto cleanup_exit;
@@ -4694,7 +4682,7 @@ struct volume_options options[] = {
{ .key = {"uid-map-root"},
.type = GF_OPTION_TYPE_INT
},
- { .key = {"sync-mtab"},
+ { .key = {"sync-to-mount"},
.type = GF_OPTION_TYPE_BOOL
},
{ .key = {"read-only"},
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 37cc2f9f60a..3ca09b03b1d 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -34,36 +34,6 @@ _init ()
UPDATEDBCONF=/etc/updatedb.conf
}
-# Mount happens asynchronously, so the command status alone will never be
-# sufficient. Instead, we have to wait for multiple events representing
-# different possible outcomes.
-wait_for ()
-{
- local daemon_pid=$1
- local mount_point=$2
-
- waited=0
- while true; do
- kill -s 0 $daemon_pid
- if [ $? != 0 ]; then
- echo "Gluster client daemon exited unexpectedly."
- umount $mount_point &> /dev/null
- exit 1
- fi
- inode=$(stat -c %i $mount_point 2>/dev/null);
- if [ "$inode" = "1" ]; then
- break
- fi
- if [ $waited -ge 10 ]; then
- break
- fi
- sleep 1
- waited=$((waited+1))
- done
-
- echo "$inode"
-}
-
start_glusterfs ()
{
if [ -n "$log_level_str" ]; then
@@ -151,33 +121,34 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --volfile=$volfile_loc");
fi
- cmd_line=$(echo "$cmd_line $mount_point")
- err=0
- $cmd_line
- daemon_pid=$$
+ cmd_line=$(echo "$cmd_line $mount_point");
+ err=0;
+ $cmd_line;
+
+
+ inode=$(stat -c %i $mount_point 2>/dev/null);
- # Wait for the inode to change *or* for the daemon to exit (indicating a
- # problem with the mount).
- inode=$(wait_for $daemon_pid $mount_point)
# this is required if the stat returns error
if [ -z "$inode" ]; then
- inode="0"
+ inode="0";
fi
# retry the failover
+ # if [ $? != "0" ]; then # <--- TODO: Once glusterfs returns proper error code, change it.
if [ $inode -ne 1 ]; then
+ err=1;
if [ -n "$cmd_line1" ]; then
cmd_line1=$(echo "$cmd_line1 $mount_point");
- $cmd_line1
- daemon_pid=$$
+ $cmd_line1;
+ err=0;
- inode=$(wait_for $daemon_pid $mount_point)
+ inode=$(stat -c %i $mount_point 2>/dev/null);
# this is required if the stat returns error
if [ -z "$inode" ]; then
inode="0";
fi
if [ $inode -ne 1 ]; then
- err=1
+ err=1;
fi
fi
fi