kernel-hacking-2024-linux-s.../fs/gfs2
Bob Peterson d99724c3c3 gfs2: Close timing window with GLF_INVALIDATE_IN_PROGRESS
This patch closes a timing window in which two processes compete
and overlap in the execution of do_xmote for the same glock:

             Process A                              Process B
   ------------------------------------   -----------------------------
1. Grabs gl_lockref and calls do_xmote
2.                                        Grabs gl_lockref but is blocked
3. Sets GLF_INVALIDATE_IN_PROGRESS
4. Unlocks gl_lockref
5.                                        Calls do_xmote
6. Call glops->go_sync
7. test_and_clear_bit GLF_DIRTY
8. Call gfs2_log_flush                    Call glops->go_sync
9. (slow IO, so it blocks a long time)    test_and_clear_bit GLF_DIRTY
                                          It's not dirty (step 7) returns
10.                                       Tests GLF_INVALIDATE_IN_PROGRESS
11.                                       Calls go_inval (rgrp_go_inval)
12.                                       gfs2_rgrp_relse does brelse
13.                                       truncate_inode_pages_range
14.                                       Calls lm_lock UN

In step 14 we've just told dlm to give the glock to another node
when, in fact, process A has not finished the IO and synced all
buffer_heads to disk and make sure their revokes are done.

This patch fixes the problem by changing the GLF_INVALIDATE_IN_PROGRESS
to use test_and_set_bit, and if the bit is already set, process B just
ignores it and trusts that process A will do the do_xmote in the proper
order.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
2019-11-15 18:21:59 +01:00
..
acl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
acl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
aops.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
aops.h gfs2: mark stuffed_readpage static 2019-07-03 14:45:18 +02:00
bmap.c gfs2: Improve mmap write vs. punch_hole consistency 2019-11-07 21:01:04 +01:00
bmap.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
dentry.c gfs2: untangle the logic in gfs2_drevalidate 2019-09-03 09:42:41 +02:00
dir.c gfs2: Delete an unnecessary check before brelse() 2019-09-04 20:22:17 +02:00
dir.h gfs2: Delete an unnecessary check before brelse() 2019-09-04 20:22:17 +02:00
export.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
file.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
gfs2.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
glock.c gfs2: Close timing window with GLF_INVALIDATE_IN_PROGRESS 2019-11-15 18:21:59 +01:00
glock.h gfs2: Use async glocks for rename 2019-09-04 20:22:17 +02:00
glops.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
glops.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
incore.h Merge branch 'work.mount3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-09-24 12:33:34 -07:00
inode.c gfs2: removed unnecessary semicolon 2019-10-30 12:17:04 +01:00
inode.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
Kconfig
lock_dlm.c gfs2: Fix recovery slot bumping 2019-09-03 09:42:41 +02:00
log.c gfs2: fix infinite loop in gfs2_ail1_flush on io error 2019-11-14 19:46:43 +01:00
log.h gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-11-14 16:51:00 +01:00
lops.c gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-11-14 16:51:00 +01:00
lops.h gfs2: Remove active journal side effect from gfs2_write_log_header 2019-11-12 15:17:53 +01:00
main.c SPDX update for 5.2-rc4 2019-06-08 12:52:42 -07:00
Makefile
meta_io.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
meta_io.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
ops_fstype.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
quota.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
quota.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
recovery.c gfs2: Remove active journal side effect from gfs2_write_log_header 2019-11-12 15:17:53 +01:00
recovery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
rgrp.c gfs2: Fix possible fs name overflows 2019-09-03 09:42:41 +02:00
rgrp.h gfs2: dump fsid when dumping glock problems 2019-06-27 21:27:43 +02:00
super.c gfs2: Abort gfs2_freeze if io error is seen 2019-11-15 17:57:30 +01:00
super.h gfs2: Convert gfs2 to fs_context 2019-09-18 22:47:05 -04:00
sys.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
sys.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
trace_gfs2.h
trans.c gfs2: fix glock reference problem in gfs2_trans_remove_revoke 2019-11-14 16:51:00 +01:00
trans.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
util.c gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
util.h gfs2: Introduce function gfs2_withdrawn 2019-11-14 19:46:18 +01:00
xattr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00
xattr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 398 2019-06-05 17:37:12 +02:00