linux-stable/fs/gfs2
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 486408d690 ("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
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
acl.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
aops.c gfs2: Don't release and reacquire local statfs bh 2021-08-20 09:03:46 -05:00
aops.h
bmap.c gfs2: Fix length of holes reported at end-of-file 2021-11-06 10:25:45 +01:00
bmap.h
dentry.c
dir.c
dir.h
export.c
file.c gfs2: Prevent endless loops in gfs2_file_buffered_write 2021-11-10 18:22:37 +01:00
gfs2.h
glock.c gfs2: Fix remote demote of weak glock holders 2021-12-02 12:41:09 +01:00
glock.h gfs2: fix GL_SKIP node_scope problems 2021-10-25 08:42:19 +02:00
glops.c gfs2: remove RDF_UPTODATE flag 2021-10-25 08:42:19 +02:00
glops.h
incore.h gfs2: remove RDF_UPTODATE flag 2021-10-25 08:42:19 +02:00
inode.c gfs2: gfs2_create_inode rework 2021-12-02 12:41:10 +01:00
inode.h
Kconfig
lock_dlm.c gfs2: Don't call dlm after protocol is unmounted 2021-08-20 09:03:46 -05:00
log.c gfs2: tiny cleanup in gfs2_log_reserve 2021-08-19 12:31:17 -05:00
log.h
lops.c gfs2: be more verbose replaying invalid rgrp blocks 2021-08-19 12:31:17 -05:00
lops.h
main.c
Makefile
meta_io.c gfs2: don't stop reads while withdraw in progress 2021-08-20 09:03:46 -05:00
meta_io.h
ops_fstype.c gfs2: Mark journal inodes as "don't cache" 2021-08-20 09:03:46 -05:00
quota.c
quota.h
recovery.c
recovery.h
rgrp.c gfs2: remove RDF_UPTODATE flag 2021-10-25 08:42:19 +02:00
rgrp.h gfs2: change go_lock to go_instantiate 2021-10-25 08:42:18 +02:00
super.c gfs2: release iopen glock early in evict 2021-11-06 10:25:31 +01:00
super.h gfs2: Don't release and reacquire local statfs bh 2021-08-20 09:03:46 -05:00
sys.c
sys.h
trace_gfs2.h gfs2: Remove 'first' trace_gfs2_promote argument 2021-10-25 08:42:19 +02:00
trans.c
trans.h
util.c gfs2: dump glocks from gfs2_consist_OBJ_i 2021-10-25 08:42:18 +02:00
util.h gfs2: don't stop reads while withdraw in progress 2021-08-20 09:03:46 -05:00
xattr.c
xattr.h