From: Jeff Layton Date: Sun, 18 Feb 2024 13:33:28 +0000 (-0500) Subject: filelock: fix deadlock detection in POSIX locking X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=14786d949a3b8cf00cc32456363b7db22894a0e6;p=linux.git filelock: fix deadlock detection in POSIX locking The FL_POSIX check in __locks_insert_block was inadvertantly broken recently and is now inserting only OFD locks instead of only legacy POSIX locks. This breaks deadlock detection in POSIX locks, and may also be the root cause of a performance regression noted by the kernel test robot. Restore the proper sense of the test. Fixes: b6be3714005c ("filelock: convert __locks_insert_block, conflict and deadlock checks to use file_lock_core") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202402181229.f8147f40-oliver.sang@intel.com Signed-off-by: Jeff Layton Link: https://lore.kernel.org/r/20240218-flsplit4-v1-1-26454fc090f2@kernel.org Reviewed-by: NeilBrown Signed-off-by: Christian Brauner --- diff --git a/fs/locks.c b/fs/locks.c index 26d52ef5314a2..90c8746874ded 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -812,7 +812,7 @@ new_blocker: list_add_tail(&waiter->flc_blocked_member, &blocker->flc_blocked_requests); - if ((blocker->flc_flags & (FL_POSIX|FL_OFDLCK)) == (FL_POSIX|FL_OFDLCK)) + if ((blocker->flc_flags & (FL_POSIX|FL_OFDLCK)) == FL_POSIX) locks_insert_global_blocked(waiter); /* The requests in waiter->flc_blocked are known to conflict with