Skip to content

NFSD: Fix server hang when there are multiple layout conflicts

Dai Ngo linux-fsdevel linux-nfs 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 33 repliesIn review
  2. v33 patches 1 replySuperseded
  3. v22 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches12 repliesSuperseded

Changes in v4 from the cover letter

. (2/3) add wait_queue_head_t in file_lock_context for threads to wait
until fencing is done.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3locks: Introduce lm_breaker_timedout operation to lease_manager_operationsDocumentation/filesystems/locking.rst fs/locks.c include/linux/filelock.h+15 -38 replies
2/3locks: Threads with layout conflict must wait until client was fenced.fs/locks.c include/linux/filelock.h+29 -05 replies
3/3FSD: Fix NFS server hang when there are multiple layout conflictsfs/nfsd/nfs4layouts.c+22 -420 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [Patch v4 0/3] NFSD: Fix server hang when there are multiple layout conflicts

NFSD: Fix server hang when there are multiple layout conflicts

When a layout conflict triggers a call to __break_lease, the function nfsd4_layout_lm_break clears the fl_break_time timeout before sending the CB_LAYOUTRECALL. As a result, __break_lease repeatedly restarts its loop, waiting indefinitely for the conflicting file lease to be released.

If the number of lease conflicts matches the number of NFSD threads (which defaults to 8), all available NFSD threads become occupied. onsequently, there are no threads left to handle incoming requests or callback replies, leading to a total hang of the NFSD server.

This issue is reliably reproducible by running the Git test suite on a configuration using the SCSI layout.

This patchset fixes this problem by introducing the new lm_breaker_timedout operation to lease_manager_operations and enforcing timeout for layout lease break.

V2:
. replace int with u32 for ls_layout_type in nfsd_layout_breaker_timedout.

. add mechanism to ensure threads wait in __break_lease for layout conflict
must wait until one of the waiting threads done with the fencing operation before these threads can continue.

V3:
. break the patchset into 3 patches:
(1/3) locks: Introduce lm_breaker_timedout operation to lease_manager_operations.
No change from V1
(2/3) locks: Threads with layout conflict must wait until the client was fenced.
New patch: add synchronization in __break_lease to ensure threads with layout conflict must wait until the client was fenced.
(3/3) NFSD: Fix NFS server hang when there are multiple layout conflicts
Replace int with u32 for ls_layout_type in nfsd_layout_breaker_timedout
V4:
. (2/3) add wait_queue_head_t in file_lock_context for threads to wait
until fencing is done.

 Documentation/filesystems/locking.rst |  2 ++
 fs/locks.c                            | 38 +++++++++++++++++++++++++++---
 fs/nfsd/nfs4layouts.c                 | 26 ++++++++++++++++----
 include/linux/filelock.h              |  7 ++++++
 4 files changed, 66 insertions(+), 7 deletions(-)