From 7dd122f16f28f8a546f454468c028b014381d2c6 Mon Sep 17 00:00:00 2001 From: Mikhal Pershin Date: Mon, 13 Nov 2017 13:18:36 +0300 Subject: [PATCH] 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 --- lustre/mdt/mdt_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); -- 1.8.3.1