Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-15754

Let lfsck skip inode if iget() returns ENOMEM



    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Lustre 2.16.0
    • 3
    • 9223372036854775807


      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)

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




            artem_blagodarenko Artem Blagodarenko
            artem_blagodarenko Artem Blagodarenko
            0 Vote for this issue
            3 Start watching this issue