From b888288d6e57dfa0bfba16a776ac8a147c0e98c8 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 31 May 2005 07:16:22 +0000 Subject: [PATCH] b=6379 - check for open count only in mds_cleanup_orphans() - drop orphan flag to avoid simultaneous unlinking from PENDING/ --- lustre/mds/mds_open.c | 2 ++ lustre/mds/mds_unlink_open.c | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 57256fe..645d2aa 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1434,6 +1434,8 @@ int mds_mfd_close(struct ptlrpc_request *req, int offset, last_orphan = mds_orphan_open_dec_test(inode) && mds_inode_is_orphan(inode); + if (last_orphan && unlink_orphan) + mds_inode_unset_orphan(inode); UP_WRITE_I_ALLOC_SEM(inode); /* this is half of the actual "close" */ diff --git a/lustre/mds/mds_unlink_open.c b/lustre/mds/mds_unlink_open.c index 0e361b5..28fe66d 100644 --- a/lustre/mds/mds_unlink_open.c +++ b/lustre/mds/mds_unlink_open.c @@ -236,12 +236,17 @@ int mds_cleanup_orphans(struct obd_device *obd) child_inode = dchild->d_inode; DOWN_READ_I_ALLOC_SEM(child_inode); - if (mds_inode_is_orphan(child_inode) && - mds_orphan_open_count(child_inode)) { + if (mds_orphan_open_count(child_inode)) { UP_READ_I_ALLOC_SEM(child_inode); CWARN("orphan %s re-opened during recovery\n", d_name); GOTO(next, rc = 0); } + if (!mds_inode_is_orphan(child_inode)) { + UP_READ_I_ALLOC_SEM(child_inode); + CWARN("orphan %s has been removed by CLOSE\n", d_name); + GOTO(next, rc = 0); + } + mds_inode_unset_orphan(child_inode); UP_READ_I_ALLOC_SEM(child_inode); rc = mds_unlink_orphan(obd, dchild, child_inode, pending_dir); if (rc == 0) { -- 1.8.3.1