From: Di Wang Date: Wed, 27 Jan 2016 00:13:01 +0000 (-0500) Subject: LU-7716 mdt: No is_subdir check for same dir rename X-Git-Tag: 2.7.90~30 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a1345691437eaf8d3e20878722be5f28cab7fb98;hp=bb32a147e35f3339832e41e045de68f304ce18cc LU-7716 mdt: No is_subdir check for same dir rename 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 Change-Id: I03a4aff71b2c284197a8f78f6306568249162aca Reviewed-on: http://review.whamcloud.com/18172 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 5aac290..6694339 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -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