From a1345691437eaf8d3e20878722be5f28cab7fb98 Mon Sep 17 00:00:00 2001 From: Di Wang Date: Tue, 26 Jan 2016 19:13:01 -0500 Subject: [PATCH] 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 --- lustre/mdt/mdt_reint.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 -- 1.8.3.1