NeilBrown 52d3370e80 nfsd: drop st_mutex before calling move_to_close_lru()
[ Upstream commit 56c35f43eef013579c76c007ba1f386d8c2cac14 ]

move_to_close_lru() is currently called with ->st_mutex held.
This can lead to a deadlock as move_to_close_lru() waits for sc_count to
drop to 2, and some threads holding a reference might be waiting for the
mutex.  These references will never be dropped so sc_count will never
reach 2.

There can be no harm in dropping ->st_mutex before
move_to_close_lru() because the only place that takes the mutex is
nfsd4_lock_ol_stateid(), and it quickly aborts if sc_type is
NFS4_CLOSED_STID, which it will be before move_to_close_lru() is called.

See also
 https://lore.kernel.org/lkml/4dd1fe21e11344e5969bb112e954affb@jd.com/T/
where this problem was raised but not successfully resolved.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-16 13:23:25 +02:00
..
2021-09-22 11:48:02 +02:00
2024-04-13 12:50:05 +02:00
2024-06-16 13:23:24 +02:00
2023-09-23 10:48:12 +02:00
2023-09-23 10:48:17 +02:00
2022-06-14 16:59:24 +02:00
2024-04-13 12:50:14 +02:00
2023-01-18 11:30:40 +01:00
2021-12-14 10:18:07 +01:00