cluster/afr: Do not update read_subvol in inode_ctx after rename/link fop

Since rename/link fops on a file will not change any data in it, it should
not update the read_subvol values in the inode_ctx, which interprets the
data & metadata readable subvols for that file. The old read_subvol values
should be retained even after the rename/link operations.

Change-Id: I068044a426823a566f5bea8aa063cd689199d6dd
fixes: bz#1657783
Signed-off-by: karthik-us <ksubrahm@redhat.com>
This commit is contained in:
karthik-us 2018-12-10 18:13:19 +05:30
parent 3e3d83ee35
commit 5c723ade19
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,40 @@
#!/bin/bash
. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc
cleanup;
TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0..2}
TEST $CLI volume set $V0 self-heal-daemon off
TEST $CLI volume set $V0 cluster.data-self-heal off
TEST $CLI volume set $V0 cluster.metadata-self-heal off
TEST $CLI volume set $V0 cluster.entry-self-heal off
TEST $CLI volume set $V0 performance.write-behind off
TEST $CLI volume start $V0
TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
TEST mkdir $M0/dir
TEST "echo abc > $M0/file1"
TEST "echo uvw > $M0/file2"
TEST kill_brick $V0 $H0 $B0/${V0}0
TEST "echo def > $M0/file1"
TEST "echo xyz > $M0/file2"
TEST $CLI volume start $V0 force
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
TEST kill_brick $V0 $H0 $B0/${V0}1
# Rename file1 and read it. Read should be served from the 3rd brick
TEST mv $M0/file1 $M0/file3
EXPECT "def" cat $M0/file3
# Create a link to file2 and read it. Read should be served from the 3rd brick
TEST ln $M0/file2 $M0/dir/file4
EXPECT "xyz" cat $M0/dir/file4
EXPECT "xyz" cat $M0/file2
cleanup

View File

@ -98,7 +98,9 @@ __afr_dir_write_finalize(call_frame_t *frame, xlator_t *this)
}
if (local->inode) {
afr_replies_interpret(frame, this, local->inode, NULL);
if (local->op != GF_FOP_RENAME && local->op != GF_FOP_LINK)
afr_replies_interpret(frame, this, local->inode, NULL);
inode_read_subvol = afr_data_subvol_get(local->inode, this, NULL, NULL,
NULL, &args);
}