Whamcloud - gitweb
LU-3544 llite: simplify dentry revalidate
[fs/lustre-release.git] / lustre / mdc / mdc_locks.c
index eabfbbd..a9a4e42 100644 (file)
@@ -988,8 +988,6 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
         if (fid_is_sane(&op_data->op_fid2) &&
             it->it_create_mode & M_CHECK_STALE &&
             it->it_op != IT_GETATTR) {
-                it_set_disposition(it, DISP_ENQ_COMPLETE);
-
                 /* Also: did we find the same inode? */
                 /* sever can return one of two fids:
                  * op_fid2 - new allocated fid - if file is created.
@@ -1157,6 +1155,12 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                     ldlm_blocking_callback cb_blocking,
                    __u64 extra_lock_flags)
 {
+       struct ldlm_enqueue_info einfo = {
+               .ei_type        = LDLM_IBITS,
+               .ei_mode        = it_to_lock_mode(it),
+               .ei_cb_bl       = cb_blocking,
+               .ei_cb_cp       = ldlm_completion_ast,
+       };
        struct lustre_handle lockh;
        int rc = 0;
        ENTRY;
@@ -1182,42 +1186,19 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                         RETURN(rc);
         }
 
-        /* lookup_it may be called only after revalidate_it has run, because
-         * revalidate_it cannot return errors, only zero.  Returning zero causes
-         * this call to lookup, which *can* return an error.
-         *
-         * We only want to execute the request associated with the intent one
-         * time, however, so don't send the request again.  Instead, skip past
-         * this and use the request from revalidate.  In this case, revalidate
-         * never dropped its reference, so the refcounts are all OK */
-        if (!it_disposition(it, DISP_ENQ_COMPLETE)) {
-               struct ldlm_enqueue_info einfo = {
-                       .ei_type        = LDLM_IBITS,
-                       .ei_mode        = it_to_lock_mode(it),
-                       .ei_cb_bl       = cb_blocking,
-                       .ei_cb_cp       = ldlm_completion_ast,
-               };
-
-                /* For case if upper layer did not alloc fid, do it now. */
-                if (!fid_is_sane(&op_data->op_fid2) && it->it_op & IT_CREAT) {
-                        rc = mdc_fid_alloc(exp, &op_data->op_fid2, op_data);
-                        if (rc < 0) {
-                                CERROR("Can't alloc new fid, rc %d\n", rc);
-                                RETURN(rc);
-                        }
-                }
-                rc = mdc_enqueue(exp, &einfo, it, op_data, &lockh,
-                                 lmm, lmmsize, NULL, extra_lock_flags);
-                if (rc < 0)
-                        RETURN(rc);
-        } else if (!fid_is_sane(&op_data->op_fid2) ||
-                   !(it->it_create_mode & M_CHECK_STALE)) {
-                /* DISP_ENQ_COMPLETE set means there is extra reference on
-                 * request referenced from this intent, saved for subsequent
-                 * lookup.  This path is executed when we proceed to this
-                 * lookup, so we clear DISP_ENQ_COMPLETE */
-                it_clear_disposition(it, DISP_ENQ_COMPLETE);
-        }
+       /* For case if upper layer did not alloc fid, do it now. */
+       if (!fid_is_sane(&op_data->op_fid2) && it->it_op & IT_CREAT) {
+               rc = mdc_fid_alloc(exp, &op_data->op_fid2, op_data);
+               if (rc < 0) {
+                       CERROR("Can't alloc new fid, rc %d\n", rc);
+                       RETURN(rc);
+               }
+       }
+       rc = mdc_enqueue(exp, &einfo, it, op_data, &lockh, lmm, lmmsize, NULL,
+                        extra_lock_flags);
+       if (rc < 0)
+               RETURN(rc);
+
         *reqp = it->d.lustre.it_data;
         rc = mdc_finish_intent_lock(exp, *reqp, op_data, it, &lockh);
         RETURN(rc);