]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
vfs: add cwd check to umount to prevent filesystem in use
authorTulio A M Mendes <[email protected]>
Tue, 26 May 2026 02:20:43 +0000 (23:20 -0300)
committerTulio A M Mendes <[email protected]>
Wed, 3 Jun 2026 04:02:35 +0000 (01:02 -0300)
commitf2973bc857311d667f3cfd3e41e93726cef3387a
tree3b7dbb0a402367bb8369c45fcdd324b251543ec5
parent3e5c025976e62cbe0b1fe5e5667d04467294c42c
vfs: add cwd check to umount to prevent filesystem in use

Added busy check in vfs_umount_nolock to reject unmount if any process
has its current working directory (cwd) within the mount being unmounted.

Implementation details:
- Iterates over ready_queue_head under sched_lock
- Uses path_is_mountpoint_prefix to check if cwd is within mount
- Returns -EBUSY if any process has cwd in the mount
- Note: root directory check not implemented (root not stored as path in process struct)

This prevents crashes when processes attempt to access files after
their cwd filesystem has been unmounted.

Test results:
- Smoke test: 123/123 PASS
- Zero regressions
src/kernel/fs.c