linux-stable/fs/gfs2
Bob Peterson 66fa9912ec gfs2: conversion deadlock do_promote bypass
Consider the following case:
1. A glock is held in shared mode.
2. A process requests the glock in exclusive mode (rename).
3. Before the lock is granted, more processes (read / ls) request the
   glock in shared mode again.
4. gfs2 sends a request to dlm for the lock in exclusive mode because
   that holder is at the head of the queue.
5. Somehow the dlm request gets canceled, so dlm sends us back a
   response with state == LM_ST_SHARED and LM_OUT_CANCELED.  So at that
   point, the glock is still held in shared mode.
6. finish_xmote gets called to process the response from dlm. It detects
   that the glock is not in the requested mode and no demote is in
   progress, so it moves the canceled holder to the tail of the queue
   and finds the new holder at the head of the queue.  That holder is
   requesting the glock in shared mode.
7. finish_xmote calls do_xmote to transition the glock into shared mode,
   but the glock is already in shared mode and so do_xmote complains
   about that with:
	GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);

Instead, in finish_xmote, after moving the canceled holder to the tail
of the queue, check if any new holders can be granted.  Only call
do_xmote to repeat the dlm request if the holder at the head of the
queue is requesting the glock in a mode that is incompatible with the
mode the glock is currently held in.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
2023-09-05 15:58:16 +02:00
..
acl.c fs: port acl to mnt_idmap 2023-01-19 09:24:28 +01:00
acl.h fs: port ->set_acl() to pass mnt_idmap 2023-01-19 09:24:27 +01:00
aops.c gfs2: increase usage of folio_next_index() helper 2023-09-05 15:58:15 +02:00
aops.h gfs2: support ludicrously large folios in gfs2_trans_add_databufs() 2023-06-19 16:19:30 -07:00
bmap.c gfs: Don't use GFP_NOFS in gfs2_unstuff_dinode 2023-09-05 15:58:16 +02:00
bmap.h gfs2: Eliminate gfs2_trim_blocks 2023-04-18 14:40:12 +02:00
dentry.c Reinstate "GFS2: free disk inode which is deleted by remote node -V2" 2023-03-23 19:37:56 +01:00
dir.c gfs2 fixes 2022-08-06 14:44:49 -07:00
dir.h
export.c Change calling conventions for filldir_t 2022-08-17 17:25:04 -04:00
file.c gfs2: Don't use filemap_splice_read 2023-08-07 18:42:04 +02:00
gfs2.h
glock.c gfs2: conversion deadlock do_promote bypass 2023-09-05 15:58:16 +02:00
glock.h gfs2: Remove LM_FLAG_PRIORITY flag 2023-09-05 15:58:16 +02:00
glops.c gfs: Get rid of unnucessary locking in inode_go_dump 2023-07-03 22:30:47 +02:00
glops.h
incore.h gfs: Get rid of unnucessary locking in inode_go_dump 2023-07-03 22:30:47 +02:00
inode.c gfs2: Use mapping->gfp_mask for metadata inodes 2023-09-05 15:58:15 +02:00
inode.h fs: port ->permission() to pass mnt_idmap 2023-01-19 09:24:28 +01:00
Kconfig
lock_dlm.c gfs2: Remove LM_FLAG_PRIORITY flag 2023-09-05 15:58:16 +02:00
log.c gfs2: Replace sd_freeze_state with SDF_FROZEN flag 2023-07-03 22:30:23 +02:00
log.h fs/gfs2: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:32 -06:00
lops.c gfs2: Use mapping->gfp_mask for metadata inodes 2023-09-05 15:58:15 +02:00
lops.h fs/gfs2: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:32 -06:00
main.c gfs2: Register fs after creating workqueues 2022-09-20 17:53:54 +02:00
Makefile
meta_io.c gfs2: replace obvious uses of b_page with b_folio 2023-01-18 17:12:40 -08:00
meta_io.h gfs2: Use container_of() for gfs2_glock(aspace) 2022-05-24 21:29:14 +02:00
ops_fstype.c gfs2 fixes 2023-07-04 11:45:16 -07:00
quota.c gfs2: Use mapping->gfp_mask for metadata inodes 2023-09-05 15:58:15 +02:00
quota.h
recovery.c gfs2: Replace sd_freeze_state with SDF_FROZEN flag 2023-07-03 22:30:23 +02:00
recovery.h
rgrp.c gfs2: Update rl_unlinked before releasing rgrp lock 2023-06-06 18:35:06 +02:00
rgrp.h Merge part of branch 'for-next.instantiate' into for-next 2022-08-05 18:37:03 +02:00
super.c gfs2: gfs2_freeze_lock_shared cleanup 2023-07-03 22:30:26 +02:00
super.h gfs2: Rework freeze / thaw logic 2023-07-03 22:25:02 +02:00
sys.c gfs2: Replace sd_freeze_state with SDF_FROZEN flag 2023-07-03 22:30:23 +02:00
sys.h
trace_gfs2.h gfs2: Remove 'first' trace_gfs2_promote argument 2021-10-25 08:42:19 +02:00
trans.c gfs2: Fix freeze consistency check in gfs2_trans_add_meta 2023-08-07 18:40:51 +02:00
trans.h
util.c gfs2: Add quota_change type 2023-07-03 22:30:48 +02:00
util.h gfs2: gfs2_freeze_lock_shared cleanup 2023-07-03 22:30:26 +02:00
xattr.c fs: drop unused posix acl handlers 2023-03-06 09:57:12 +01:00
xattr.h