[LU-15754] Let lfsck skip inode if iget() returns ENOMEM Created: 18/Apr/22  Updated: 06/Jun/22  Resolved: 06/Jun/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.16.0

Type: Bug Priority: Major
Reporter: Artem Blagodarenko (Inactive) Assignee: Artem Blagodarenko (Inactive)
Resolution: Fixed Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

After this 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()
    
            We don't want open-by-handle picking half-set-up in-core
    struct inode from e.g. mkdir() having failed halfway through.
    In other words, we don't want such inodes returned by iget_locked()
    on their way to extinction.  However, we can't just have them
    unhashed - otherwise open-by-handle immediately *after* that would've
    ended up creating a new in-core inode over the on-disk one that
    is in process of being freed right under us.
    
            Solution: new flag (I_CREATING) set by insert_inode_locked() and
    removed by unlock_new_inode() and a new primitive (discard_new_inode())
    to be used by such halfway-through-setup failure exits instead of
    unlock_new_inode() / iput() combinations.  That primitive unlocks new
    inode, but leaves I_CREATING in place.
    
            iget_locked() treats finding an I_CREATING inode as failure
    (-ESTALE, once we sort out the error propagation).
            insert_inode_locked() treats the same as instant -EBUSY.
            ilookup() treats those as icache miss.
    
    [Fix by Dan Carpenter <dan.carpenter@oracle.com> folded in]
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> 

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.

  /* The inode may be removed after bitmap searching, or the
   * file is new created without inode initialized yet.
                if (rc == -ENOENT || rc == -ESTALE)
                        RETURN(SCRUB_NEXT_CONTINUE); 

 As a solution we can skip an inode if -ENOMEM returned or fix this in the kernel code somehow.



 Comments   
Comment by Gerrit Updater [ 18/Apr/22 ]

"Artem Blagodarenko <artem.blagodarenko@hpe.com>" uploaded a new patch: https://review.whamcloud.com/47079
Subject: LU-15754 lfsck: skip an inode if iget() returns -ENOMEM
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 2784fab626f3480d2df75e6182fd5448ba7e7d92

Comment by Gerrit Updater [ 06/Jun/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/47079/
Subject: LU-15754 lfsck: skip an inode if iget() returns -ENOMEM
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 9523e99046b9d03ab1e5b75622e1f80e02fcc8e9

Comment by Peter Jones [ 06/Jun/22 ]

Landed for 2.16

Generated at Sat Feb 10 03:21:00 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.