summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handshake.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-06-13 11:23:29 +0000
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-06-13 20:55:27 -0700
commit7aa3630b1f5e07227e9cd167cbd717bd7932ae78 (patch)
treedc7b5cb0b18768a6807f674ffd841acc49fae130 /xlators/mgmt/glusterd/src/glusterd-handshake.c
parent56438208c8ada12f878e0317c587a3642bf1a3a0 (diff)
glusterd/snapshot: Update fstype and fsuuid
Update fstype and fsuuid before creating missed snapshot Change-Id: Ie9af0065fab288bd1c1a26396428f0cee6335f97 BUG: 1109142 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/8062 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Justin Clift <justin@gluster.org> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handshake.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 115dd8bd145..7be1e9017bd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -347,16 +347,17 @@ int32_t
glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
glusterd_snap_op_t *snap_opinfo)
{
- char *device = NULL;
- glusterd_conf_t *priv = NULL;
- glusterd_snap_t *snap = NULL;
- glusterd_volinfo_t *snap_vol = NULL;
- glusterd_volinfo_t *volinfo = NULL;
- glusterd_brickinfo_t *brickinfo = NULL;
- int32_t ret = -1;
- int32_t i = 0;
- uuid_t snap_uuid = {0,};
- xlator_t *this = NULL;
+ char *device = NULL;
+ char fstype[NAME_MAX] = "";
+ glusterd_conf_t *priv = NULL;
+ glusterd_snap_t *snap = NULL;
+ glusterd_volinfo_t *snap_vol = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ int32_t ret = -1;
+ int32_t i = 0;
+ uuid_t snap_uuid = {0,};
+ xlator_t *this = NULL;
this = THIS;
GF_ASSERT (this);
@@ -431,6 +432,18 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
strncpy (brickinfo->device_path, device,
sizeof(brickinfo->device_path));
+ /* Update the backend file-system type of snap brick in
+ * snap volinfo. */
+ ret = glusterd_update_fstype (snap_opinfo->brick_path, brickinfo,
+ fstype, sizeof(fstype));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to update "
+ "file-system type for %s brick",
+ brickinfo->path);
+ /* We should not fail snapshot operation if we fail to get
+ * the file-system type */
+ }
+
ret = glusterd_take_lvm_snapshot (brickinfo, snap_opinfo->brick_path);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -439,6 +452,21 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
goto out;
}
+ /* After the snapshot both the origin brick (LVM brick) and
+ * the snapshot brick will have the same file-system UUID. This
+ * will cause lot of problems at mount time. Therefore we must
+ * generate a new UUID for the snapshot brick
+ */
+ ret = glusterd_update_fs_uuid (brickinfo);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to update "
+ "file-system uuid for %s brick", brickinfo->path);
+ /* Failing to update UUID should not cause snapshot failure.
+ * Currently UUID is updated only for XFS and ext2/ext3/ext4
+ * file-system.
+ */
+ }
+
/* Create and mount the snap brick */
ret = glusterd_snap_brick_create (snap_vol, brickinfo,
snap_opinfo->brick_num - 1);
@@ -449,6 +477,7 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
snap_vol->snapshot->snapname);
goto out;
}
+
brickinfo->snap_status = 0;
ret = glusterd_store_volinfo (snap_vol,
GLUSTERD_VOLINFO_VER_AC_NONE);
@@ -459,7 +488,6 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
goto out;
}
-
ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "starting the "