"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/basic/fencing/afr-lock-heal-basic.t" between
glusterfs-8.5.tar.gz and glusterfs-8.6.tar.gz

About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x.

afr-lock-heal-basic.t  (glusterfs-8.5):afr-lock-heal-basic.t  (glusterfs-8.6)
skipping to change at line 20 skipping to change at line 20
pid=$1 pid=$1
ps -p $pid ps -p $pid
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
echo "Y" echo "Y"
else else
echo "N" echo "N"
fi fi
} }
function fill_lock_info()
{
local -n info=$1
local brick=$2
pattern="ACTIVE.*client-${brick: -1}"
brick_sdump=$(generate_brick_statedump $V0 $H0 $brick)
info="$(egrep "$inode" $brick_sdump -A3| egrep "$pattern" | uniq | awk '{pri
nt $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')"
if [ -n "$info" ]
then
echo "success"
else
echo "failure"
fi
}
TEST glusterd TEST glusterd
TEST pidof glusterd TEST pidof glusterd
TEST $CLI volume info; TEST $CLI volume info;
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
EXPECT 'Created' volinfo_field $V0 'Status'; EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume set $V0 performance.write-behind off TEST $CLI volume set $V0 performance.write-behind off
TEST $CLI volume set $V0 performance.open-behind off TEST $CLI volume set $V0 performance.open-behind off
TEST $CLI volume set $V0 locks.mandatory-locking forced TEST $CLI volume set $V0 locks.mandatory-locking forced
TEST $CLI volume set $V0 enforce-mandatory-lock on TEST $CLI volume set $V0 enforce-mandatory-lock on
skipping to change at line 58 skipping to change at line 75
gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/${V0}0/FILE)) gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/${V0}0/FILE))
inode="FILE|gfid:$gfid_str" inode="FILE|gfid:$gfid_str"
# Kill brick-3 and let client-1 take lock on the file. # Kill brick-3 and let client-1 take lock on the file.
TEST kill_brick $V0 $H0 $B0/${V0}2 TEST kill_brick $V0 $H0 $B0/${V0}2
TEST kill -SIGUSR1 $client1_pid TEST kill -SIGUSR1 $client1_pid
# If program is still alive, glfs_file_lock() was a success. # If program is still alive, glfs_file_lock() was a success.
EXPECT "Y" is_gfapi_program_alive $client1_pid EXPECT "Y" is_gfapi_program_alive $client1_pid
# Check lock is present on brick-1 and brick-2 # Check lock is present on brick-1 and brick-2
b1_sdump=$(generate_brick_statedump $V0 $H0 $B0/${V0}0) EXPECT_WITHIN $PROCESS_UP_TIMEOUT "success" fill_lock_info c1_lock_on_b1 $B0/${V
b2_sdump=$(generate_brick_statedump $V0 $H0 $B0/${V0}1) 0}0
c1_lock_on_b1="$(egrep "$inode" $b1_sdump -A3| egrep 'ACTIVE.*client-0'| uniq| a EXPECT_WITHIN $PROCESS_UP_TIMEOUT "success" fill_lock_info c1_lock_on_b2 $B0/${V
wk '{print $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')" 0}1
c1_lock_on_b2="$(egrep "$inode" $b2_sdump -A3| egrep 'ACTIVE.*client-1'| uniq| a
wk '{print $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')"
TEST [ "$c1_lock_on_b1" == "$c1_lock_on_b2" ] TEST [ "$c1_lock_on_b1" == "$c1_lock_on_b2" ]
# Restart brick-3 and check that the lock has healed on it. # Restart brick-3 and check that the lock has healed on it.
TEST $CLI volume start $V0 force TEST $CLI volume start $V0 force
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
TEST sleep 10 #Needed for client to re-open fd? Otherwise client_pre_lk_v2() fai ls with EBADFD for remote-fd. Also wait for lock heal.
b3_sdump=$(generate_brick_statedump $V0 $H0 $B0/${V0}2) # Note: We need to wait for client to re-open the fd. Otherwise client_pre_lk_v2
c1_lock_on_b3="$(egrep "$inode" $b3_sdump -A3| egrep 'ACTIVE.*client-2'| uniq| a () fails with EBADFD for remote-fd. Also wait for lock heal.
wk '{print $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')" # So we may need to check the statedump for locks multiple times.
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "success" fill_lock_info c1_lock_on_b3 $B0/${V
0}2
TEST [ "$c1_lock_on_b1" == "$c1_lock_on_b3" ] TEST [ "$c1_lock_on_b1" == "$c1_lock_on_b3" ]
# Kill brick-1 and let client-2 preempt the lock on bricks 2 and 3. # Kill brick-1 and let client-2 preempt the lock on bricks 2 and 3.
TEST kill_brick $V0 $H0 $B0/${V0}0 TEST kill_brick $V0 $H0 $B0/${V0}0
TEST kill -SIGUSR1 $client2_pid TEST kill -SIGUSR1 $client2_pid
# If program is still alive, glfs_file_lock() was a success. # If program is still alive, glfs_file_lock() was a success.
EXPECT "Y" is_gfapi_program_alive $client2_pid EXPECT "Y" is_gfapi_program_alive $client2_pid
# Restart brick-1 and let lock healing complete. # Restart brick-1 and let lock healing complete.
TEST $CLI volume start $V0 force 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" brick_up_status $V0 $H0 $B0/${V0}0
TEST sleep 10 #Needed for client to re-open fd? Otherwise client_pre_lk_v2() fai ls with EBADFD for remote-fd. Also wait for lock heal.
# Check that all bricks now have locks from client 2 only. # Check that all bricks now have locks from client 2 only.
b1_sdump=$(generate_brick_statedump $V0 $H0 $B0/${V0}0) # Note: We need to wait for client to re-open the fd. Otherwise client_pre_lk_v2
b2_sdump=$(generate_brick_statedump $V0 $H0 $B0/${V0}1) () fails with EBADFD for remote-fd. Also wait for lock heal.
b3_sdump=$(generate_brick_statedump $V0 $H0 $B0/${V0}2) # So we may need to check the statedump for locks multiple times.
c2_lock_on_b1="$(egrep "$inode" $b1_sdump -A3| egrep 'ACTIVE.*client-0'| uniq| a EXPECT_WITHIN $PROCESS_UP_TIMEOUT "success" fill_lock_info c2_lock_on_b1 $B0/${V
wk '{print $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')" 0}0
c2_lock_on_b2="$(egrep "$inode" $b2_sdump -A3| egrep 'ACTIVE.*client-1'| uniq| a EXPECT_WITHIN $PROCESS_UP_TIMEOUT "success" fill_lock_info c2_lock_on_b2 $B0/${V
wk '{print $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')" 0}1
c2_lock_on_b3="$(egrep "$inode" $b3_sdump -A3| egrep 'ACTIVE.*client-2'| uniq| a EXPECT_WITHIN $PROCESS_UP_TIMEOUT "success" fill_lock_info c2_lock_on_b3 $B0/${V
wk '{print $1,$2,$3,S4,$5,$6,$7,$8}'|tr -d '(,), ,')" 0}2
TEST [ "$c2_lock_on_b1" == "$c2_lock_on_b2" ] TEST [ "$c2_lock_on_b1" == "$c2_lock_on_b2" ]
TEST [ "$c2_lock_on_b1" == "$c2_lock_on_b3" ] TEST [ "$c2_lock_on_b1" == "$c2_lock_on_b3" ]
TEST [ "$c2_lock_on_b1" != "$c1_lock_on_b1" ] TEST [ "$c2_lock_on_b1" != "$c1_lock_on_b1" ]
#Let the client programs run and exit. #Let the client programs run and exit.
TEST kill -SIGUSR1 $client1_pid TEST kill -SIGUSR1 $client1_pid
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "N" is_gfapi_program_alive $client1_pid EXPECT_WITHIN $PROCESS_UP_TIMEOUT "N" is_gfapi_program_alive $client1_pid
TEST kill -SIGUSR1 $client2_pid TEST kill -SIGUSR1 $client2_pid
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "N" is_gfapi_program_alive $client2_pid EXPECT_WITHIN $PROCESS_UP_TIMEOUT "N" is_gfapi_program_alive $client2_pid
 End of changes. 6 change blocks. 
20 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)