Whamcloud - gitweb
b=17310
[fs/lustre-release.git] / lustre / mdt / mdt_recovery.c
index b315438..4853c3e 100644 (file)
@@ -16,8 +16,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
@@ -229,11 +229,12 @@ static inline int mdt_last_rcvd_header_write(const struct lu_env *env,
         if (IS_ERR(th))
                 RETURN(PTR_ERR(th));
 
-        mti->mti_off = 0;        
+        mti->mti_off = 0;
         lsd_cpu_to_le(&mdt->mdt_lsd, &mti->mti_lsd);
 
         rc = mdt_record_write(env, mdt->mdt_last_rcvd,
-                              mdt_buf_const(env, &mti->mti_lsd, sizeof(mti->mti_lsd)),
+                              mdt_buf_const(env, &mti->mti_lsd,
+                                            sizeof(mti->mti_lsd)),
                               &mti->mti_off, th);
 
         mdt_trans_stop(env, mdt, th);
@@ -241,7 +242,7 @@ static inline int mdt_last_rcvd_header_write(const struct lu_env *env,
         CDEBUG(D_INFO, "write last_rcvd header rc = %d:\n"
                "uuid = %s\nlast_transno = "LPU64"\n",
                rc, mdt->mdt_lsd.lsd_uuid, mdt->mdt_lsd.lsd_last_transno);
-        
+
         RETURN(rc);
 }
 
@@ -322,7 +323,6 @@ static int mdt_last_rcvd_write(const struct lu_env *env,
         return rc;
 }
 
-
 static int mdt_clients_data_init(const struct lu_env *env,
                                  struct mdt_device *mdt,
                                  unsigned long last_size)
@@ -382,18 +382,18 @@ static int mdt_clients_data_init(const struct lu_env *env,
                 if (IS_ERR(exp)) {
                         if (PTR_ERR(exp) == -EALREADY) {
                                 /* export already exists, zero out this one */
-                                lcd->lcd_uuid[0] = '\0'; 
+                                lcd->lcd_uuid[0] = '\0';
                         } else
                                 GOTO(err_client, rc = PTR_ERR(exp));
                 } else {
-                        struct mdt_thread_info *mti;                        
+                        struct mdt_thread_info *mti;
                         mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
                         LASSERT(mti != NULL);
                         mti->mti_exp = exp;
                         exp->exp_mdt_data.med_lcd = lcd;
                         rc = mdt_client_add(env, mdt, cl_idx);
                         /* can't fail existing */
-                        LASSERTF(rc == 0, "rc = %d\n", rc); 
+                        LASSERTF(rc == 0, "rc = %d\n", rc);
                         lcd = NULL;
                         spin_lock(&exp->exp_lock);
                         exp->exp_connecting = 0;
@@ -559,7 +559,7 @@ static int mdt_server_data_update(const struct lu_env *env,
 }
 
 void mdt_cb_new_client(const struct mdt_device *mdt, __u64 transno,
-                                  void *data, int err) 
+                                  void *data, int err)
 {
         struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd;
 
@@ -822,10 +822,10 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti,
         /*
          * When we store zero transno in lcd we can lost last transno value
          * because lcd contains 0, but lsd is not yet written
-         * The server data should be updated also if the latest 
+         * The server data should be updated also if the latest
          * transno is rewritten by zero. See the bug 11125 for details.
          */
-        if (mti->mti_transno == 0 && 
+        if (mti->mti_transno == 0 &&
             *transno_p == mdt->mdt_last_transno)
                 mdt_server_data_update(mti->mti_env, mdt);
 
@@ -874,7 +874,8 @@ static int mdt_txn_stop_cb(const struct lu_env *env,
         if (mti->mti_has_trans) {
                 /* XXX: currently there are allowed cases, but the wrong cases
                  * are also possible, so better check is needed here */
-                CDEBUG(D_INFO, "More than one transaction "LPU64"\n", mti->mti_transno);
+                CDEBUG(D_INFO, "More than one transaction "LPU64"\n",
+                       mti->mti_transno);
                 return 0;
         }
 
@@ -912,7 +913,7 @@ static int mdt_txn_stop_cb(const struct lu_env *env,
         return mdt_last_rcvd_update(mti, txn);
 }
 
-/* commit callback, need to update last_commited value */
+/* commit callback, need to update last_committed value */
 static int mdt_txn_commit_cb(const struct lu_env *env,
                              struct thandle *txn, void *cookie)
 {
@@ -998,7 +999,6 @@ put_last_rcvd:
         return rc;
 }
 
-
 void mdt_fs_cleanup(const struct lu_env *env, struct mdt_device *mdt)
 {
         ENTRY;
@@ -1051,9 +1051,8 @@ static void mdt_steal_ack_locks(struct ptlrpc_request *req)
                       libcfs_nid2str(exp->exp_connection->c_peer.nid));
 
                 for (i = 0; i < oldrep->rs_nlocks; i++)
-                        ptlrpc_save_lock(req,
-                                         &oldrep->rs_locks[i],
-                                         oldrep->rs_modes[i]);
+                        ptlrpc_save_lock(req, &oldrep->rs_locks[i],
+                                         oldrep->rs_modes[i], 0);
                 oldrep->rs_nlocks = 0;
 
                 DEBUG_REQ(D_HA, req, "stole locks for");
@@ -1125,13 +1124,16 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti,
         }
 
         body = req_capsule_server_get(mti->mti_pill, &RMF_MDT_BODY);
+        mti->mti_attr.ma_need = MA_INODE;
+        mti->mti_attr.ma_valid = 0;
         rc = mo_attr_get(mti->mti_env, mdt_object_child(child), &mti->mti_attr);
         if (rc == -EREMOTE) {
                 /* object was created on remote server */
                 req->rq_status = rc;
                 body->valid |= OBD_MD_MDS;
         }
-        mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr, mdt_object_fid(child));
+        mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr,
+                           mdt_object_fid(child));
         mdt_object_put(mti->mti_env, child);
 }
 
@@ -1162,6 +1164,8 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti,
                 EXIT;
                 return;
         }
+        mti->mti_attr.ma_need = MA_INODE;
+        mti->mti_attr.ma_valid = 0;
         mo_attr_get(mti->mti_env, mdt_object_child(obj), &mti->mti_attr);
         mdt_pack_attr2body(mti, body, &mti->mti_attr.ma_attr,
                            mdt_object_fid(obj));
@@ -1184,13 +1188,6 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti,
         mdt_object_put(mti->mti_env, obj);
 }
 
-static void mdt_reconstruct_setxattr(struct mdt_thread_info *mti,
-                                     struct mdt_lock_handle *lhc)
-{
-        /* reply nothing */
-        req_capsule_shrink(mti->mti_pill, &RMF_EADATA, 0, RCL_SERVER);
-}
-
 typedef void (*mdt_reconstructor)(struct mdt_thread_info *mti,
                                   struct mdt_lock_handle *lhc);
 
@@ -1201,7 +1198,7 @@ static mdt_reconstructor reconstructors[REINT_MAX] = {
         [REINT_UNLINK]   = mdt_reconstruct_generic,
         [REINT_RENAME]   = mdt_reconstruct_generic,
         [REINT_OPEN]     = mdt_reconstruct_open,
-        [REINT_SETXATTR] = mdt_reconstruct_setxattr
+        [REINT_SETXATTR] = mdt_reconstruct_generic
 };
 
 void mdt_reconstruct(struct mdt_thread_info *mti,