Whamcloud - gitweb
b=2837
authoralex <alex>
Tue, 15 Jun 2004 20:15:19 +0000 (20:15 +0000)
committeralex <alex>
Tue, 15 Jun 2004 20:15:19 +0000 (20:15 +0000)
- revert back old change to IT_OPEN handling. it shouldn't take UPDATE
  lock on the inode

lustre/llite/file.c
lustre/lmv/lmv_intent.c
lustre/mds/handler.c
lustre/mds/mds_open.c

index 2890551..324e9d2 100644 (file)
@@ -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);
 
index 449c01b..ba8a06f 100644 (file)
 #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;
index 8fc0cdc..9236e3d 100644 (file)
@@ -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;
index c170d5e..df0c8b5 100644 (file)
@@ -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);
 }