summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mount')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c40
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in9
-rwxr-xr-xxlators/mount/fuse/utils/mount_glusterfs.in12
3 files changed, 53 insertions, 8 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index e876799a231..4affd40d51f 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -53,8 +53,9 @@
/* TODO: when supporting posix acl, remove this definition */
#define DISABLE_POSIX_ACL
-#define ZR_MOUNTPOINT_OPT "mountpoint"
-#define ZR_DIRECT_IO_OPT "direct-io-mode"
+#define ZR_MOUNTPOINT_OPT "mountpoint"
+#define ZR_DIRECT_IO_OPT "direct-io-mode"
+#define ZR_STRICT_VOLFILE_CHECK "strict-volfile-check"
#define BIG_FUSE_CHANNEL_SIZE 1048576
@@ -72,7 +73,7 @@ struct fuse_private {
uint32_t direct_io_mode;
double entry_timeout;
double attribute_timeout;
-
+ gf_boolean_t strict_volfile_check;
};
typedef struct fuse_private fuse_private_t;
@@ -2553,6 +2554,10 @@ int32_t
notify (xlator_t *this, int32_t event,
void *data, ...)
{
+ int32_t ret = 0;
+ fuse_private_t *private = NULL;
+
+ private = this->private;
switch (event)
{
@@ -2577,8 +2582,6 @@ notify (xlator_t *this, int32_t event,
#endif /* DARWIN */
{
- fuse_private_t *private = this->private;
- int32_t ret = 0;
if (!private->fuse_thread_started)
{
@@ -2597,6 +2600,21 @@ notify (xlator_t *this, int32_t event,
case GF_EVENT_PARENT_UP:
{
default_notify (this, GF_EVENT_PARENT_UP, data);
+ break;
+ }
+ case GF_EVENT_VOLFILE_MODIFIED:
+ {
+ gf_log ("fuse", GF_LOG_CRITICAL,
+ "remote volume file changed, try re-mounting");
+ if (private->strict_volfile_check) {
+ //fuse_session_remove_chan (private->ch);
+ //fuse_session_destroy (private->se);
+ //fuse_unmount (private->mount_point, private->ch);
+ /* TODO: Above code if works, will be a cleaner way,
+ but for now, lets just achieve what we want */
+ raise (SIGTERM);
+ }
+ break;
}
default:
break;
@@ -2736,7 +2754,14 @@ init (xlator_t *this_xl)
if (value_string) {
ret = gf_string2boolean (value_string, &priv->direct_io_mode);
}
-
+
+ priv->strict_volfile_check = 0;
+ ret = dict_get_str (options, ZR_STRICT_VOLFILE_CHECK, &value_string);
+ if (value_string) {
+ ret = gf_string2boolean (value_string,
+ &priv->strict_volfile_check);
+ }
+
priv->ch = fuse_mount (priv->mount_point, &args);
if (priv->ch == NULL) {
if (errno == ENOTCONN) {
@@ -2851,5 +2876,8 @@ struct volume_options options[] = {
{ .key = {"entry-timeout"},
.type = GF_OPTION_TYPE_DOUBLE
},
+ { .key = {"strict-volfile-check"},
+ .type = GF_OPTION_TYPE_BOOL
+ },
{ .key = {NULL} },
};
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 481fd265fff..58da509f17b 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -66,6 +66,10 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --log-file=$log_file");
fi
+ if [ -n "$volfile_check" ]; then
+ cmd_line=$(echo "$cmd_line --volfile-check");
+ fi
+
if [ -n "$direct_io_mode" ]; then
cmd_line=$(echo "$cmd_line --direct-io-mode=$direct_io_mode");
fi
@@ -115,7 +119,9 @@ main ()
volume_name=$(echo "$options" | sed -n 's/.*volume-name=\([^,]*\).*/\1/p');
volume_id=$(echo "$options" | sed -n 's/.*volume-id=\([^,]*\).*/\1/p');
-
+
+ volfile_check=$(echo "$options" | sed -n 's/.*volfile-check=\([^,]*\).*/\1/p');
+
volfile_loc="$1";
[ -r "$volfile_loc" ] || {
@@ -131,6 +137,7 @@ main ()
-e 's/[,]*log-level=[^,]*//' \
-e 's/[,]*volume-name=[^,]*//' \
-e 's/[,]*direct-io-mode=[^,]*//' \
+ -e 's/[,]*volfile-check=[^,]*//' \
-e 's/[,]*transport=[^,]*//' \
-e 's/[,]*volume-id=[^,]*//');
# following line is product of love towards sed
diff --git a/xlators/mount/fuse/utils/mount_glusterfs.in b/xlators/mount/fuse/utils/mount_glusterfs.in
index 1376a8897ab..b064e1eadf4 100755
--- a/xlators/mount/fuse/utils/mount_glusterfs.in
+++ b/xlators/mount/fuse/utils/mount_glusterfs.in
@@ -66,8 +66,12 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --log-file=$log_file");
fi
+ if [ -n "$volfile_check" ]; then
+ cmd_line=$(echo "$cmd_line --volfile-check");
+ fi
+
if [ -n "$direct_io_mode" ]; then
- cmd_line=$(echo "$cmd_line --direct-io-mode=$direct_io_mode");
+ cmd_line=$(echo "$cmd_line --disable-direct-io-mode");
fi
if [ -z "$volfile_loc" ]; then
@@ -107,6 +111,7 @@ main ()
direct_io_mode=""
volume_name=""
new_fs_options=""
+ volfile_check=""
while getopts o: opt; do
case "$opt" in
@@ -128,6 +133,10 @@ main ()
direct_io_mode=$(echo "$options" | sed -n 's/.*direct-io-mode=\([^,]*\).*/\1/p');
}
+ [ -z $volfile_check ] && {
+ volfile_check=$(echo "$options" | sed -n 's/.*volfile-check=\([^,]*\).*/\1/p');
+ }
+
[ -z $volume_name ] && {
volume_name=$(echo "$options" | sed -n 's/.*volume-name=\([^,]*\).*/\1/p');
}
@@ -139,6 +148,7 @@ main ()
this_option=$(echo "$options" | sed -e 's/[,]*log-file=[^,]*//' \
-e 's/[,]*log-level=[^,]*//' \
-e 's/[,]*volume-name=[^,]*//' \
+ -e 's/[,]*volfile-check=[^,]*//' \
-e 's/[,]*direct-io-mode=[^,]*//' \
-e 's/[,]*transport=[^,]*//' \
-e 's/[,]*volume-id=[^,]*//');