Commit 56c35f4
nfsd: drop st_mutex before calling move_to_close_lru()
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>1 parent eec7620 commit 56c35f4
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7357 | 7357 | | |
7358 | 7358 | | |
7359 | 7359 | | |
7360 | | - | |
| 7360 | + | |
7361 | 7361 | | |
7362 | 7362 | | |
7363 | 7363 | | |
| |||
7374 | 7374 | | |
7375 | 7375 | | |
7376 | 7376 | | |
| 7377 | + | |
7377 | 7378 | | |
7378 | 7379 | | |
7379 | 7380 | | |
7380 | | - | |
7381 | | - | |
| 7381 | + | |
7382 | 7382 | | |
7383 | 7383 | | |
7384 | 7384 | | |
| |||
7394 | 7394 | | |
7395 | 7395 | | |
7396 | 7396 | | |
| 7397 | + | |
7397 | 7398 | | |
7398 | 7399 | | |
7399 | 7400 | | |
| |||
7418 | 7419 | | |
7419 | 7420 | | |
7420 | 7421 | | |
7421 | | - | |
| 7422 | + | |
7422 | 7423 | | |
| 7424 | + | |
| 7425 | + | |
7423 | 7426 | | |
7424 | 7427 | | |
7425 | 7428 | | |
| |||
0 commit comments