From bcb84451a79bb1fdf2b89feccd0d959147ef0c1d Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 15 Jun 2004 20:15:19 +0000 Subject: [PATCH] b=2837 - revert back old change to IT_OPEN handling. it shouldn't take UPDATE lock on the inode --- lustre/llite/file.c | 2 -- lustre/lmv/lmv_intent.c | 11 ++++++++--- lustre/mds/handler.c | 14 +++++--------- lustre/mds/mds_open.c | 23 ----------------------- 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 28905517c..324e9d2 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -229,8 +229,6 @@ int ll_file_open(struct inode *inode, struct file *file) if (rc) LBUG(); - ll_intent_drop_lock(it); - if (!S_ISREG(inode->i_mode)) GOTO(out, rc); diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 449c01b..ba8a06f 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -49,6 +49,13 @@ #include "lmv_internal.h" +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, + it->d.lustre.it_lock_mode); +} + int lmv_handle_remote_inode(struct obd_export *exp, struct ll_uctxt *uctxt, void *lmm, int lmmsize, struct lookup_intent *it, int flags, @@ -96,9 +103,7 @@ int lmv_handle_remote_inode(struct obd_export *exp, struct ll_uctxt *uctxt, * order to maintain dcache consistency. thus drop UPDATE * lock here and put LOOKUP in request */ if (rc == 0) { - LASSERT(it->d.lustre.it_lock_mode != 0); - ldlm_lock_decref((void *)&it->d.lustre.it_lock_handle, - it->d.lustre.it_lock_mode); + lmv_drop_intent_lock(it); memcpy(&it->d.lustre.it_lock_handle, &plock, sizeof(plock)); it->d.lustre.it_lock_mode = pmode; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 8fc0cdc..9236e3d 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -2379,15 +2379,11 @@ static int mds_intent_policy(struct ldlm_namespace *ns, RETURN(ELDLM_LOCK_ABORTED); if (intent_disposition(rep, DISP_LOOKUP_NEG) && !intent_disposition(rep, DISP_OPEN_OPEN)) -#endif - if (rep->lock_policy_res2) { - /* mds_open returns ENOLCK where it - * should return zero, but it has no - * lock to return */ - if (rep->lock_policy_res2 == ENOLCK) - rep->lock_policy_res2 = 0; - RETURN(ELDLM_LOCK_ABORTED); - } +#endif + /* IT_OPEN may return lock on cross-node dentry + * that we want to hold during attr retrival -bzzz */ + if (rc != 0 || lockh.cookie == 0) + RETURN(ELDLM_LOCK_ABORTED); break; case IT_LOOKUP: getattr_part = MDS_INODELOCK_LOOKUP; diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index c170d5e..df0c8b5 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1096,24 +1096,6 @@ got_child: } } - if (rc == 0) { - struct ldlm_res_id res_id = { . name = {0} }; - ldlm_policy_data_t policy; - int flags = 0; - res_id.name[0] = dchild->d_inode->i_ino; - res_id.name[1] = dchild->d_inode->i_generation; - policy.l_inodebits.bits = MDS_INODELOCK_LOOKUP | - MDS_INODELOCK_UPDATE; - rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace, - res_id, LDLM_IBITS, &policy, - LCK_PR, &flags, - mds_blocking_ast, - ldlm_completion_ast, NULL, NULL, - NULL, 0, NULL, child_lockh); - if (rc == 0) - cleanup_phase = 3; - } - /* Step 5: mds_open it */ rc = mds_finish_open(req, dchild, body, rec->ur_flags, &handle, rec, rep); @@ -1124,9 +1106,6 @@ got_child: req, rc, rep ? rep->lock_policy_res1 : 0); switch (cleanup_phase) { - case 3: - if (rc) - ldlm_lock_decref(child_lockh, LCK_PR); case 2: if (rc && created) { int err = vfs_unlink(dparent->d_inode, dchild); @@ -1157,8 +1136,6 @@ got_child: atomic_inc(&mds->mds_open_count); if (mea) OBD_FREE(mea, mea_size); - if ((cleanup_phase != 3) && !rc) - rc = ENOLCK; RETURN(rc); } -- 1.8.3.1