vfs: don't evict uninitialized inode
commite950564b97fd0f541b02eb207685d0746f5ecf29
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 24 Jul 2018 13:01:55 +0000 (24 15:01 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 3 Aug 2018 20:03:32 +0000 (3 16:03 -0400)
tree48519b6c40bc193c70f8b8e60849da7c57f50226
parenta6cbedfa8783b42b9272c05297865bdb501005cb
vfs: don't evict uninitialized inode

iput() ends up calling ->evict() on new inode, which is not yet initialized
by owning fs.  So use destroy_inode() instead.

Add to sb->s_inodes list only if inode is not in I_CREATING state (meaning
that it wasn't allocated with new_inode(), which already does the
insertion).

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 80ea09a002bf ("vfs: factor out inode_insert5()")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/inode.c