kernel_samsung_a53x/include
Jeff Layton 23581c9ef1 nfsd: close cached files prior to a REMOVE or RENAME that would replace target
[ Upstream commit 7f84b488f9add1d5cca3e6197c95914c7bd3c1cf ]

It's not uncommon for some workloads to do a bunch of I/O to a file and
delete it just afterward. If knfsd has a cached open file however, then
the file may still be open when the dentry is unlinked. If the
underlying filesystem is nfs, then that could trigger it to do a
sillyrename.

On a REMOVE or RENAME scan the nfsd_file cache for open files that
correspond to the inode, and proactively unhash and put their
references. This should prevent any delete-on-last-close activity from
occurring, solely due to knfsd's open file cache.

This must be done synchronously though so we use the variants that call
flush_delayed_fput. There are deadlock possibilities if you call
flush_delayed_fput while holding locks, however. In the case of
nfsd_rename, we don't even do the lookups of the dentries to be renamed
until we've locked for rename.

Once we've figured out what the target dentry is for a rename, check to
see whether there are cached open files associated with it. If there
are, then unwind all of the locking, close them all, and then reattempt
the rename.

None of this is really necessary for "typical" filesystems though. It's
mostly of use for NFS, so declare a new export op flag and use that to
determine whether to close the files beforehand.

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
[ cel: adjusted to apply to 5.10.y ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:26 +01:00
..
acpi
asm-generic asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation 2024-11-18 12:11:56 +01:00
clocksource
crypto crypto: af_alg - Disallow multiple in-flight AIO requests 2024-11-18 12:12:26 +01:00
drm drm/mipi-dsi: use correct return type for the DSC functions 2024-11-19 12:26:58 +01:00
dt-bindings dt-bindings: clock: Update the videocc resets for sm8150 2024-11-18 12:12:41 +01:00
keys
kunit
kvm
linux nfsd: close cached files prior to a REMOVE or RENAME that would replace target 2024-11-19 12:27:26 +01:00
math-emu
media
memory
misc
net net: fix __dst_negative_advice() race 2024-11-19 12:27:19 +01:00
pcmcia
ras
rdma
scsc
scsi scsi: core: Introduce enum scsi_disposition 2024-11-18 12:13:21 +01:00
sdp
soc soc: fsl: qbman: Add CGR update function 2024-11-19 09:22:35 +01:00
sound ASoC: soc-acpi: add helper to identify parent driver. 2024-11-19 12:26:57 +01:00
target
test
trace ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value 2024-11-19 12:26:58 +01:00
uapi Input: allocate keycode for Display refresh rate toggle 2024-11-19 09:23:14 +01:00
variant1/linux
vdso
video
xen