From: Mikhal Pershin Date: Mon, 13 Nov 2017 10:18:36 +0000 (+0300) Subject: LU-3285 mdt: get lu_object_attr for existent object X-Git-Tag: 2.10.56~33 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7dd122f16f28f8a546f454468c028b014381d2c6;p=fs%2Flustre-release.git LU-3285 mdt: get lu_object_attr for existent object In mdt_punch_hdl() lu_object_attr() may be taken for non-existent object with LBUG() as result. Take lu_object_attr() after mdt_object_exists()check. Test-Parameters: mdssizegb=20 testlist=sanity-dom,dom-performance Signed-off-by: Mikhal Pershin Change-Id: If1181caa94b28cf1f251f57fa6f7102dc40c329d Reviewed-on: https://review.whamcloud.com/30057 Tested-by: Jenkins Reviewed-by: Fan Yong Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_io.c b/lustre/mdt/mdt_io.c index abe7bab..1e0da6a 100644 --- a/lustre/mdt/mdt_io.c +++ b/lustre/mdt/mdt_io.c @@ -550,6 +550,9 @@ int mdt_punch_hdl(struct tgt_session_info *tsi) if (IS_ERR(mo)) GOTO(out_unlock, rc = PTR_ERR(mo)); + if (!mdt_object_exists(mo)) + GOTO(out_put, rc = -ENOENT); + /* Shouldn't happen on dirs */ if (S_ISDIR(lu_object_attr(&mo->mot_obj))) { rc = -EPERM; @@ -559,9 +562,6 @@ int mdt_punch_hdl(struct tgt_session_info *tsi) } mdt_dom_write_lock(mo); - if (!mdt_object_exists(mo)) - GOTO(out_put, rc = -ENOENT); - dob = mdt_obj2dt(mo); la_from_obdo(la, oa, OBD_MD_FLMTIME | OBD_MD_FLATIME | OBD_MD_FLCTIME);