From 1491ffd5dd96d4d3d88ff4442c0881c5bdc771a3 Mon Sep 17 00:00:00 2001 From: tappro Date: Tue, 31 Mar 2009 06:11:30 +0000 Subject: [PATCH] - avoid assertion if second open|create found orphan again b:18927 i:rread,johann --- lustre/mds/mds_unlink_open.c | 6 ++++-- lustre/tests/replay-dual.sh | 17 +++++++++++++++++ lustre/tests/replay-single.sh | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/lustre/mds/mds_unlink_open.c b/lustre/mds/mds_unlink_open.c index d64a586..0e6d15a 100644 --- a/lustre/mds/mds_unlink_open.c +++ b/lustre/mds/mds_unlink_open.c @@ -362,8 +362,10 @@ int mds_check_stale_orphan(struct obd_device *obd, struct ll_fid *fid) if (mds_inode_is_orphan(inode)) { struct dentry *orphan; - /* The exactly same inode can't be orphan */ - LASSERT(inode->i_generation != fid->generation); + /* bz18927: The exactly same inode can be marked as orphan + * if there was open|creat replay and this is second one */ + if (inode->i_generation == fid->generation) + GOTO(unlock_child, rc); if (mds_orphan_open_count(inode) > 0) { CERROR("Orphan "LPU64"/%u is in use!\n", diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index 122dc6d..eb830dd 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -442,6 +442,23 @@ test_20() { #16389 } run_test 20 "recovery time is not increasing" +test_22() { #bug 18927 + multiop_bg_pause $MOUNT1/$tfile O_c || return 1 + pid1=$! + multiop_bg_pause $MOUNT2/$tfile O_c || return 2 + pid2=$! + rm -f $MOUNT1/$tfile + replay_barrier mds + fail mds + kill -USR1 $pid1 + wait $pid1 || return 3 + kill -USR1 $pid2 + wait $pid2 || return 4 + [ -e $MOUNT1/$tfile ] && return 5 + return 0 +} +run_test 22 "double open|creat in replay with open orphan from two mntp" + equals_msg `basename $0`: test complete, cleaning up SLEEP=$((`date +%s` - $NOW)) [ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index f3ccf4a..a9872f4 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -1978,6 +1978,24 @@ test_81b() { } run_test 81b "fail log_add during unlink recovery" +test_82() { #bug 18927 + multiop_bg_pause $DIR/$tfile O_c || return 1 + pid1=$! + multiop_bg_pause $DIR/$tfile o:O_CREAT:O_RDONLY:_c || return 2 + pid2=$! + rm -f $DIR/$tfile + replay_barrier mds + fail mds + kill -USR1 $pid1 + wait $pid1 || return 3 + kill -USR1 $pid2 + wait $pid2 || return 4 + [ -e $DIR/$tfile ] && return 5 + return 0 +} +run_test 82 "second open|creat in replay with open orphan" + + equals_msg `basename $0`: test complete, cleaning up check_and_cleanup_lustre -- 1.8.3.1