Skip to content

mount: a few gnarly fixes

Christian Brauner linux-fsdevel stable 1 version In review

Get series with b4
b4 am [email protected] change-id 20260923-work-mount-fixes-c9f19fb484eb

Versions newest first

  1. v1 Latest8 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8mount: keep a copied mount unbindablefs/namespace.c+1 -00 replies
2/8selftests/filesystems: check that a copied mount namespace keeps unbindabletools/testing/selftests/Makefile tools/testing/selftests/filesystems/mntns_unbindable/Makefile tools/testing/selftests/filesystems/mntns_unbindable/mntns_unbindable_test.c+234 -00 replies
3/8mount: refuse MOVE_MOUNT_SET_GROUP on an unbindable mountfs/namespace.c+1 -10 replies
4/8selftests/move_mount_set_group: check that an unbindable target is refusedtools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c+68 -60 replies
5/8fs: don't silently unmount busy mountsfs/pnode.c+90 -182 replies
6/8selftests/filesystems: check that a busy propagated copy blocks a synchronous umounttools/testing/selftests/Makefile tools/testing/selftests/filesystems/umount_propagation/Makefile tools/testing/selftests/filesystems/umount_propagation/umount_propagation_test.c+233 -00 replies
7/8fs: don't let a migrating task hide its reference from do_umount()fs/mount.h fs/namespace.c+32 -190 replies
8/8docs: update the unmount propagation ruleDocumentation/filesystems/sharedsubtree.rst+14 -60 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/8] mount: a few gnarly fixes

Hey,

A short while ago I received a bug report about problematic behavior in the mount code and that let me to review and model a few corner cases including reference counting. The result is the following set of fixes:

- Ensure that copies of unbindable mounts remain unbindable
- Ensure that MOVE_MOUNT_SET_GROUP doesn't operate on unbindable mounts so we don't create an undefined state where a mount is both unbindable and a slave mount.
- Ensure that we don't silently unmount busy mounts. This is nasty because it's an old bug from v4.13 where calculation of whether a synchronous (non-MNT_DETACH) umount would succeed drifted apart from the actual codepath that did the unmount.
- Ensure that we don't silently unmount busy mounts. Same class, different mechanism. There's a race between the reference count check in propagate_mount_busy() (summing up per-cpu counters) and mntget().

Fixes and test for all. No test for the mntget() race because that needs aritifical delays.

And fwiw, I think I another vomitorious series in the pipes.

---
Christian Brauner (8):
mount: keep a copied mount unbindable
selftests/filesystems: check that a copied mount namespace keeps unbindable
mount: refuse MOVE_MOUNT_SET_GROUP on an unbindable mount selftests/move_mount_set_group: check that an unbindable target is refused
fs: don't silently unmount busy mounts
selftests/filesystems: check that a busy propagated copy blocks a synchronous umount
fs: don't let a migrating task hide its reference from do_umount()
docs: update the unmount propagation rule

 Documentation/filesystems/sharedsubtree.rst        |  20 +-
 fs/mount.h                                         |   3 +-
 fs/namespace.c                                     |  51 +++--
 fs/pnode.c                                         | 108 ++++++++--
 tools/testing/selftests/Makefile                   |   2 +
 .../filesystems/mntns_unbindable/Makefile          |   6 +
 .../mntns_unbindable/mntns_unbindable_test.c       | 227 +++++++++++++++++++++
 .../filesystems/umount_propagation/Makefile        |   6 +
 .../umount_propagation/umount_propagation_test.c   | 226 ++++++++++++++++++++
 .../move_mount_set_group_test.c                    |  74 ++++++-
 10 files changed, 673 insertions(+), 50 deletions(-)

---
base-commit: 2d2a2d7aa98741b58f54cacc99b52024e4d865f9
change-id: 20260923-work-mount-fixes-c9f19fb484eb