From: Bobi Jam Date: Thu, 17 Oct 2013 07:25:35 +0000 (+0800) Subject: LU-4106 mdt: avoid recursive lu_object_find an object X-Git-Tag: 2.5.52~56 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=70daa58415fb51ebff0dc67d2ab42ad00134bec6 LU-4106 mdt: avoid recursive lu_object_find an object LU-3240 (commit 762f2114d282a98ebfa4dbbeea9298a8088ad24e) set parent dir fid the same as child fid in getattr by fid case we should not lu_object_find() the object again, could lead to hung if there is a concurrent unlink destroyed the object. Signed-off-by: Bobi Jam Change-Id: I75256c0fa684877cbd2e1f36f8ab2ac3faab2989 Reviewed-on: http://review.whamcloud.com/7990 Tested-by: Jenkins Reviewed-by: John L. Hammond Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 74a0d80..ffad80d 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1358,11 +1358,22 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS); } - /* - *step 3: find the child object by fid & lock it. - * regardless if it is local or remote. - */ - child = mdt_object_find(info->mti_env, info->mti_mdt, child_fid); + /* + *step 3: find the child object by fid & lock it. + * regardless if it is local or remote. + * + *Note: LU-3240 (commit 762f2114d282a98ebfa4dbbeea9298a8088ad24e) + * set parent dir fid the same as child fid in getattr by fid case + * we should not lu_object_find() the object again, could lead + * to hung if there is a concurrent unlink destroyed the object. + */ + if (lu_fid_eq(mdt_object_fid(parent), child_fid)) { + mdt_object_get(info->mti_env, parent); + child = parent; + } else { + child = mdt_object_find(info->mti_env, info->mti_mdt, + child_fid); + } if (unlikely(IS_ERR(child))) GOTO(out_parent, rc = PTR_ERR(child));