diff options
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 35 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 3 |
2 files changed, 37 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 678405de241..b5128aa6426 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -12106,7 +12106,8 @@ glusterd_mount_lvm_snapshot (glusterd_brickinfo_t *brickinfo, * Therefore to mount such a snapshot in XFS we need to pass nouuid * option */ - if (!strcmp (brickinfo->fstype, "xfs")) { + if (!strcmp (brickinfo->fstype, "xfs") && + !mntopts_exists (mnt_opts, "nouuid")) { if ( strlen (mnt_opts) > 0 ) strcat (mnt_opts, ","); strcat (mnt_opts, "nouuid"); @@ -14003,3 +14004,35 @@ glusterd_op_clear_xaction_peers () } } + +gf_boolean_t +mntopts_exists (const char *str, const char *opts) +{ + char *dup_val = NULL; + char *savetok = NULL; + char *token = NULL; + gf_boolean_t exists = _gf_false; + + GF_ASSERT (opts); + + if (!str || !strlen(str)) + goto out; + + dup_val = gf_strdup (str); + if (!dup_val) + goto out; + + token = strtok_r (dup_val, ",", &savetok); + while (token) { + if (!strcmp (token, opts)) { + exists = _gf_true; + goto out; + } + token = strtok_r (NULL, ",", &savetok); + } + +out: + GF_FREE (dup_val); + return exists; +} + diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index f1a8469700c..a6613d9b325 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -918,4 +918,7 @@ glusterd_have_peers (); void glusterd_op_clear_xaction_peers (); + +gf_boolean_t +mntopts_exists (const char *str, const char *opts); #endif |