Whamcloud - gitweb
LU-17200 mdt: check object's locality 16/52716/9
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 16 Oct 2023 18:22:05 +0000 (21:22 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Feb 2024 07:12:07 +0000 (07:12 +0000)
remote object can disappear while we're getting an ldlm lock for
it. we can't check object's attributes before we're sure it does
exist. so check object's locality first.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I86ad0f3e7c38b0dce51a9fd836ba2293b210fe4f
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52716
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/mdt/mdt_handler.c

index 794ed24..19e05d0 100644 (file)
@@ -2465,8 +2465,13 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                        ldlm_set_ast_sent(lock);
                }
 
-               if (S_ISREG(lu_object_attr(&child->mot_obj)) &&
-                   !mdt_object_remote(child) && child != parent) {
+               /*
+                * check whether the object is remote as we can't
+                * really check attributes w/o explicit check for
+                * object's existence first.
+                */
+               if (!mdt_object_remote(child) && child != parent &&
+                   S_ISREG(lu_object_attr(&child->mot_obj))) {
                        mdt_object_put(info->mti_env, child);
                        rc = mdt_pack_size2body(info, child_fid,
                                                &lhc->mlh_reg_lh);