From 8dc29d44d2513dbc2fd85778b2ae8139c9ded0a8 Mon Sep 17 00:00:00 2001 From: tappro Date: Fri, 19 Jun 2009 21:45:50 +0000 Subject: [PATCH] Branch b1_8 b=19528 i=rread i=johann --- lustre/mds/mds_open.c | 16 +++++++++++----- lustre/ptlrpc/service.c | 16 ++++++++++------ lustre/tests/replay-single.sh | 10 ++++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 27448f1..e0df4d2 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -297,13 +297,19 @@ static struct mds_file_data *mds_dentry_open(struct dentry *dentry, mfd->mfd_mode = flags; mfd->mfd_dentry = dentry; mfd->mfd_xid = req->rq_xid; - - spin_lock(&med->med_open_lock); - list_add(&mfd->mfd_list, &med->med_open_head); - spin_unlock(&med->med_open_lock); - body->handle.cookie = mfd->mfd_handle.h_cookie; + if (req->rq_export->exp_disconnected) { + mds_mfd_unlink(mfd, 0); + MDS_DOWN_WRITE_ORPHAN_SEM(dentry->d_inode); + mds_mfd_close(NULL, REQ_REC_OFF, req->rq_export->exp_obd, + mfd, 0, NULL, 0, NULL, 0, NULL); + } else { + spin_lock(&med->med_open_lock); + list_add(&mfd->mfd_list, &med->med_open_head); + spin_unlock(&med->med_open_lock); + } + RETURN(mfd); cleanup_mfd: diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 6106187..293ab95 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -162,8 +162,8 @@ ptlrpc_grow_req_bufs(struct ptlrpc_service *svc) } void -ptlrpc_save_lock (struct ptlrpc_request *req, - struct lustre_handle *lock, int mode) +ptlrpc_save_lock(struct ptlrpc_request *req, + struct lustre_handle *lock, int mode) { struct ptlrpc_reply_state *rs = req->rq_reply_state; int idx; @@ -171,10 +171,14 @@ ptlrpc_save_lock (struct ptlrpc_request *req, LASSERT(rs != NULL); LASSERT(rs->rs_nlocks < RS_MAX_LOCKS); - idx = rs->rs_nlocks++; - rs->rs_locks[idx] = *lock; - rs->rs_modes[idx] = mode; - rs->rs_difficult = 1; + if (req->rq_export->exp_disconnected) { + ldlm_lock_decref(lock, mode); + } else { + idx = rs->rs_nlocks++; + rs->rs_locks[idx] = *lock; + rs->rs_modes[idx] = mode; + rs->rs_difficult = 1; + } } void diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index b7966fd..cbe373b 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -2066,6 +2066,16 @@ test_83() { #bug 19224 } run_test 83 "open replay with barrier between transactions" +test_84() { +#define OBD_FAIL_OBD_FAIL_MDS_SPLIT_OPEN 0x142 + do_facet mds "lctl set_param fail_loc=0x80000142" + createmany -o $DIR/$tfile- 1 & + PID=$! + mds_evict_client + wait $PID +} +run_test 84 "stale open during export disconnect" + equals_msg `basename $0`: test complete, cleaning up check_and_cleanup_lustre [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true -- 1.8.3.1