Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Thu, 21 Sep 2006 07:52:29 +0000 (07:52 +0000)
committerwangdi <wangdi>
Thu, 21 Sep 2006 07:52:29 +0000 (07:52 +0000)
1)set the correct lock bit for cross-ref object.
2)in lmv_remote_intent, we should cancel the UPDATE lock, since we did not
  set l_ast_data for this lock, the inode page will not be truncated when revoked
  this lock, which will leave some stale dir page.

lustre/lmv/lmv_intent.c
lustre/mdt/mdt_handler.c

index af16767..fb38c41 100644 (file)
 
 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,
+        if (it->d.lustre.it_lock_mode != 0) {
+                ldlm_lock_decref_and_cancel((void *)&it->d.lustre.it_lock_handle,
                                  it->d.lustre.it_lock_mode);
+        }
 }
 
 int lmv_intent_remote(struct obd_export *exp, void *lmm,
index 50dda2b..4e84a64 100644 (file)
@@ -153,6 +153,11 @@ void mdt_set_disposition(struct mdt_thread_info *info,
                 rep->lock_policy_res1 |= flag;
 }
 
+static int mdt_is_remote_object(struct mdt_object *o)
+{
+       return (o->mot_header.loh_attr & LOHA_REMOTE); 
+}        
+
 
 static int mdt_getstatus(struct mdt_thread_info *info)
 {
@@ -478,6 +483,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                 } else {
                         mdt_lock_handle_init(lhc);
                         lhc->mlh_mode = LCK_CR;
+                        if (mdt_is_remote_object(child))
+                                child_bits &= ~MDS_INODELOCK_LOOKUP;
                         rc = mdt_object_lock(info, child, lhc, child_bits);
                 }
                 if (rc == 0) {
@@ -1242,6 +1249,16 @@ struct mdt_object *mdt_object_find_lock(struct mdt_thread_info *info,
         if (!IS_ERR(o)) {
                 int rc;
 
+                if (mdt_is_remote_object(o)) { 
+                        /* FIXME: For remote object we can only give 
+                         * LOOKUP_lock, maybe we should not put it 
+                         * here, but only we know it is remote, after 
+                         * we got the object currently, maybe we need
+                         * a way to know remote by fid on MDS. */
+                        ibits &= ~MDS_INODELOCK_UPDATE;
+                        ibits |= MDS_INODELOCK_LOOKUP;
+                }
+
                 rc = mdt_object_lock(info, o, lh, ibits);
                 if (rc != 0) {
                         mdt_object_put(info->mti_ctxt, o);