Whamcloud - gitweb
LU-15754 lfsck: skip an inode if iget() returns -ENOMEM 79/47079/2
authorArtem Blagodarenko <artem.blagodarenko@gmail.com>
Wed, 13 Apr 2022 20:01:58 +0000 (16:01 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 6 Jun 2022 06:27:39 +0000 (06:27 +0000)
After the change
commit c2b6d621c4ffe9936adf7a55c8b1c769672c306f
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Thu Jun 28 15:53:17 2018 -0400 new primitive: discard_new_inode()

find_inode_fast() returns -ESTALE, but iget_locked() replaces
it to the NULL and finally ldiskfs_inode_attach_jinode()
returns -ENOMEM.

So this check in osd_iit_iget() doesn't work.

if (rc == -ENOENT || rc == -ESTALE)
    RETURN(SCRUB_NEXT_CONTINUE);

As a solution we can skip an inode if -ENOMEM returned

Hpe-bug-id: LUS-10833
Change-Id: Icb30610e46e2ab899a512761b63aea248c4f2ada
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-on: https://review.whamcloud.com/47079
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_scrub.c

index 0605c31..abc3295 100644 (file)
@@ -608,8 +608,14 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev,
        if (IS_ERR(inode)) {
                rc = PTR_ERR(inode);
                /* The inode may be removed after bitmap searching, or the
-                * file is new created without inode initialized yet. */
-               if (rc == -ENOENT || rc == -ESTALE)
+                * file is new created without inode initialized yet.
+                * LU-15754: After "new primitive: discard_new_inode()" change
+                * in the kernel find_inode_fast() returns -ESTALE, but
+                * iget_locked replaces it to the NULL and finally
+                * ldiskfs_inode_attach_jinode() returns -ENOMEM
+                * Let's skip an inode if -ENOMEM returned.
+                */
+               if (rc == -ENOENT || rc == -ESTALE || rc == -ENOMEM)
                        RETURN(SCRUB_NEXT_CONTINUE);
 
                CDEBUG(D_LFSCK, "%s: fail to read inode, ino# = %u: "