Skip to content

Detaching mounts on unlink (for 3.15 v2)

Eric W. Biederman containers linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12vfs: Document the effect of d_revalidate on d_find_aliasfs/dcache.c+2 -10 replies
2/12vfs: More precise tests in d_invalidatefs/dcache.c+4 -340 replies
3/12vfs: Don't allow overwriting mounts in the current mount namespacefs/mount.h fs/namei.c fs/namespace.c+51 -10 replies
4/12vfs: Keep a list of mounts on a mount pointfs/mount.h fs/namespace.c+8 -00 replies
5/12vfs: factor out lookup_mountpoint from new_mountpointfs/namespace.c+12 -30 replies
6/12vfs: Add a function to lazily unmount all mounts from any dentry.fs/mount.h fs/namespace.c+40 -00 replies
7/12vfs: Lazily remove mounts on unlinked files and directories.fs/dcache.c fs/namei.c+42 -360 replies
8/12vfs: Remove unnecessary calls of check_submounts_and_dropfs/afs/dir.c fs/fuse/dir.c fs/gfs2/dentry.c +2 more+0 -260 replies
9/12vfs: Merge check_submounts_and_drop and d_invalidatefs/dcache.c include/linux/dcache.h+22 -340 replies
10/12vfs: Make d_invalidate return voidfs/btrfs/ioctl.c fs/cifs/readdir.c fs/dcache.c +4 more+13 -290 replies
11/12vfs: Remove d_drop calls from d_revalidate implementationsfs/ceph/dir.c fs/proc/base.c fs/proc/fd.c+0 -70 replies
12/12proc: Update proc_flush_task_mnt to use d_invalidatefs/proc/base.c+2 -40 replies

Reviews trailers per patch

10 of 12 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMiklos SzerediEric W. Biederman
SeriesA-b
1/12R-b
2/12R-b
3/12R-b
4/12R-b
5/12
6/12
7/12R-b
8/12R-b
9/12R-b
10/12R-b
11/12R-b
12/12R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/12] Detaching mounts on unlink (for 3.15 v2)

After an interesting set of review comments this patchset is back with very modest changes.

I spent quite a bit of timing trying to see if I could understand and possibly reproduce the poor issues reported by Fengguang Wu. Ultimately I wound up running dbench and will-it-scale/unlink2 on a ramfs filesystem with a fixed clock speed so I could get enough jitter out of the benchmark numbers to that I could make some sense of the results. On my bitty box I could not find any problems with dbench, will-it-scale/unlink2 I measured a small loss of performance because detach_mounts was silly and took the lock before testing d_mountpoint. With that fixed I can not see any performance differences between my code and unmodified 3.14-rcX. Nor can I see any reason to suspect there might be. The core vfs changes are quite modest.

Now I did not benchark d_invalidate, but check_submounts_and_drop is what any sane distributed filesystem is doing today, and as discussed in the review the actual changes are very modest even in d_invalidate.

In the first round of this patchset the semantics of dropping mounts on unlink were agreed to so long as we preserve the current semantics in a single mount namespace.

The are really only two changes in this version of the patchset.
1) is_local_mountpoint now returns a bool.
2) detach_mounts was simplified/cleanup and made more performant.

In net this should result in a kernel that is more comprehensible and maintainble as well as fixing some possible mount leaks, and removing the possibility of DOS attacks from evily placed mount points, in other mount namespaces.

For people who prefer git trees these changes are available at:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git vfs-detach-mounts3

Eric W. Biederman (12):
vfs: Document the effect of d_revalidate on d_find_alias
vfs: More precise tests in d_invalidate
vfs: Don't allow overwriting mounts in the current mount namespace
vfs: Keep a list of mounts on a mount point
vfs: factor out lookup_mountpoint from new_mountpoint
vfs: Add a function to lazily unmount all mounts from any dentry.
vfs: Lazily remove mounts on unlinked files and directories.
vfs: Remove unnecessary calls of check_submounts_and_drop
vfs: Merge check_submounts_and_drop and d_invalidate
vfs: Make d_invalidate return void
vfs: Remove d_drop calls from d_revalidate implementations
proc: Update proc_flush_task_mnt to use d_invalidate

 fs/afs/dir.c           |    5 --
 fs/btrfs/ioctl.c       |    5 +--
 fs/ceph/dir.c          |    1 -
 fs/cifs/readdir.c      |    6 +--
 fs/dcache.c            |  140 +++++++++++++++++-------------------------------
 fs/fuse/dir.c          |    7 +--
 fs/gfs2/dentry.c       |    3 -
 fs/kernfs/dir.c        |   11 ----
 fs/mount.h             |   20 +++++++
 fs/namei.c             |   28 ++++++----
 fs/namespace.c         |   87 +++++++++++++++++++++++++++++-
 fs/nfs/dir.c           |    7 +--
 fs/proc/base.c         |   10 +---
 fs/proc/fd.c           |    2 -
 include/linux/dcache.h |    3 +-
 15 files changed, 178 insertions(+), 157 deletions(-)

Eric