Skip to content
  • Joel Fernandes (Google)'s avatar
    mm: shmem.c: Correctly annotate new inodes for lockdep · 946f8052
    Joel Fernandes (Google) authored
    commit b45d71fb upstream.
    
    Directories and inodes don't necessarily need to be in the same lockdep
    class.  For ex, hugetlbfs splits them out too to prevent false positives
    in lockdep.  Annotate correctly after new inode creation.  If its a
    directory inode, it will be put into a different class.
    
    This should fix a lockdep splat reported by syzbot:
    
    > ======================================================
    > WARNING: possible circular locking dependency detected
    > 4.18.0-rc8-next-20180810+ #36 Not tainted
    > ------------------------------------------------------
    > syz-executor900/4483 is trying to acquire lock:
    > 00000000d2bfc8fe (&sb->s_type->i_mutex_key#9){++++}, at: inode_lock
    > include/linux/fs.h:765 [inline]
    > 00000000d2bfc8fe (&sb->s_type->i_mutex_key#9){++++}, at:
    > shmem_fallocate+0x18b/0x12e0 mm/shmem.c:2602
    >
    > but task is already holding lock:
    > 0000000025208078 (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0xb4/0...
    946f8052