summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glusterfsd/src/glusterfsd.c26
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c2
2 files changed, 25 insertions, 3 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 4ad47ec621a..8fbbb2f8d40 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -206,6 +206,8 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
int ret = 0;
cmd_args_t *cmd_args = NULL;
xlator_t *master = NULL;
+ char *mount_point = NULL;
+ char cwd[PATH_MAX] = {0,};
cmd_args = &ctx->cmd_args;
@@ -242,8 +244,28 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
if (!master->options)
goto err;
- ret = dict_set_static_ptr (master->options, ZR_MOUNTPOINT_OPT,
- cmd_args->mount_point);
+ /* Check if mount-point is absolute path,
+ * if not convert to absolute path by concating with CWD
+ */
+ if (cmd_args->mount_point[0] != '/') {
+ if (getcwd (cwd, PATH_MAX) != NULL) {
+ ret = gf_asprintf (&mount_point, "%s/%s", cwd,
+ cmd_args->mount_point);
+ if (ret == -1) {
+ gf_log ("glusterfsd", GF_LOG_ERROR,
+ "Could not create absolute mountpoint "
+ "path");
+ goto err;
+ }
+ } else {
+ gf_log ("glusterfsd", GF_LOG_ERROR,
+ "Could not get current working directory");
+ goto err;
+ }
+ } else
+ mount_point = gf_strdup (cmd_args->mount_point);
+
+ ret = dict_set_dynstr (master->options, ZR_MOUNTPOINT_OPT, mount_point);
if (ret < 0) {
gf_log ("glusterfsd", GF_LOG_ERROR,
"failed to set mount-point to options dictionary");
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 0b9ee176588..e2cdbe14112 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -4648,9 +4648,9 @@ fini (xlator_t *this_xl)
gf_log (this_xl->name, GF_LOG_INFO,
"Unmounting '%s'.", mount_point);
- dict_del (this_xl->options, ZR_MOUNTPOINT_OPT);
gf_fuse_unmount (mount_point, priv->fd);
close (priv->fuse_dump_fd);
+ dict_del (this_xl->options, ZR_MOUNTPOINT_OPT);
}
/* Process should terminate once fuse xlator is finished.
* Required for AUTH_FAILED event.