|
|
887953 |
From adeeec1fbe7241d18903ae3830a1fabb1061be21 Mon Sep 17 00:00:00 2001
|
|
|
887953 |
From: karthik-us <ksubrahm@redhat.com>
|
|
|
887953 |
Date: Mon, 17 Dec 2018 14:28:07 +0530
|
|
|
887953 |
Subject: [PATCH 489/493] cluster/afr: Do not update read_subvol in inode_ctx
|
|
|
887953 |
after rename/link fop
|
|
|
887953 |
|
|
|
887953 |
Since rename/link fops on a file will not change any data in it, it should
|
|
|
887953 |
not update the read_subvol values in the inode_ctx, which interprets the
|
|
|
887953 |
data & metadata readable subvols for that file. The old read_subvol values
|
|
|
887953 |
should be retained even after the rename/link operations.
|
|
|
887953 |
|
|
|
887953 |
Backport of: https://review.gluster.org/#/c/glusterfs/+/21841
|
|
|
887953 |
|
|
|
887953 |
Change-Id: I22787938b3f8295a48162ab4f498e4010d66a1ab
|
|
|
887953 |
BUG: 1645480
|
|
|
887953 |
Signed-off-by: karthik-us <ksubrahm@redhat.com>
|
|
|
887953 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/158803
|
|
|
887953 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
887953 |
Tested-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
|
|
|
887953 |
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
|
|
|
887953 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
887953 |
---
|
|
|
887953 |
...7783-do-not-update-read-subvol-on-rename-link.t | 40 ++++++++++++++++++++++
|
|
|
887953 |
xlators/cluster/afr/src/afr-dir-write.c | 4 ++-
|
|
|
887953 |
2 files changed, 43 insertions(+), 1 deletion(-)
|
|
|
887953 |
create mode 100644 tests/bugs/replicate/bug-1657783-do-not-update-read-subvol-on-rename-link.t
|
|
|
887953 |
|
|
|
887953 |
diff --git a/tests/bugs/replicate/bug-1657783-do-not-update-read-subvol-on-rename-link.t b/tests/bugs/replicate/bug-1657783-do-not-update-read-subvol-on-rename-link.t
|
|
|
887953 |
new file mode 100644
|
|
|
887953 |
index 0000000..b180f0e
|
|
|
887953 |
--- /dev/null
|
|
|
887953 |
+++ b/tests/bugs/replicate/bug-1657783-do-not-update-read-subvol-on-rename-link.t
|
|
|
887953 |
@@ -0,0 +1,40 @@
|
|
|
887953 |
+#!/bin/bash
|
|
|
887953 |
+. $(dirname $0)/../../include.rc
|
|
|
887953 |
+. $(dirname $0)/../../volume.rc
|
|
|
887953 |
+cleanup;
|
|
|
887953 |
+
|
|
|
887953 |
+TEST glusterd
|
|
|
887953 |
+TEST pidof glusterd
|
|
|
887953 |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0..2}
|
|
|
887953 |
+TEST $CLI volume set $V0 self-heal-daemon off
|
|
|
887953 |
+TEST $CLI volume set $V0 cluster.data-self-heal off
|
|
|
887953 |
+TEST $CLI volume set $V0 cluster.metadata-self-heal off
|
|
|
887953 |
+TEST $CLI volume set $V0 cluster.entry-self-heal off
|
|
|
887953 |
+TEST $CLI volume set $V0 performance.write-behind off
|
|
|
887953 |
+
|
|
|
887953 |
+TEST $CLI volume start $V0
|
|
|
887953 |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
|
|
|
887953 |
+TEST mkdir $M0/dir
|
|
|
887953 |
+TEST "echo abc > $M0/file1"
|
|
|
887953 |
+TEST "echo uvw > $M0/file2"
|
|
|
887953 |
+
|
|
|
887953 |
+TEST kill_brick $V0 $H0 $B0/${V0}0
|
|
|
887953 |
+TEST "echo def > $M0/file1"
|
|
|
887953 |
+TEST "echo xyz > $M0/file2"
|
|
|
887953 |
+
|
|
|
887953 |
+TEST $CLI volume start $V0 force
|
|
|
887953 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
|
|
|
887953 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
887953 |
+
|
|
|
887953 |
+TEST kill_brick $V0 $H0 $B0/${V0}1
|
|
|
887953 |
+
|
|
|
887953 |
+# Rename file1 and read it. Read should be served from the 3rd brick
|
|
|
887953 |
+TEST mv $M0/file1 $M0/file3
|
|
|
887953 |
+EXPECT "def" cat $M0/file3
|
|
|
887953 |
+
|
|
|
887953 |
+# Create a link to file2 and read it. Read should be served from the 3rd brick
|
|
|
887953 |
+TEST ln $M0/file2 $M0/dir/file4
|
|
|
887953 |
+EXPECT "xyz" cat $M0/dir/file4
|
|
|
887953 |
+EXPECT "xyz" cat $M0/file2
|
|
|
887953 |
+
|
|
|
887953 |
+cleanup
|
|
|
887953 |
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
887953 |
index 75889de..c508034 100644
|
|
|
887953 |
--- a/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
887953 |
+++ b/xlators/cluster/afr/src/afr-dir-write.c
|
|
|
887953 |
@@ -99,7 +99,9 @@ __afr_dir_write_finalize (call_frame_t *frame, xlator_t *this)
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
if (local->inode) {
|
|
|
887953 |
- afr_replies_interpret (frame, this, local->inode, NULL);
|
|
|
887953 |
+ if (local->op != GF_FOP_RENAME && local->op != GF_FOP_LINK)
|
|
|
887953 |
+ afr_replies_interpret (frame, this, local->inode, NULL);
|
|
|
887953 |
+
|
|
|
887953 |
inode_read_subvol = afr_data_subvol_get (local->inode, this,
|
|
|
887953 |
NULL, NULL, NULL, &args);
|
|
|
887953 |
}
|
|
|
887953 |
--
|
|
|
887953 |
1.8.3.1
|
|
|
887953 |
|