|
|
74096c |
From b528c21e6fedc9ac841942828b82e0c808da5efb Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
74096c |
Date: Thu, 2 Jan 2020 12:05:12 +0530
|
|
|
74096c |
Subject: [PATCH 393/449] afr: restore timestamp of files during metadata heal
|
|
|
74096c |
|
|
|
74096c |
For files: During metadata heal, we restore timestamps
|
|
|
74096c |
only for non-regular (char, block etc.) files.
|
|
|
74096c |
Extenting it for regular files as timestamp is updated
|
|
|
74096c |
via touch command also
|
|
|
74096c |
|
|
|
74096c |
> upstream patch link: https://review.gluster.org/#/c/glusterfs/+/23953/
|
|
|
74096c |
> fixes: bz#1787274
|
|
|
74096c |
> Change-Id: I26fe4fb6dff679422ba4698a7f828bf62ca7ca18
|
|
|
74096c |
> Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
74096c |
|
|
|
74096c |
BUG: 1761531
|
|
|
74096c |
Change-Id: I26fe4fb6dff679422ba4698a7f828bf62ca7ca18
|
|
|
74096c |
Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/202332
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
.../bug-1761531-metadata-heal-restore-time.t | 74 ++++++++++++++++++++++
|
|
|
74096c |
xlators/cluster/afr/src/afr-self-heal-metadata.c | 8 +--
|
|
|
74096c |
2 files changed, 76 insertions(+), 6 deletions(-)
|
|
|
74096c |
create mode 100644 tests/bugs/replicate/bug-1761531-metadata-heal-restore-time.t
|
|
|
74096c |
|
|
|
74096c |
diff --git a/tests/bugs/replicate/bug-1761531-metadata-heal-restore-time.t b/tests/bugs/replicate/bug-1761531-metadata-heal-restore-time.t
|
|
|
74096c |
new file mode 100644
|
|
|
74096c |
index 0000000..7e24eae
|
|
|
74096c |
--- /dev/null
|
|
|
74096c |
+++ b/tests/bugs/replicate/bug-1761531-metadata-heal-restore-time.t
|
|
|
74096c |
@@ -0,0 +1,74 @@
|
|
|
74096c |
+#!/bin/bash
|
|
|
74096c |
+
|
|
|
74096c |
+. $(dirname $0)/../../include.rc
|
|
|
74096c |
+. $(dirname $0)/../../volume.rc
|
|
|
74096c |
+. $(dirname $0)/../../afr.rc
|
|
|
74096c |
+cleanup
|
|
|
74096c |
+
|
|
|
74096c |
+GET_MDATA_PATH=$(dirname $0)/../../utils
|
|
|
74096c |
+build_tester $GET_MDATA_PATH/get-mdata-xattr.c
|
|
|
74096c |
+
|
|
|
74096c |
+TEST glusterd
|
|
|
74096c |
+TEST pidof glusterd
|
|
|
74096c |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/brick{0..2}
|
|
|
74096c |
+TEST $CLI volume start $V0
|
|
|
74096c |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
74096c |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
74096c |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
74096c |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 2
|
|
|
74096c |
+
|
|
|
74096c |
+TEST touch $M0/a
|
|
|
74096c |
+sleep 1
|
|
|
74096c |
+TEST kill_brick $V0 $H0 $B0/brick0
|
|
|
74096c |
+TEST touch $M0/a
|
|
|
74096c |
+
|
|
|
74096c |
+EXPECT_WITHIN $HEAL_TIMEOUT "^2$" get_pending_heal_count $V0
|
|
|
74096c |
+
|
|
|
74096c |
+TEST $CLI volume start $V0 force
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
74096c |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
|
|
|
74096c |
+
|
|
|
74096c |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
74096c |
+
|
|
|
74096c |
+mtime0=$(get_mtime $B0/brick0/a)
|
|
|
74096c |
+mtime1=$(get_mtime $B0/brick1/a)
|
|
|
74096c |
+TEST [ $mtime0 -eq $mtime1 ]
|
|
|
74096c |
+
|
|
|
74096c |
+ctime0=$(get_ctime $B0/brick0/a)
|
|
|
74096c |
+ctime1=$(get_ctime $B0/brick1/a)
|
|
|
74096c |
+TEST [ $ctime0 -eq $ctime1 ]
|
|
|
74096c |
+
|
|
|
74096c |
+###############################################################################
|
|
|
74096c |
+# Repeat the test with ctime feature disabled.
|
|
|
74096c |
+TEST $CLI volume set $V0 features.ctime off
|
|
|
74096c |
+
|
|
|
74096c |
+TEST touch $M0/b
|
|
|
74096c |
+sleep 1
|
|
|
74096c |
+TEST kill_brick $V0 $H0 $B0/brick0
|
|
|
74096c |
+TEST touch $M0/b
|
|
|
74096c |
+
|
|
|
74096c |
+EXPECT_WITHIN $HEAL_TIMEOUT "^2$" get_pending_heal_count $V0
|
|
|
74096c |
+
|
|
|
74096c |
+TEST $CLI volume start $V0 force
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
74096c |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
|
|
|
74096c |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
|
|
|
74096c |
+
|
|
|
74096c |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
74096c |
+
|
|
|
74096c |
+mtime2=$(get_mtime $B0/brick0/b)
|
|
|
74096c |
+mtime3=$(get_mtime $B0/brick1/b)
|
|
|
74096c |
+TEST [ $mtime2 -eq $mtime3 ]
|
|
|
74096c |
+
|
|
|
74096c |
+TEST rm $GET_MDATA_PATH/get-mdata-xattr
|
|
|
74096c |
+
|
|
|
74096c |
+TEST force_umount $M0
|
|
|
74096c |
+TEST $CLI volume stop $V0
|
|
|
74096c |
+TEST $CLI volume delete $V0
|
|
|
74096c |
+
|
|
|
74096c |
+cleanup
|
|
|
74096c |
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
|
|
|
74096c |
index ecfa791..f4e31b6 100644
|
|
|
74096c |
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
|
|
|
74096c |
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
|
|
|
74096c |
@@ -421,12 +421,8 @@ afr_selfheal_metadata(call_frame_t *frame, xlator_t *this, inode_t *inode)
|
|
|
74096c |
if (ret)
|
|
|
74096c |
goto unlock;
|
|
|
74096c |
|
|
|
74096c |
- /* Restore atime/mtime for files that don't need data heal as
|
|
|
74096c |
- * restoring timestamps happens only as a part of data-heal.
|
|
|
74096c |
- */
|
|
|
74096c |
- if (!IA_ISREG(locked_replies[source].poststat.ia_type))
|
|
|
74096c |
- afr_selfheal_restore_time(frame, this, inode, source, healed_sinks,
|
|
|
74096c |
- locked_replies);
|
|
|
74096c |
+ afr_selfheal_restore_time(frame, this, inode, source, healed_sinks,
|
|
|
74096c |
+ locked_replies);
|
|
|
74096c |
|
|
|
74096c |
ret = afr_selfheal_undo_pending(
|
|
|
74096c |
frame, this, inode, sources, sinks, healed_sinks, undid_pending,
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|