ext4: fix ref counting for ea_inode
authorTahsin Erdogan <tahsin@google.com>
Thu, 22 Jun 2017 01:39:38 +0000 (21:39 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 Jun 2017 01:39:38 +0000 (21:39 -0400)
The ref count on ea_inode is incremented by
ext4_xattr_inode_orphan_add() which is supposed to be decremented by
ext4_xattr_inode_array_free(). The decrement is conditioned on whether
the ea_inode is currently on the orphan list. However, the orphan list
addition only happens when journaling is enabled. In non-journaled case,r
we fail to release the ref count causing an error message like below.

"VFS: Busy inodes after unmount of sdb. Self-destruct in 5 seconds.
Have a nice day..."

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/xattr.c

index a29e682..53698f8 100644 (file)
@@ -2096,8 +2096,7 @@ ext4_xattr_inode_array_free(struct inode *inode,
                if (err)
                        continue;
                /* for inode's i_count get from ext4_xattr_delete_inode */
-               if (!list_empty(&EXT4_I(ea_inode)->i_orphan))
-                       iput(ea_inode);
+               iput(ea_inode);
                clear_nlink(ea_inode);
                iput(ea_inode);
        }