Andreas Gruenbacher 3d36e57ff7 gfs2: gfs2_create_inode rework
When gfs2_lookup_by_inum() calls gfs2_inode_lookup() for an uncached
inode, gfs2_inode_lookup() will place a new tentative inode into the
inode cache before verifying that there is a valid inode at the given
address.  This can race with gfs2_create_inode() which doesn't check for
duplicates inodes.  gfs2_create_inode() will try to assign the new inode
to the corresponding inode glock, and glock_set_object() will complain
that the glock is still in use by gfs2_inode_lookup's tentative inode.

We noticed this bug after adding commit 486408d690e1 ("gfs2: Cancel
remote delete work asynchronously") which allowed delete_work_func() to
race with gfs2_create_inode(), but the same race exists for
open-by-handle.

Fix that by switching from insert_inode_hash() to
insert_inode_locked4(), which does check for duplicate inodes.  We know
we've just managed to to allocate the new inode, so an inode tentatively
created by gfs2_inode_lookup() will eventually go away and
insert_inode_locked4() will always succeed.

In addition, don't flush the inode glock work anymore (this can now only
make things worse) and clean up glock_{set,clear}_object for the inode
glock somewhat.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
2021-12-02 12:41:10 +01:00
..
2019-07-03 14:45:18 +02:00
2021-06-29 10:56:51 +02:00
2021-06-29 10:56:51 +02:00
2021-10-25 08:42:19 +02:00
2021-10-25 08:42:19 +02:00
2021-10-25 08:42:19 +02:00
2021-12-02 12:41:10 +01:00
2021-04-29 10:33:35 -07:00
2021-08-19 12:31:17 -05:00
2021-06-29 10:56:51 +02:00
2021-10-25 08:42:19 +02:00
2021-10-25 08:42:18 +02:00
2021-04-08 15:07:21 +02:00