Whamcloud - gitweb
- initializing parent_lockh in mds_open() the same way as in other places.
authoryury <yury>
Wed, 26 Jan 2005 10:28:58 +0000 (10:28 +0000)
committeryury <yury>
Wed, 26 Jan 2005 10:28:58 +0000 (10:28 +0000)
- calling mds_finish_transno() in mds_reint_unlink() in all cases, not only in
cleanup_release == 1. This may cure problem we have observed yesterday (about
duplicating fids for parent and child).

- removed redundant lockh initializing in few places.
- release locks the same way as in other places (using lockh + 1, not &lockh[1]).

lustre/mds/mds_open.c
lustre/mds/mds_reint.c

index 56d58cb..89e8648 100644 (file)
@@ -843,7 +843,7 @@ int mds_open(struct mds_update_record *rec, int offset,
         struct mds_body *body = NULL;
         struct dentry *dchild = NULL, *dparent = NULL;
         struct mds_export_data *med;
-        struct lustre_handle parent_lockh[2];
+        struct lustre_handle parent_lockh[2] = {{0}, {0}};
         int rc = 0, cleanup_phase = 0, acc_mode, created = 0;
         int parent_mode = LCK_PR;
         void *handle = NULL;
@@ -856,9 +856,6 @@ int mds_open(struct mds_update_record *rec, int offset,
                   OLID4(rec->ur_id1), rec->ur_namelen - 1, rec->ur_name,
                   rec->ur_mode);
 
-        parent_lockh[0].cookie = 0;
-        parent_lockh[1].cookie = 0;
-
         if (offset == 3) { /* intent */
                 rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
                 body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body));
index 14ff438..9d7cfbc 100644 (file)
@@ -2120,8 +2120,8 @@ cleanup:
                 if (err)
                         CERROR("error on parent setattr: rc = %d\n", err);
         }
-//        rc = mds_finish_transno(mds, dparent ? dparent->d_inode : NULL,
-//                                handle, req, rc, 0);
+        rc = mds_finish_transno(mds, dparent ? dparent->d_inode : NULL,
+                                handle, req, rc, 0);
         if (!rc)
                 (void)obd_set_info(mds->mds_lov_exp, strlen("unlinked"),
                                    "unlinked", 0, NULL);
@@ -2161,9 +2161,6 @@ cleanup:
                         ptlrpc_save_lock(req, parent_lockh, LCK_PW);
                 l_dput(dchild);
                 l_dput(dchild);
-
-                rc = mds_finish_transno(mds, dparent ? dparent->d_inode : NULL,
-                                        handle, req, rc, 0);
                 l_dput(dparent);
         case 0:
                 break;
@@ -2329,7 +2326,7 @@ cleanup:
                         } else {
                                 ptlrpc_save_lock(req, tgt_dir_lockh, LCK_EX);
 #ifdef S_PDIROPS
-                                ptlrpc_save_lock(req, tgt_dir_lockh+1, update_mode);
+                                ptlrpc_save_lock(req, tgt_dir_lockh + 1, update_mode);
 #endif
                         }
                         l_dput(de_tgt_dir);
@@ -2995,8 +2992,6 @@ static int mds_reint_rename_create_name(struct mds_update_record *rec,
                obd->obd_name, rec->ur_tgt, OLID4(rec->ur_id1));
 
         /* first, lookup the target */
-        child_lockh.cookie = 0;
-        
         rc = mds_get_parent_child_locked(obd, mds, rec->ur_id2, parent_lockh,
                                          &de_tgtdir, LCK_PW, MDS_INODELOCK_UPDATE,
                                          &update_mode, rec->ur_tgt, rec->ur_tgtlen,
@@ -3020,9 +3015,9 @@ cleanup:
         if (cleanup_phase == 1) {
 #ifdef S_PDIROPS
                 if (parent_lockh[1].cookie != 0)
-                        ldlm_lock_decref(&parent_lockh[1], update_mode);
+                        ldlm_lock_decref(parent_lockh + 1, update_mode);
 #endif
-                ldlm_lock_decref(&parent_lockh[0], LCK_PW);
+                ldlm_lock_decref(parent_lockh, LCK_PW);
                 if (child_lockh.cookie != 0)
                         ldlm_lock_decref(&child_lockh, LCK_EX);
                 l_dput(de_new);
@@ -3055,7 +3050,6 @@ static int mds_reint_rename_to_remote(struct mds_update_record *rec, int offset,
                 RETURN(-ENOMEM);
         memset(op_data, 0, sizeof(*op_data));
 
-        child_lockh.cookie = 0;
         rc = mds_get_parent_child_locked(obd, mds, rec->ur_id1, parent_lockh,
                                          &de_srcdir, LCK_PW, MDS_INODELOCK_UPDATE,
                                          &update_mode, rec->ur_name, 
@@ -3121,9 +3115,9 @@ cleanup:
 
 #ifdef S_PDIROPS
         if (parent_lockh[1].cookie != 0)
-                ldlm_lock_decref(&parent_lockh[1], update_mode);
+                ldlm_lock_decref(parent_lockh + 1, update_mode);
 #endif
-        ldlm_lock_decref(&parent_lockh[0], LCK_PW);
+        ldlm_lock_decref(parent_lockh, LCK_PW);
         if (child_lockh.cookie != 0)
                 ldlm_lock_decref(&child_lockh, LCK_EX);