linux/drivers
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
..
accel accel/amdxdna: Fix deadlock between context destroy and job timeout 2025-11-13 09:10:43 -08:00
accessibility
acpi Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
amba IOMMU Updates for Linux v6.19 2025-12-04 18:05:06 -08:00
android Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
ata ata changes for 6.19-rc1 2025-12-04 19:27:11 -08:00
atm atm/fore200e: Fix possible data race in fore200e_open() 2025-11-25 12:39:26 +01:00
auxdisplay
base Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
bcma
block Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
bluetooth Bluetooth: btusb: Add new VID/PID 13d3/3533 for RTL8821CE 2025-12-01 16:21:16 -05:00
bus treewide: Remove in_irq() 2025-10-24 21:39:27 +02:00
cache
cdrom
cdx
char Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
clk clk: sunxi-ng: sun55i-a523-ccu: Lower audio0 pll minimum rate 2025-10-23 02:06:47 +08:00
clocksource clocksource/drivers: Add Realtek system timer driver 2025-11-26 11:25:15 +01:00
comedi hardening updates for v6.19-rc1 2025-12-05 09:11:02 -08:00
connector
counter
cpufreq Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
cpuidle Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
crypto VFIO updates for v6.19-rc1 2025-12-04 18:42:48 -08:00
cxl cxl for v6.19 2025-12-04 17:55:18 -08:00
dax Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
dca
devfreq PM / devfreq: Fix typo in DFSO_DOWNDIFFERENTIAL macro name 2025-11-26 13:58:59 +09:00
dibs dibs: Remove KMSG_COMPONENT macro 2025-11-27 18:11:43 -08:00
dio
dma treewide: Drop pci_save_state() after pci_restore_state() 2025-11-24 16:58:59 -06:00
dma-buf VFIO updates for v6.19-rc1 2025-12-04 18:42:48 -08:00
dpll tools: ynl-gen: add regeneration comment 2025-11-25 19:20:42 -08:00
edac - imh_edac: Add a new EDAC driver for Intel Diamond Rapids and 2025-12-02 10:45:50 -08:00
eisa
extcon
firewire firewire updates for v6.19 2025-12-04 12:26:36 -08:00
firmware Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
fpga
fsi
fwctl
gnss gnss: ubx: add support for the safeboot gpio 2025-11-20 16:44:04 +01:00
gpio gpio updates for v6.19-rc1 2025-12-04 12:33:38 -08:00
gpu Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
greybus
hid hid-for-linus-2025120201 2025-12-04 15:44:48 -08:00
hsi
hte
hv A large overhaul of the restartable sequences and CID management: 2025-12-02 08:48:53 -08:00
hwmon hwmon updates for v6.19 2025-12-04 12:19:49 -08:00
hwspinlock
hwtracing coresight: trbe: Request specific affinities for per CPU interrupts 2025-10-27 17:16:36 +01:00
i2c i2c: muxes: pca954x: Fix broken reset-gpio usage 2025-11-03 18:04:15 +01:00
i3c
idle
iio iio: accel: bmc150: Fix irq assumption regression 2025-11-11 20:22:23 +00:00
infiniband RDMA v6.19 merge window pull request 2025-12-04 18:54:37 -08:00
input regulator: Updates for v6.19 2025-12-04 11:20:29 -08:00
interconnect
iommu Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
ipack
irqchip Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
isdn isdn: kcapi: add WQ_PERCPU to alloc_workqueue users 2025-11-10 18:14:20 -08:00
leds leds: rgb: leds-qcom-lpg: Don't enable TRILED when configuring PWM 2025-11-20 15:25:19 +00:00
macintosh
mailbox mailbox: th1520: fix clock imbalance on probe failure 2025-11-28 09:47:44 -06:00
mcb
md for-6.19/block-20251201 2025-12-03 19:26:18 -08:00
media hardening updates for v6.19-rc1 2025-12-05 09:11:02 -08:00
memory memory: tegra210: Fix incorrect client ids 2025-10-23 15:32:21 +02:00
memstick
message
mfd MFD for v6.19 2025-12-04 15:18:33 -08:00
misc Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
mmc MMC core: 2025-12-04 14:10:16 -08:00
most most: usb: fix double free on late probe failure 2025-11-09 11:15:20 +09:00
mtd Core MTD changes: 2025-12-04 11:07:46 -08:00
mux
net RDMA v6.19 merge window pull request 2025-12-04 18:54:37 -08:00
nfc NFC: mei_phy: fix kernel-doc warnings 2025-11-17 19:32:32 -08:00
ntb
nubus
nvdimm
nvme for-6.19/block-20251201 2025-12-03 19:26:18 -08:00
nvmem nvmem: layouts: fix nvmem_layout_bus_uevent 2025-11-24 18:08:10 +01:00
of Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
opp OPP: Initialize scope-based pointers inline 2025-10-23 11:58:05 +05:30
parisc
parport
pci Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
pcmcia
peci
perf arm64 updates for 6.19: 2025-12-02 17:03:55 -08:00
phy
pinctrl pinctrl: s32cc: initialize gpio_pin_config::list after kmalloc() 2025-11-18 23:56:11 +01:00
platform Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
pmdomain pmdomain core: 2025-12-04 13:50:39 -08:00
pnp PNP: Fix ISAPNP to generate uevents to auto-load modules 2025-11-18 17:35:36 +01:00
power power supply and reset changes for the 6.19 series 2025-12-04 16:12:03 -08:00
powercap Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
pps printk changes for 6.19 2025-12-03 12:42:36 -08:00
ps3
ptp Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
pwm pwm: rzg2l-gpt: Allow checking period_tick cache value only if sibling channel is enabled 2025-11-27 09:58:07 +01:00
rapidio
ras EFI updates for v6.19: 2025-12-04 17:10:08 -08:00
regulator regulator: Updates for v6.19 2025-12-04 11:20:29 -08:00
remoteproc
resctrl arm_mpam: Add kunit tests for props_mismatch() 2025-11-19 18:34:24 +00:00
reset gpio updates for v6.19-rc1 2025-12-04 12:33:38 -08:00
rpmsg
rtc rtc: rx8025: fix incorrect register reference 2025-11-08 20:56:12 +01:00
s390 Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
sbus
scsi pci-v6.19-changes 2025-12-04 17:29:41 -08:00
sh
siox
slimbus Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
soc Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
soundwire
spi gpio updates for v6.19-rc1 2025-12-04 12:33:38 -08:00
spmi
ssb
staging sound updates for 6.19-rc1 2025-12-04 10:08:40 -08:00
target Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
tc
tee QCOMTEE fixes2 for v6.18 2025-11-21 21:27:20 +01:00
thermal Thermal control updates for 6.19-rc1 2025-12-02 17:49:12 -08:00
thunderbolt
tty pci-v6.19-changes 2025-12-04 17:29:41 -08:00
ufs scsi: ufs: core: Fix invalid probe error return value 2025-10-29 23:20:19 -04:00
uio
usb Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
vdpa Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
vfio drm next part 2 for 6.19-rc1 2025-12-04 19:42:53 -08:00
vhost virtio,vhost: fixes, cleanups 2025-12-04 18:59:21 -08:00
video Backlight for v6.19 2025-12-04 15:29:27 -08:00
virt
virtio virtio: clean up features qword/dword terms 2025-11-27 02:03:07 -05:00
w1
watchdog watchdog: diag288_wdt: Remove KMSG_COMPONENT macro 2025-11-26 17:34:52 +01:00
xen Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
zorro
Kconfig arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate 2025-11-19 18:34:20 +00:00
Makefile arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate 2025-11-19 18:34:20 +00:00