diff options
author | vmallika <vmallika@redhat.com> | 2014-11-13 07:11:00 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2014-11-13 20:10:02 -0800 |
commit | f3f7f2a2048359db67875a54a96dbf5a46f7bff3 (patch) | |
tree | 6fa18454979a181d0dc6a2ee1fb7588c60f414b5 /xlators/mgmt | |
parent | 878b30420891c8b00043391cdce90930eaf18795 (diff) |
glusterd/snapshot: Don't append nouuid mount option for snapshot brick
if original brick already has this option
Change-Id: I2841d2ac371a3e9505f6061f35d1d447946c0bae
BUG: 1133456
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/8526
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-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 |