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>
/* Check if @mtgtdir is subdir of @mold, before locking child
* to avoid reverse locking. */
/* 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 */
tgt_vbr_obj_set(info->mti_env, mdt_obj2dt(mold));
/* save version after locking */
/* Check if @msrcdir is subdir of @mnew, before locking child
* to avoid reverse locking. */
/* 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
/* We used to acquire MDS_INODELOCK_FULL here but we
* can't do this now because a running HSM restore on