]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
fs: change test in inode_insert5 for adding to the sb list
authorJeff Layton <jlayton@kernel.org>
Thu, 31 Mar 2022 20:29:00 +0000 (16:29 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 18 May 2022 11:59:08 +0000 (13:59 +0200)
commitd948934316e8a3e9ec9452688263b8f1f8034617
treea65f53fbd7e84872f3e67ce8804dfa1cde273a56
parenta0b6845f1bf96a6df1118806a058d0d4f13414b2
fs: change test in inode_insert5 for adding to the sb list

inode_insert5 currently looks at I_CREATING to decide whether to insert
the inode into the sb list. This test is a bit ambiguous, as I_CREATING
state is not directly related to that list.

This test is also problematic for some upcoming ceph changes to add
fscrypt support. We need to be able to allocate an inode using new_inode
and insert it into the hash later iff we end up using it, and doing that
now means that we double add it and corrupt the list.

What we really want to know in this test is whether the inode is already
in its superblock list, and then add it if it isn't. Have it test for
list_empty instead and ensure that we always initialize the list by
doing it in inode_init_once. It's only ever removed from the list with
list_del_init, so that should be sufficient.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/inode.c