mirror of https://github.com/torvalds/linux.git
dentries of created objects in dcache (and undo it when removing those).
Reference is grabbed and not released, but it's not actually _stored_
anywhere. That works, but it's hard to follow and verify; among other
things, we have no way to tell _which_ of the increments is intended
to be an unpaired one. Worse, on removal we need to decide whether
the reference had already been dropped, which can be non-trivial if
that removal is on umount and we need to figure out if this dentry is
pinned due to e.g. unlink() not done. Usually that is handled by using
kill_litter_super() as ->kill_sb(), but there are open-coded special
cases of the same (consider e.g. /proc/self).
Things get simpler if we introduce a new dentry flag (DCACHE_PERSISTENT)
marking those "leaked" dentries. Having it set claims responsibility
for +1 in refcount.
The end result this series is aiming for:
* get these unbalanced dget() and dput() replaced with new primitives that
would, in addition to adjusting refcount, set and clear persistency flag.
* instead of having kill_litter_super() mess with removing the remaining
"leaked" references (e.g. for all tmpfs files that hadn't been removed
prior to umount), have the regular shrink_dcache_for_umount() strip
DCACHE_PERSISTENT of all dentries, dropping the corresponding
reference if it had been set. After that kill_litter_super() becomes
an equivalent of kill_anon_super().
Doing that in a single step is not feasible - it would affect too many places
in too many filesystems. It has to be split into a series.
This work has really started early in 2024; quite a few preliminary pieces
have already gone into mainline. This chunk is finally getting to the
meat of that stuff - infrastructure and most of the conversions to it.
Some pieces are still sitting in the local branches, but the bulk of
that stuff is here.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQQqUNBr3gm4hGXdBJlZ7Krx/gZQ6wUCaTEq1wAKCRBZ7Krx/gZQ
643uAQC1rRslhw5l7OjxEpIYbGG4M+QaadN4Nf5Sr2SuTRaPJQD/W4oj/u4C2eCw
Dd3q071tqyvm/PXNgN2EEnIaxlFUlwc=
=rKq+
-----END PGP SIGNATURE-----
Merge tag 'pull-persistency' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull persistent dentry infrastructure and conversion from Al Viro:
"Some filesystems use a kinda-sorta controlled dentry refcount leak to
pin dentries of created objects in dcache (and undo it when removing
those). A reference is grabbed and not released, but it's not actually
_stored_ anywhere.
That works, but it's hard to follow and verify; among other things, we
have no way to tell _which_ of the increments is intended to be an
unpaired one. Worse, on removal we need to decide whether the
reference had already been dropped, which can be non-trivial if that
removal is on umount and we need to figure out if this dentry is
pinned due to e.g. unlink() not done. Usually that is handled by using
kill_litter_super() as ->kill_sb(), but there are open-coded special
cases of the same (consider e.g. /proc/self).
Things get simpler if we introduce a new dentry flag
(DCACHE_PERSISTENT) marking those "leaked" dentries. Having it set
claims responsibility for +1 in refcount.
The end result this series is aiming for:
- get these unbalanced dget() and dput() replaced with new primitives
that would, in addition to adjusting refcount, set and clear
persistency flag.
- instead of having kill_litter_super() mess with removing the
remaining "leaked" references (e.g. for all tmpfs files that hadn't
been removed prior to umount), have the regular
shrink_dcache_for_umount() strip DCACHE_PERSISTENT of all dentries,
dropping the corresponding reference if it had been set. After that
kill_litter_super() becomes an equivalent of kill_anon_super().
Doing that in a single step is not feasible - it would affect too many
places in too many filesystems. It has to be split into a series.
This work has really started early in 2024; quite a few preliminary
pieces have already gone into mainline. This chunk is finally getting
to the meat of that stuff - infrastructure and most of the conversions
to it.
Some pieces are still sitting in the local branches, but the bulk of
that stuff is here"
* tag 'pull-persistency' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (54 commits)
d_make_discardable(): warn if given a non-persistent dentry
kill securityfs_recursive_remove()
convert securityfs
get rid of kill_litter_super()
convert rust_binderfs
convert nfsctl
convert rpc_pipefs
convert hypfs
hypfs: swich hypfs_create_u64() to returning int
hypfs: switch hypfs_create_str() to returning int
hypfs: don't pin dentries twice
convert gadgetfs
gadgetfs: switch to simple_remove_by_name()
convert functionfs
functionfs: switch to simple_remove_by_name()
functionfs: fix the open/removal races
functionfs: need to cancel ->reset_work in ->kill_sb()
functionfs: don't bother with ffs->ref in ffs_data_{opened,closed}()
functionfs: don't abuse ffs_data_closed() on fs shutdown
convert selinuxfs
...
|
||
|---|---|---|
| .. | ||
| caching | ||
| ext4 | ||
| fuse | ||
| gfs2 | ||
| iomap | ||
| nfs | ||
| smb | ||
| spufs | ||
| xfs | ||
| 9p.rst | ||
| adfs.rst | ||
| affs.rst | ||
| afs.rst | ||
| api-summary.rst | ||
| autofs-mount-control.rst | ||
| autofs.rst | ||
| automount-support.rst | ||
| befs.rst | ||
| bfs.rst | ||
| btrfs.rst | ||
| buffer.rst | ||
| ceph.rst | ||
| coda.rst | ||
| configfs.rst | ||
| cramfs.rst | ||
| dax.rst | ||
| debugfs.rst | ||
| devpts.rst | ||
| directory-locking.rst | ||
| dlmfs.rst | ||
| dnotify.rst | ||
| ecryptfs.rst | ||
| efivarfs.rst | ||
| erofs.rst | ||
| ext2.rst | ||
| ext3.rst | ||
| f2fs.rst | ||
| fiemap.rst | ||
| files.rst | ||
| fscrypt.rst | ||
| fsverity.rst | ||
| hfs.rst | ||
| hfsplus.rst | ||
| hpfs.rst | ||
| idmappings.rst | ||
| index.rst | ||
| inotify.rst | ||
| isofs.rst | ||
| journalling.rst | ||
| locking.rst | ||
| locks.rst | ||
| mount_api.rst | ||
| multigrain-ts.rst | ||
| netfs_library.rst | ||
| nilfs2.rst | ||
| ntfs3.rst | ||
| ocfs2-online-filecheck.rst | ||
| ocfs2.rst | ||
| omfs.rst | ||
| orangefs.rst | ||
| overlayfs.rst | ||
| path-lookup.rst | ||
| path-lookup.txt | ||
| porting.rst | ||
| proc.rst | ||
| propagate_umount.txt | ||
| qnx6.rst | ||
| quota.rst | ||
| ramfs-rootfs-initramfs.rst | ||
| relay.rst | ||
| resctrl.rst | ||
| romfs.rst | ||
| seq_file.rst | ||
| sharedsubtree.rst | ||
| splice.rst | ||
| squashfs.rst | ||
| sysfs.rst | ||
| tmpfs.rst | ||
| ubifs-authentication.rst | ||
| ubifs.rst | ||
| udf.rst | ||
| vfat.rst | ||
| vfs.rst | ||
| virtiofs.rst | ||
| zonefs.rst | ||