Whamcloud - gitweb
LU-6998 mdt: do not lock stripe0 object 73/15973/5
authorwang di <di.wang@intel.com>
Tue, 11 Aug 2015 12:15:17 +0000 (05:15 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 10 Sep 2015 01:03:53 +0000 (01:03 +0000)
Do not lock stripe 0 for migrating object in
mdt_lock_slaves(), because stripe0 and master
object are the same object, which has been locked
before mdt_lock_slaves().

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I8322061b9b8d310a17fdd6bd8265a3781b14dc9d
Reviewed-on: http://review.whamcloud.com/15973
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_reint.c

index 652dba4..defdb39 100644 (file)
@@ -470,14 +470,17 @@ static int mdt_lock_slaves(struct mdt_thread_info *mti, struct mdt_object *obj,
        if (le32_to_cpu(lmv->lmv_magic) != LMV_MAGIC_V1)
                RETURN(-EINVAL);
 
-       /* Sigh, 0_stripe and master object are different
-        * object, though they are in the same MDT, to avoid
-        * adding osd_object_lock here, so we will enqueue the
-        * stripe0 lock in MDT0 for now */
        fid_le_to_cpu(fid, &lmv->lmv_stripe_fids[0]);
-       *s0_objp = mdt_object_find_lock(mti, fid, s0_lh, ibits);
-       if (IS_ERR(*s0_objp))
-               RETURN(PTR_ERR(*s0_objp));
+       if (!lu_fid_eq(fid, mdt_object_fid(obj))) {
+               /* Except migrating object, whose 0_stripe and master
+                * object are the same object, 0_stripe and master
+                * object are different, though they are in the same
+                * MDT, to avoid adding osd_object_lock here, so we
+                * will enqueue the stripe0 lock in MDT0 for now */
+               *s0_objp = mdt_object_find_lock(mti, fid, s0_lh, ibits);
+               if (IS_ERR(*s0_objp))
+                       RETURN(PTR_ERR(*s0_objp));
+       }
 
        memset(einfo, 0, sizeof(*einfo));
        einfo->ei_type = LDLM_IBITS;