Whamcloud - gitweb
LU-1187 mdt: return lock to client for remote dir.
authorwangdi <di.wang@whamcloud.com>
Fri, 1 Nov 2013 12:20:10 +0000 (05:20 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 28 Jan 2013 16:48:30 +0000 (11:48 -0500)
In mdt_reint_open, MDT should return LOOKUP inodebit lock for
remote directory.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: Iaa7c6a13b71b627c5792f4b28bb3c5520b2132e5
Reviewed-on: http://review.whamcloud.com/5026
Tested-by: Hudson
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_open.c

index f370e5e..4d87ae4 100644 (file)
@@ -1212,7 +1212,8 @@ static void mdt_object_open_unlock(struct mdt_thread_info *info,
                mdt_object_unlock(info, obj, ll, 1);
        }
 
-       if (ibits == 0)
+       /* Cross-ref case, the lock should be returned to the client */
+       if (ibits == 0 || rc == -EREMOTE)
                return;
 
        if (!(open_flags & MDS_OPEN_LOCK) && !(ibits & MDS_INODELOCK_LAYOUT)) {
@@ -1603,6 +1604,8 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                         repbody->valid |= (OBD_MD_FLID | OBD_MD_MDS);
                         if (rc != 0)
                                 result = rc;
+                       else
+                               result = -EREMOTE;
                         GOTO(out_child, result);
                 }
         }
@@ -1643,8 +1646,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
         }
         EXIT;
 out_child:
-       mdt_object_open_unlock(info, child, lhc, ibits,
-                               result == -EREMOTE ? 0 : result);
+       mdt_object_open_unlock(info, child, lhc, ibits, result);
         mdt_object_put(info->mti_env, child);
 out_parent:
         mdt_object_unlock_put(info, parent, lh, result || !created);