From 4848109053a6956cdeb92b41def6b5016f387f9a Mon Sep 17 00:00:00 2001 From: wangdi Date: Thu, 21 Sep 2006 07:52:29 +0000 Subject: [PATCH] Branch: b_new_cmd 1)set the correct lock bit for cross-ref object. 2)in lmv_remote_intent, we should cancel the UPDATE lock, since we did not set l_ast_data for this lock, the inode page will not be truncated when revoked this lock, which will leave some stale dir page. --- lustre/lmv/lmv_intent.c | 5 +++-- lustre/mdt/mdt_handler.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index af16767..fb38c41 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -47,9 +47,10 @@ static inline void lmv_drop_intent_lock(struct lookup_intent *it) { - if (it->d.lustre.it_lock_mode != 0) - ldlm_lock_decref((void *)&it->d.lustre.it_lock_handle, + if (it->d.lustre.it_lock_mode != 0) { + ldlm_lock_decref_and_cancel((void *)&it->d.lustre.it_lock_handle, it->d.lustre.it_lock_mode); + } } int lmv_intent_remote(struct obd_export *exp, void *lmm, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 50dda2b..4e84a64 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -153,6 +153,11 @@ void mdt_set_disposition(struct mdt_thread_info *info, rep->lock_policy_res1 |= flag; } +static int mdt_is_remote_object(struct mdt_object *o) +{ + return (o->mot_header.loh_attr & LOHA_REMOTE); +} + static int mdt_getstatus(struct mdt_thread_info *info) { @@ -478,6 +483,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, } else { mdt_lock_handle_init(lhc); lhc->mlh_mode = LCK_CR; + if (mdt_is_remote_object(child)) + child_bits &= ~MDS_INODELOCK_LOOKUP; rc = mdt_object_lock(info, child, lhc, child_bits); } if (rc == 0) { @@ -1242,6 +1249,16 @@ struct mdt_object *mdt_object_find_lock(struct mdt_thread_info *info, if (!IS_ERR(o)) { int rc; + if (mdt_is_remote_object(o)) { + /* FIXME: For remote object we can only give + * LOOKUP_lock, maybe we should not put it + * here, but only we know it is remote, after + * we got the object currently, maybe we need + * a way to know remote by fid on MDS. */ + ibits &= ~MDS_INODELOCK_UPDATE; + ibits |= MDS_INODELOCK_LOOKUP; + } + rc = mdt_object_lock(info, o, lh, ibits); if (rc != 0) { mdt_object_put(info->mti_ctxt, o); -- 1.8.3.1