Commit eec7620
nfsd: replace rp_mutex to avoid deadlock in move_to_close_lru()
move_to_close_lru() waits for sc_count to become zero while holding
rp_mutex. This can deadlock if another thread holds a reference and is
waiting for rp_mutex.
By the time we get to move_to_close_lru() the openowner is unhashed and
cannot be found any more. So code waiting for the mutex can safely
retry the lookup if move_to_close_lru() has started.
So change rp_mutex to an atomic_t with three states:
RP_UNLOCK - state is still hashed, not locked for reply
RP_LOCKED - state is still hashed, is locked for reply
RP_UNHASHED - state is not hashed, no code can get a lock.
Use wait_var_event() to wait for either a lock, or for the owner to be
unhashed. In the latter case, retry the lookup.
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 b3f0373 commit eec7620
2 files changed
Lines changed: 32 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4650 | 4650 | | |
4651 | 4651 | | |
4652 | 4652 | | |
| 4653 | + | |
| 4654 | + | |
| 4655 | + | |
| 4656 | + | |
| 4657 | + | |
| 4658 | + | |
4653 | 4659 | | |
4654 | 4660 | | |
4655 | 4661 | | |
4656 | 4662 | | |
4657 | 4663 | | |
4658 | | - | |
| 4664 | + | |
4659 | 4665 | | |
4660 | 4666 | | |
4661 | | - | |
4662 | | - | |
| 4667 | + | |
| 4668 | + | |
4663 | 4669 | | |
4664 | 4670 | | |
4665 | | - | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
4666 | 4676 | | |
4667 | 4677 | | |
| 4678 | + | |
4668 | 4679 | | |
4669 | 4680 | | |
4670 | 4681 | | |
| |||
4673 | 4684 | | |
4674 | 4685 | | |
4675 | 4686 | | |
4676 | | - | |
| 4687 | + | |
| 4688 | + | |
4677 | 4689 | | |
4678 | 4690 | | |
4679 | 4691 | | |
| |||
4969 | 4981 | | |
4970 | 4982 | | |
4971 | 4983 | | |
| 4984 | + | |
| 4985 | + | |
4972 | 4986 | | |
| 4987 | + | |
| 4988 | + | |
4973 | 4989 | | |
4974 | 4990 | | |
4975 | 4991 | | |
| |||
5342 | 5358 | | |
5343 | 5359 | | |
5344 | 5360 | | |
| 5361 | + | |
5345 | 5362 | | |
5346 | 5363 | | |
5347 | 5364 | | |
5348 | 5365 | | |
5349 | | - | |
| 5366 | + | |
| 5367 | + | |
| 5368 | + | |
| 5369 | + | |
5350 | 5370 | | |
5351 | 5371 | | |
5352 | 5372 | | |
| |||
7186 | 7206 | | |
7187 | 7207 | | |
7188 | 7208 | | |
| 7209 | + | |
7189 | 7210 | | |
7190 | 7211 | | |
7191 | 7212 | | |
7192 | 7213 | | |
7193 | 7214 | | |
7194 | | - | |
| 7215 | + | |
| 7216 | + | |
| 7217 | + | |
| 7218 | + | |
7195 | 7219 | | |
7196 | 7220 | | |
7197 | 7221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
489 | | - | |
| 489 | + | |
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
| |||
0 commit comments