Whamcloud - gitweb
LU-7716 mdt: No is_subdir check for same dir rename 72/18172/2
authorDi Wang <di.wang@intel.com>
Wed, 27 Jan 2016 00:13:01 +0000 (19:13 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 4 Feb 2016 04:45:12 +0000 (04:45 +0000)
In rename, if the source and target are in the same
directory, then it does not need is_subdir check.

Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: I03a4aff71b2c284197a8f78f6306568249162aca
Reviewed-on: http://review.whamcloud.com/18172
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_reint.c

index 5aac290..6694339 100644 (file)
@@ -1950,9 +1950,11 @@ relock:
 
        /* Check if @mtgtdir is subdir of @mold, before locking child
         * to avoid reverse locking. */
-       rc = mdt_is_subdir(info, mtgtdir, old_fid);
-       if (rc)
-               GOTO(out_put_old, rc);
+       if (mtgtdir != msrcdir) {
+               rc = mdt_is_subdir(info, mtgtdir, old_fid);
+               if (rc)
+                       GOTO(out_put_old, rc);
+       }
 
        tgt_vbr_obj_set(info->mti_env, mdt_obj2dt(mold));
        /* save version after locking */
@@ -2031,9 +2033,11 @@ relock:
 
                /* Check if @msrcdir is subdir of @mnew, before locking child
                 * to avoid reverse locking. */
-               rc = mdt_is_subdir(info, msrcdir, new_fid);
-               if (rc)
-                       GOTO(out_unlock_old, rc);
+               if (mtgtdir != msrcdir) {
+                       rc = mdt_is_subdir(info, msrcdir, new_fid);
+                       if (rc)
+                               GOTO(out_unlock_old, rc);
+               }
 
                /* We used to acquire MDS_INODELOCK_FULL here but we
                 * can't do this now because a running HSM restore on