From: wang di Date: Thu, 15 May 2014 13:15:56 +0000 (-0700) Subject: LU-5069 mds: check if the object exist before subdir check X-Git-Tag: 2.5.60~35 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9c255853668ed64dfdd8eec9b157f05c2b7832ed LU-5069 mds: check if the object exist before subdir check In mdt_rename_sanity, it should check whether the object exist before mdo_is_subdir, otherwise the un-exist object will cause LBUG in mdd_is_subdir. Signed-off-by: wang di Change-Id: I862392ca6a758bcf63406b2a8df9306d0c531aa5 Reviewed-on: http://review.whamcloud.com/10340 Tested-by: Jenkins Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 8cb8cb7..6141ec9 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -1306,6 +1306,13 @@ static int mdt_rename_sanity(struct mdt_thread_info *info, LASSERT(fid_is_sane(&dst_fid)); dst = mdt_object_find(info->mti_env, info->mti_mdt, &dst_fid); if (!IS_ERR(dst)) { + /* XXX: this object might not be protected by LDLM lock + * here, (see mdt_rename_parents_lock), but LOHA_EXISTS + * will not change once it is being set, but LFSCK might + * change this later.(LU-5069) */ + if (!mdt_object_exists(dst)) + RETURN(-ESTALE); + rc = mdo_is_subdir(info->mti_env, mdt_object_child(dst), fid, &dst_fid);