linux/Documentation
Linus Torvalds 7cd122b552 Some filesystems use a kinda-sorta controlled dentry refcount leak to pin
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
  ...
2025-12-05 14:36:21 -08:00
..
ABI Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
PCI Documentation: PCI: Amend error recovery doc with pci_save_state() rules 2025-11-24 16:59:10 -06:00
RCU doc: Update for SRCU-fast definitions and initialization 2025-11-05 23:58:30 +01:00
accel accel/qaic: Separate DBC_STATE_* definition list 2025-11-10 14:50:06 -07:00
accounting Documentation: taskstats: Reindent payload kinds list 2025-11-10 12:52:12 -07:00
admin-guide Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
arch This has been another busy cycle for documentation, with a lot of 2025-12-03 11:34:28 -08:00
block
bpf docs: bpf: map_array: Specify BPF_MAP_TYPE_PERCPU_ARRAY value size limit 2025-11-25 14:32:00 -08:00
cdrom
core-api printk changes for 6.19 2025-12-03 12:42:36 -08:00
cpu-freq
crypto This update includes the following changes: 2025-12-03 11:28:38 -08:00
dev-tools linux_kselftest-kunit-6.19-rc1 2025-12-03 15:50:11 -08:00
devicetree Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
doc-guide docs: parse-headers.rst: Fix a typo 2025-11-18 09:13:40 -07:00
driver-api VFIO updates for v6.19-rc1 2025-12-04 18:42:48 -08:00
edac
fault-injection
fb
features docs: Move the "features" tools to tools/docs 2025-10-28 16:01:00 -06:00
filesystems Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
firmware-guide Documentation: ACPI: i2c-muxes: fix I2C device references 2025-11-03 17:01:05 +01:00
firmware_class
fpga
gpu Extra drm-misc-next for v6.19-rc1: 2025-12-02 18:09:08 +10:00
hid Documentation: hid-alps: Format DataByte* subsection headings 2025-11-18 17:53:10 +01:00
hwmon hwmon: (asus-ec-sensors) add ROG STRIX X470-I GAMING 2025-11-21 11:19:46 -08:00
i2c
iio
images
infiniband
input Input: rename INPUT_PROP_HAPTIC_TOUCHPAD to INPUT_PROP_PRESSUREPAD 2025-11-17 23:18:32 -08:00
isdn
kbuild kbuild: doc: improve KBUILD_BUILD_TIMESTAMP documentation 2025-11-08 12:17:58 +01:00
kernel-hacking
leds leds: lp55xx_common: Enable use without FW_LOADER_USER_HELPER 2025-10-21 10:46:30 +01:00
litmus-tests
livepatch
locking documentation: seqlock: fix the wrong documentation of read_seqbegin_or_lock/need_seqretry 2025-10-21 12:31:56 +02:00
maintainer
mhi
misc-devices Documentation: tps6594-pfsm: Fix macro cross-reference syntax 2025-11-10 12:54:49 -07:00
mm Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
netlabel
netlink Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
networking Documentation: net: dsa: mention simple HSR offload helpers 2025-12-01 16:51:55 -08:00
nvdimm
nvme
pcmcia
peci
power power supply and reset changes for the 6.19 series 2025-12-04 16:12:03 -08:00
process docs: submitting-patches: Clarify that removal of Acks needs explanation too 2025-11-29 08:30:54 -07:00
rust docs: rust: quick-start: add Debian 13 (Trixie) 2025-11-04 20:21:15 +01:00
scheduler
scsi
security docs: trusted-encrypted: fix htmldocs build error 2025-10-21 11:58:29 +08:00
sound ASoC: doc: cs35l56: Update firmware filename description for B0 silicon 2025-11-03 13:09:14 +00:00
sphinx Documentation/sphinx/kernel_feat.py: use class directly 2025-11-21 10:32:30 -07:00
sphinx-static
spi
staging
sunrpc/xdr
target
tee
timers
tools rtla updaets for v6.19: 2025-12-05 09:34:01 -08:00
trace tracing updates for v6.19: 2025-12-05 09:51:37 -08:00
translations docs/zh_CN: Add wd719x.rst translation 2025-11-26 14:40:12 +08:00
usb
userspace-api drm-next for 6.19-rc1: 2025-12-04 08:53:30 -08:00
virt KVM x86 fixes for 6.18: 2025-10-18 10:25:43 +02:00
w1 docs: w1: fix w1-netlink invalid URL 2025-11-05 11:23:39 -07:00
watchdog
wmi platform/x86: msi-wmi-platform: Fix typo in WMI GUID 2025-11-10 19:13:29 +02:00
.gitignore
.renames.txt
Changes
CodingStyle
Kconfig docs: move get_abi.py to tools/docs 2025-10-28 16:01:20 -06:00
Makefile docs: makefile: move rustdoc check to the build wrapper 2025-11-29 08:42:53 -07:00
SubmittingPatches
atomic_bitops.txt
atomic_t.txt
conf.py
docutils.conf
index.rst
memory-barriers.txt memory-barriers.txt: Sort wait_event* and wait_on_bit* list alphabetically 2025-11-08 19:02:26 -08:00
subsystem-apis.rst