Files
scoutfs/kmod/src
Auke Kok cebe465443 Abort pending net requests when a mount fails
A failed mount tears down with scoutfs_put_super(), which calls
scoutfs_srch_destroy() first.  srch_destroy() does cancel_work_sync() on
the srch compact worker, but that worker can be parked in an
uninterruptible scoutfs_net_sync_request() to a server that will never
respond (e.g. the server is stuck in recovery).  Nothing completes the
request: the forced-unmount drain in the net shutdown path only runs for
umount -f, and a failed mount never calls ->umount_begin, so the request
sits on the resend queue and cancel_work_sync() waits forever.

The result is an unkillable D-state mount that survives the SIGKILL a
mount timeout sends, and only clears on reboot:

  systemd[1]: data-archive.mount: Killing process 15740 (mount) with signal SIGKILL.
  systemd[1]: data-archive.mount: Mount process still around after SIGKILL. Ignoring.

  cat /proc/26717/stack
  [<0>] __flush_work+0x16f/0x240
  [<0>] __cancel_work_sync+0x135/0x1a0
  [<0>] scoutfs_srch_destroy+0x33/0x70 [scoutfs]
  [<0>] scoutfs_put_super+0x4f/0x1a0 [scoutfs]
  [<0>] scoutfs_fill_super+0x260/0x520 [scoutfs]
  [<0>] mount_bdev+0xf9/0x150
  [<0>] do_new_mount+0x17a/0x310
  [<0>] __x64_sys_mount+0x107/0x140

The worker it waits on, blocked in the sync request that never returns:

  task:kworker/u269:1  state:D
  Workqueue: scoutfs_srch_compact scoutfs_srch_compact_worker [scoutfs]
  Call Trace:
   __wait_for_common+0x90/0x1d0
   scoutfs_net_sync_request+0xdb/0xf0 [scoutfs]
   scoutfs_client_srch_get_compact+0x2e/0x40 [scoutfs]
   scoutfs_srch_compact_worker+0x64/0x3d0 [scoutfs]

On the fill_super error path, mark forced_unmount and shut the client
connection down before teardown.  That drains pending requests with
-ECONNABORTED so the worker returns and srch_destroy()'s cancel_work_sync
completes.  It is done for any failure, before the direct put_super call
and before returning to generic_shutdown_super (which calls put_super
when s_root was set), so both teardown paths are covered.  sbi is
allocated before any goto out, and scoutfs_client_net_shutdown() is a
no-op when the client or connection was never set up, so early failures
are safe.

Signed-off-by: Auke Kok <auke.kok@versity.com>
2026-07-23 09:17:39 -07:00
..
2024-06-28 15:09:05 -07:00
2025-10-24 14:24:00 -04:00
2022-10-14 14:03:35 -07:00
2024-06-28 15:09:05 -07:00
2024-06-28 14:53:49 -07:00
2020-08-26 14:39:12 -07:00
2026-06-05 09:49:45 -07:00
2022-12-12 14:59:22 -08:00
2024-01-25 11:30:17 -08:00
2025-10-24 14:21:06 -04:00
2018-04-04 09:15:27 -05:00
2026-06-05 09:49:45 -07:00
2026-03-13 15:44:18 -07:00
2026-06-08 11:53:16 -07:00
2023-06-14 14:12:10 -07:00
2018-01-26 11:59:47 -08:00
2021-08-24 09:11:40 -07:00
2021-08-24 09:11:40 -07:00
2020-10-29 14:15:33 -07:00
2026-06-08 11:53:16 -07:00
2026-06-05 09:49:45 -07:00
2024-06-28 14:53:49 -07:00
2024-10-03 12:41:05 -07:00
2024-06-28 15:09:05 -07:00
2024-06-28 15:09:05 -07:00
2026-06-08 11:53:16 -07:00
2019-08-20 15:52:13 -07:00
2025-11-13 12:43:31 -08:00
2022-03-11 15:28:58 -08:00
2019-05-21 11:33:26 -07:00
2019-05-21 11:33:26 -07:00
2022-12-12 14:59:22 -08:00
2024-06-28 15:09:05 -07:00
2020-10-29 14:15:33 -07:00
2020-10-29 14:15:33 -07:00
2020-11-30 13:35:44 -08:00
2019-04-12 10:54:07 -07:00
2024-10-03 12:41:05 -07:00
2026-04-10 13:50:21 -07:00
2026-04-10 13:50:21 -07:00
2021-07-07 14:13:14 -07:00
2018-07-27 09:50:21 -07:00
2024-06-28 15:09:05 -07:00
2024-06-28 15:09:05 -07:00