nfs: Remove afr split-brain handling in nfs
We added this code as an interim fix until afr can handle split-brains even when opens are not issued. Afr code has matured to reject fd based fops when there are split-brains so we can remove it. Change-Id: Ib337f78eccee86469a5eaabed1a547a2cea2bdcf BUG: 974972 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/5227 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
03f5172dd5
commit
fb064ec4e3
36
tests/bugs/bug-974972.t
Executable file
36
tests/bugs/bug-974972.t
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
. $(dirname $0)/../include.rc
|
||||
. $(dirname $0)/../volume.rc
|
||||
|
||||
#This script checks that nfs mount does not fail lookup on files with split-brain
|
||||
cleanup;
|
||||
|
||||
TEST glusterd
|
||||
TEST pidof glusterd
|
||||
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
|
||||
TEST $CLI volume set $V0 self-heal-daemon off
|
||||
TEST $CLI volume start $V0
|
||||
sleep 5
|
||||
TEST mount -t nfs -o vers=3 $H0:/$V0 $N0
|
||||
TEST touch $N0/1
|
||||
TEST kill_brick ${V0} ${H0} ${B0}/${V0}1
|
||||
echo abc > $N0/1
|
||||
TEST $CLI volume start $V0 force
|
||||
EXPECT_WITHIN 20 "Y" nfs_up_status
|
||||
EXPECT_WITHIN 20 "1" afr_child_up_status_in_nfs $V0 0
|
||||
EXPECT_WITHIN 20 "1" afr_child_up_status_in_nfs $V0 1
|
||||
|
||||
TEST kill_brick ${V0} ${H0} ${B0}/${V0}0
|
||||
echo def > $N0/1
|
||||
TEST $CLI volume start $V0 force
|
||||
EXPECT_WITHIN 20 "Y" nfs_up_status
|
||||
EXPECT_WITHIN 20 "1" afr_child_up_status_in_nfs $V0 0
|
||||
EXPECT_WITHIN 20 "1" afr_child_up_status_in_nfs $V0 1
|
||||
|
||||
#Lookup should not fail
|
||||
TEST ls $N0/1
|
||||
TEST ! cat $N0/1
|
||||
|
||||
TEST umount $N0
|
||||
cleanup
|
@ -105,6 +105,11 @@ function generate_shd_statedump {
|
||||
generate_statedump $(get_shd_process_pid $vol)
|
||||
}
|
||||
|
||||
function generate_nfs_statedump {
|
||||
local vol=$1
|
||||
generate_statedump $(get_nfs_pid $vol)
|
||||
}
|
||||
|
||||
function generate_brick_statedump {
|
||||
local vol=$1
|
||||
local host=$2
|
||||
@ -119,6 +124,13 @@ function afr_child_up_status_in_shd {
|
||||
_afr_child_up_status $vol $brick_id generate_shd_statedump
|
||||
}
|
||||
|
||||
function afr_child_up_status_in_nfs {
|
||||
local vol=$1
|
||||
#brick_id is (brick-num in volume info - 1)
|
||||
local brick_id=$2
|
||||
_afr_child_up_status $vol $brick_id generate_nfs_statedump
|
||||
}
|
||||
|
||||
function nfs_up_status {
|
||||
gluster volume status | grep "NFS Server" | awk '{print $6}'
|
||||
}
|
||||
|
@ -1632,7 +1632,6 @@ afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this,
|
||||
afr_local_t *local = NULL;
|
||||
int ret = -1;
|
||||
dict_t *xattr = NULL;
|
||||
int32_t spb = 0;
|
||||
|
||||
local = frame->local;
|
||||
|
||||
@ -1663,10 +1662,6 @@ afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this,
|
||||
local->loc.path,
|
||||
local->self_heal.actual_sh_started);
|
||||
}
|
||||
|
||||
if (local->loc.inode)
|
||||
spb = afr_is_split_brain (this, local->loc.inode);
|
||||
ret = dict_set_int32 (xattr, "split-brain", spb);
|
||||
}
|
||||
out:
|
||||
AFR_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
|
||||
|
@ -385,19 +385,6 @@ nfs_fop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
{
|
||||
struct nfs_fop_local *local = NULL;
|
||||
fop_lookup_cbk_t progcbk;
|
||||
int32_t spb = 0;
|
||||
|
||||
/*
|
||||
* With native protocol, self-heal failures would be detected during
|
||||
* open. NFS doesn't issue that open when revalidating cache, so we
|
||||
* have to check for failures here instead.
|
||||
*/
|
||||
if (dict_get_int32(xattr, "split-brain", &spb) == 0) {
|
||||
if (spb) {
|
||||
op_ret = -1;
|
||||
op_errno = EIO;
|
||||
}
|
||||
}
|
||||
|
||||
if (op_ret == 0) {
|
||||
nfs_fix_generation(this,inode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user