summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c204
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c33
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c118
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
7 files changed, 250 insertions, 122 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 7d582d443f4..da3a01c99f8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -349,7 +349,6 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
glusterd_snap_op_t *snap_opinfo)
{
char *device = NULL;
- char fstype[NAME_MAX] = "";
glusterd_conf_t *priv = NULL;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_vol = NULL;
@@ -435,12 +434,10 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
/* Update the backend file-system type of snap brick in
* snap volinfo. */
- ret = glusterd_update_fstype (snap_opinfo->brick_path, brickinfo,
- fstype, sizeof(fstype));
+ ret = glusterd_update_mntopts (snap_opinfo->brick_path, brickinfo);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to update "
- "file-system type for %s brick",
- brickinfo->path);
+ "mount options for %s brick", brickinfo->path);
/* We should not fail snapshot operation if we fail to get
* the file-system type */
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index bde9aeb3fe3..a86795e224e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -995,6 +995,17 @@ glusterd_snapshot_restore_prevalidate (dict_t *dict, char **op_errstr,
"Failed to set %s", key);
goto out;
}
+
+ snprintf (key, sizeof (key),
+ "snap%d.brick%d.mnt_opts",
+ volcount, brick_count);
+ ret = dict_set_str (rsp_dict, key,
+ brickinfo->mnt_opts);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ goto out;
+ }
}
snprintf (key, sizeof (key), "snap%d.brick_count", volcount);
@@ -1311,6 +1322,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
char *snap_brick_dir = NULL;
char *snap_device = NULL;
char key[PATH_MAX] = "";
+ char *value = "";
char snapbrckcnt[PATH_MAX] = "";
char snapbrckord[PATH_MAX] = "";
int ret = -1;
@@ -1379,6 +1391,44 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (key, sizeof(key) - 1,
+ "vol%"PRId64".fstype%"PRId64, i+1, j);
+ ret = dict_get_str (src, key, &value);
+ if (ret) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Unable to fetch %s", key);
+ continue;
+ }
+
+ snprintf (key, sizeof(key) - 1,
+ "vol%"PRId64".fstype%"PRId64, i+1,
+ brick_order);
+ ret = dict_set_dynstr_with_alloc (dst, key, value);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ goto out;
+ }
+
+ snprintf (key, sizeof(key) - 1,
+ "vol%"PRId64".mnt_opts%"PRId64, i+1, j);
+ ret = dict_get_str (src, key, &value);
+ if (ret) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Unable to fetch %s", key);
+ continue;
+ }
+
+ snprintf (key, sizeof(key) - 1,
+ "vol%"PRId64".mnt_opts%"PRId64, i+1,
+ brick_order);
+ ret = dict_set_dynstr_with_alloc (dst, key, value);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ goto out;
+ }
+
+ snprintf (key, sizeof(key) - 1,
"vol%"PRId64".brick_snapdevice%"PRId64,
i+1, j);
ret = dict_get_ptr (src, key,
@@ -1527,6 +1577,21 @@ glusterd_snap_restore_use_rsp_dict (dict_t *dst, dict_t *src)
"Failed to set %s", key);
goto out;
}
+
+ snprintf (key, sizeof (key),
+ "snap%d.brick%d.mnt_opts", i, j);
+ ret = dict_get_str (src, key, &strvalue);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to get %s", key);
+ goto out;
+ }
+ ret = dict_set_dynstr_with_alloc (dst, key, strvalue);
+ if (ret) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "Failed to set %s", key);
+ goto out;
+ }
}
}
@@ -1918,6 +1983,34 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
device = NULL;
+ ret = glusterd_update_mntopts (brickinfo->path,
+ brickinfo);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ "update mount options for %s brick",
+ brickinfo->path);
+ }
+
+ snprintf (key, sizeof(key), "vol%"PRId64".fstype%"
+ PRId64, i, brick_count);
+ ret = dict_set_dynstr_with_alloc (rsp_dict, key,
+ brickinfo->fstype);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ goto out;
+ }
+
+ snprintf (key, sizeof(key), "vol%"PRId64".mnt_opts%"
+ PRId64, i, brick_count);
+ ret = dict_set_dynstr_with_alloc (rsp_dict, key,
+ brickinfo->mnt_opts);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set %s", key);
+ goto out;
+ }
+
snprintf (key, sizeof(key), "vol%"PRId64".brickdir%"PRId64, i,
brick_count);
ret = dict_set_dynstr_with_alloc (rsp_dict, key,
@@ -3868,9 +3961,7 @@ glusterd_snap_brick_create (glusterd_volinfo_t *snap_volinfo,
MS_MGC_VAL, "nouuid");
But for now, mounting using runner apis.
*/
- ret = glusterd_mount_lvm_snapshot (brickinfo->device_path,
- snap_brick_mount_path,
- brickinfo->fstype);
+ ret = glusterd_mount_lvm_snapshot (brickinfo, snap_brick_mount_path);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to mount lvm snapshot.");
@@ -3910,74 +4001,6 @@ out:
return ret;
}
-/* This function will update the backend file-system
- * type in origin and snap brickinfo. This will be later
- * used to perform file-system specific operation during
- * LVM snapshot.
- *
- * @param orig_brickinfo brickinfo of origin volume
- * @param snap_brickinfo brickinfo of snap volume
- *
- * @return 0 on success and -1 on failure
- */
-int
-glusterd_update_fstype (char *orig_brick_path,
- glusterd_brickinfo_t *snap_brickinfo,
- char *fstype, size_t fslen)
-{
- int32_t ret = -1;
- char *mnt_pt = NULL;
- char buff [PATH_MAX] = "";
- char msg [PATH_MAX] = "";
- char *cmd = NULL;
- struct mntent *entry = NULL;
- struct mntent save_entry = {0,};
- runner_t runner = {0,};
- xlator_t *this = NULL;
-
- this = THIS;
- GF_ASSERT (this);
- GF_ASSERT (orig_brick_path);
- GF_ASSERT (snap_brickinfo);
- GF_ASSERT (fstype);
-
- /* If the file-system type is not set then set the file-system type
- * in origin brickinfo */
- if (0 == fstype [0]) {
- ret = glusterd_get_brick_root (orig_brick_path, &mnt_pt);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "getting the root "
- "of the brick (%s) failed ",
- orig_brick_path);
- goto out;
- }
-
- entry = glusterd_get_mnt_entry_info (mnt_pt, buff,
- sizeof (buff), &save_entry);
- if (!entry) {
- gf_log (this->name, GF_LOG_ERROR, "getting the mount "
- "entry for the brick (%s) failed",
- orig_brick_path);
- ret = -1;
- goto out;
- }
-
- /* Update the origin brickinfo with the backend file-system
- * type */
- snprintf (fstype, fslen, "%s",
- entry->mnt_type);
- }
-
- /* Update the file-system type for snap brickinfo */
- snprintf (snap_brickinfo->fstype, sizeof (snap_brickinfo->fstype),
- "%s", fstype);
-
- ret = 0;
-out:
- GF_FREE (mnt_pt);
- return ret;
-}
-
static int32_t
glusterd_add_brick_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
glusterd_volinfo_t *snap_vol,
@@ -3985,6 +4008,7 @@ glusterd_add_brick_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
int64_t volcount, int32_t brick_count)
{
char key[PATH_MAX] = "";
+ char *value = NULL;
char *snap_brick_dir = NULL;
char snap_brick_path[PATH_MAX] = "";
char *snap_device = NULL;
@@ -4017,22 +4041,28 @@ glusterd_add_brick_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
goto out;
}
- /* Update fstype for the local bricks only */
- if (!uuid_compare (original_brickinfo->uuid, MY_UUID)) {
- /* Update the backend file-system type of snap brick in
- * snap volinfo. */
- ret = glusterd_update_fstype
- (original_brickinfo->path,
- snap_brickinfo,
- original_brickinfo->fstype,
- sizeof(original_brickinfo->fstype));
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to update "
- "file-system type for %s brick",
- snap_brickinfo->path);
- /* We should not fail snapshot operation if we fail to
- * get the file-system type */
- }
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64".fstype%d", volcount,
+ brick_count);
+ ret = dict_get_str (dict, key, &value);
+ if (!ret) {
+ /* Update the fstype in original brickinfo as well */
+ strcpy (original_brickinfo->fstype, value);
+ strcpy (snap_brickinfo->fstype, value);
+ } else {
+ if (is_origin_glusterd (dict) == _gf_true)
+ add_missed_snap = _gf_true;
+ }
+
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64".mnt_opts%d", volcount,
+ brick_count);
+ ret = dict_get_str (dict, key, &value);
+ if (!ret) {
+ /* Update the mnt_opts in original brickinfo as well */
+ strcpy (original_brickinfo->mnt_opts, value);
+ strcpy (snap_brickinfo->mnt_opts, value);
+ } else {
+ if (is_origin_glusterd (dict) == _gf_true)
+ add_missed_snap = _gf_true;
}
snprintf (key, sizeof(key) - 1, "vol%"PRId64".brickdir%d", volcount,
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 3f241bbe53a..b2ff8c2e00e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -336,6 +336,17 @@ gd_store_brick_snap_details_write (int fd, glusterd_brickinfo_t *brickinfo)
}
}
+ if (strlen (brickinfo->mnt_opts) > 0) {
+ snprintf (value, sizeof (value), "%s", brickinfo->mnt_opts);
+ ret = gf_store_save_value (fd,
+ GLUSTERD_STORE_KEY_BRICK_MNTOPTS, value);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to save "
+ "brick mnt opts of brick %s", brickinfo->path);
+ goto out;
+ }
+ }
+
memset (value, 0, sizeof (value));
snprintf (value, sizeof(value), "%d", brickinfo->snap_status);
ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_BRICK_SNAP_STATUS,
@@ -2318,6 +2329,10 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
strlen (GLUSTERD_STORE_KEY_BRICK_FSTYPE))) {
strncpy (brickinfo->fstype, value,
sizeof (brickinfo->fstype));
+ } else if (!strncmp (key, GLUSTERD_STORE_KEY_BRICK_MNTOPTS,
+ strlen (GLUSTERD_STORE_KEY_BRICK_MNTOPTS))) {
+ strncpy (brickinfo->mnt_opts, value,
+ sizeof (brickinfo->mnt_opts));
} else if (!strncmp (key,
GLUSTERD_STORE_KEY_BRICK_VGNAME,
strlen (GLUSTERD_STORE_KEY_BRICK_VGNAME))) {
@@ -3143,8 +3158,8 @@ out:
* at the brick_mount_path
*/
int32_t
-glusterd_mount_brick_paths (char *brick_mount_path, char *device_path,
- const char *fstype)
+glusterd_mount_brick_paths (char *brick_mount_path,
+ glusterd_brickinfo_t *brickinfo)
{
int32_t ret = -1;
runner_t runner = {0, };
@@ -3157,7 +3172,7 @@ glusterd_mount_brick_paths (char *brick_mount_path, char *device_path,
this = THIS;
GF_ASSERT (this);
GF_ASSERT (brick_mount_path);
- GF_ASSERT (device_path);
+ GF_ASSERT (brickinfo);
priv = this->private;
GF_ASSERT (priv);
@@ -3179,21 +3194,20 @@ glusterd_mount_brick_paths (char *brick_mount_path, char *device_path,
*/
/* Activate the snapshot */
runinit (&runner);
- runner_add_args (&runner, "lvchange", "-ay", device_path,
+ runner_add_args (&runner, "lvchange", "-ay", brickinfo->device_path,
NULL);
ret = runner_run (&runner);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to activate %s. Error: %s",
- device_path, strerror(errno));
+ brickinfo->device_path, strerror(errno));
goto out;
} else
gf_log (this->name, GF_LOG_DEBUG,
- "Activating %s successful", device_path);
+ "Activating %s successful", brickinfo->device_path);
/* Mount the snapshot */
- ret = glusterd_mount_lvm_snapshot (device_path, brick_mount_path,
- fstype);
+ ret = glusterd_mount_lvm_snapshot (brickinfo, brick_mount_path);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to mount lvm snapshot.");
@@ -3266,8 +3280,7 @@ glusterd_recreate_vol_brick_mounts (xlator_t *this,
/* Check if brick_mount_path is already mounted.
* If not, mount the device_path at the brick_mount_path */
- ret = glusterd_mount_brick_paths (brick_mount_path,
- brickinfo->device_path, brickinfo->fstype);
+ ret = glusterd_mount_brick_paths (brick_mount_path, brickinfo);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to mount brick_mount_path");
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index fb7de7b1b10..a17800076e0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -85,6 +85,7 @@ typedef enum glusterd_store_ver_ac_{
#define GLUSTERD_STORE_KEY_BRICK_MOUNT_DIR "mount_dir"
#define GLUSTERD_STORE_KEY_BRICK_SNAP_STATUS "snap-status"
#define GLUSTERD_STORE_KEY_BRICK_FSTYPE "fs-type"
+#define GLUSTERD_STORE_KEY_BRICK_MNTOPTS "mnt-opts"
#define GLUSTERD_STORE_KEY_BRICK_ID "brick-id"
#define GLUSTERD_STORE_KEY_PEER_UUID "uuid"
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 14d98c544aa..ee3759e91d4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -595,6 +595,7 @@ glusterd_brickinfo_dup (glusterd_brickinfo_t *brickinfo,
strcpy (dup_brickinfo->path, brickinfo->path);
strcpy (dup_brickinfo->device_path, brickinfo->device_path);
strcpy (dup_brickinfo->fstype, brickinfo->fstype);
+ strcpy (dup_brickinfo->mnt_opts, brickinfo->mnt_opts);
ret = gf_canonicalize_path (dup_brickinfo->path);
if (ret) {
gf_log (THIS->name, GF_LOG_ERROR, "Failed to canonicalize "
@@ -700,6 +701,13 @@ glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict,
strncpy (new_brickinfo->fstype, value,
sizeof(new_brickinfo->fstype));
+ snprintf (key, sizeof (key), "snap%d.brick%d.mnt_opts",
+ volcount, brick_count);
+ ret = dict_get_str (dict, key, &value);
+ if (!ret)
+ strncpy (new_brickinfo->mnt_opts, value,
+ sizeof(new_brickinfo->mnt_opts));
+
/* If the brick is not of this peer, or snapshot is missed *
* for the brick do not replace the xattr for it */
if ((!uuid_compare (brickinfo->uuid, MY_UUID)) &&
@@ -2304,6 +2312,15 @@ gd_add_brick_snap_details_to_dict (dict_t *dict, char *prefix,
goto out;
}
+ snprintf (key, sizeof (key), "%s.mnt_opts", prefix);
+ ret = dict_set_str (dict, key, brickinfo->mnt_opts);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to set mnt_opts for %s:%s",
+ brickinfo->hostname, brickinfo->path);
+ goto out;
+ }
+
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.mount_dir", prefix);
ret = dict_set_str (dict, key, brickinfo->mount_dir);
@@ -3657,6 +3674,7 @@ gd_import_new_brick_snap_details (dict_t *dict, char *prefix,
char key[512] = {0,};
char *snap_device = NULL;
char *fs_type = NULL;
+ char *mnt_opts = NULL;
char *mount_dir = NULL;
this = THIS;
@@ -3697,6 +3715,14 @@ gd_import_new_brick_snap_details (dict_t *dict, char *prefix,
}
strcpy (brickinfo->fstype, fs_type);
+ snprintf (key, sizeof (key), "%s.mnt_opts", prefix);
+ ret = dict_get_str (dict, key, &mnt_opts);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "%s missing in payload", key);
+ goto out;
+ }
+ strcpy (brickinfo->mnt_opts, mnt_opts);
+
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.mount_dir", prefix);
ret = dict_get_str (dict, key, &mount_dir);
@@ -11901,34 +11927,44 @@ glusterd_compare_volume_name(struct list_head *list1, struct list_head *list2)
}
int32_t
-glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path,
- const char *fstype)
+glusterd_mount_lvm_snapshot (glusterd_brickinfo_t *brickinfo,
+ char *brick_mount_path)
{
- char msg[NAME_MAX] = "";
- int32_t ret = -1;
- runner_t runner = {0, };
- xlator_t *this = NULL;
+ char msg[NAME_MAX] = "";
+ char mnt_opts[1024] = "";
+ int32_t ret = -1;
+ runner_t runner = {0, };
+ xlator_t *this = NULL;
this = THIS;
GF_ASSERT (this);
GF_ASSERT (brick_mount_path);
- GF_ASSERT (device_path);
+ GF_ASSERT (brickinfo);
runinit (&runner);
snprintf (msg, sizeof (msg), "mount %s %s",
- device_path, brick_mount_path);
+ brickinfo->device_path, brick_mount_path);
+
+ strcpy (mnt_opts, brickinfo->mnt_opts);
/* XFS file-system does not allow to mount file-system with duplicate
* UUID. File-system UUID of snapshot and its origin volume is same.
* Therefore to mount such a snapshot in XFS we need to pass nouuid
* option
*/
- if (!strcmp (fstype, "xfs")) {
- runner_add_args (&runner, "mount", "-o", "nouuid",
- device_path, brick_mount_path, NULL);
+ if (!strcmp (brickinfo->fstype, "xfs")) {
+ if ( strlen (mnt_opts) > 0 )
+ strcat (mnt_opts, ",");
+ strcat (mnt_opts, "nouuid");
+ }
+
+
+ if ( strlen (mnt_opts) > 0 ) {
+ runner_add_args (&runner, "mount", "-o", mnt_opts,
+ brickinfo->device_path, brick_mount_path, NULL);
} else {
- runner_add_args (&runner, "mount", device_path,
+ runner_add_args (&runner, "mount", brickinfo->device_path,
brick_mount_path, NULL);
}
@@ -11936,12 +11972,12 @@ glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path,
ret = runner_run (&runner);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "mounting the snapshot "
- "logical device %s failed (error: %s)", device_path,
- strerror (errno));
+ "logical device %s failed (error: %s)",
+ brickinfo->device_path, strerror (errno));
goto out;
} else
gf_log (this->name, GF_LOG_DEBUG, "mounting the snapshot "
- "logical device %s successful", device_path);
+ "logical device %s successful", brickinfo->device_path);
out:
gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
@@ -13398,3 +13434,55 @@ gd_get_snap_conf_values_if_present (dict_t *dict, uint64_t *sys_hard_limit,
GLUSTERD_STORE_KEY_SNAP_MAX_SOFT_LIMIT);
}
}
+
+/* This function will update the backend file-system
+ * type and the mount options in origin and snap brickinfo.
+ * This will be later used to perform file-system specific operation
+ * during LVM snapshot.
+ *
+ * @param brick_path brickpath for which fstype to be found
+ * @param brickinfo brickinfo of snap/origin volume
+ * @return 0 on success and -1 on failure
+ */
+int
+glusterd_update_mntopts (char *brick_path, glusterd_brickinfo_t *brickinfo)
+{
+ int32_t ret = -1;
+ char *mnt_pt = NULL;
+ char buff [PATH_MAX] = "";
+ char msg [PATH_MAX] = "";
+ char *cmd = NULL;
+ struct mntent *entry = NULL;
+ struct mntent save_entry = {0,};
+ runner_t runner = {0,};
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (brick_path);
+ GF_ASSERT (brickinfo);
+
+ ret = glusterd_get_brick_root (brick_path, &mnt_pt);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "getting the root "
+ "of the brick (%s) failed ", brick_path);
+ goto out;
+ }
+
+ entry = glusterd_get_mnt_entry_info (mnt_pt, buff, sizeof (buff),
+ &save_entry);
+ if (!entry) {
+ gf_log (this->name, GF_LOG_ERROR, "getting the mount entry for "
+ "the brick (%s) failed", brick_path);
+ ret = -1;
+ goto out;
+ }
+
+ strcpy (brickinfo->fstype, entry->mnt_type);
+ strcpy (brickinfo->mnt_opts, entry->mnt_opts);
+
+ ret = 0;
+out:
+ GF_FREE (mnt_pt);
+ return ret;
+}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 2486e54833f..6fe7aef92a9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -724,8 +724,8 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
int32_t volcount);
int32_t
-glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path,
- const char *fstype);
+glusterd_mount_lvm_snapshot (glusterd_brickinfo_t *brickinfo,
+ char *brick_mount_path);
int32_t
glusterd_umount (const char *path);
@@ -889,9 +889,7 @@ int glusterd_snapshot_get_volnames_uuids (dict_t *dict,
char *volname, gf_getsnap_name_uuid_rsp *snap_info_rsp);
int
-glusterd_update_fstype (char *orig_brick_path,
- glusterd_brickinfo_t *snap_brickinfo,
- char *fstype, size_t fslen);
+glusterd_update_mntopts (char *brick_path, glusterd_brickinfo_t *brickinfo);
int
glusterd_update_fs_label (glusterd_brickinfo_t *brickinfo);
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index ec036f8cf06..f7b4f012e03 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -193,6 +193,7 @@ struct glusterd_brickinfo {
char mount_dir[PATH_MAX];
char brick_id[1024];/*Client xlator name, AFR changelog name*/
char fstype [NAME_MAX]; /* Brick file-system type */
+ char mnt_opts [1024]; /* Brick mount options */
struct list_head brick_list;
uuid_t uuid;
int port;