1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-25 07:49:18 +00:00
freebsd/sys/fs
Jason A. Harmening 05e8ab627b unionfs_rename: fix numerous locking issues
There are a few places in which unionfs_rename() accesses fvp's private
data without holding the necessary lock/interlock.  Moreover, the
implementation completely fails to handle the case in which fdvp is not
the same as tdvp; in this case it simply fails to lock fdvp at all.
Finally, it locks fvp while potentially already holding tvp's lock, but
makes no attempt to deal with possible LOR there.

Fix this by optimistically using the vnode interlock to protect
the short accesses to fdvp and fvp private data, sequentially.
If a file copy or shadow directory creation is required to prepare
the upper FS for the rename operation, the interlock must be dropped
and fdvp/fvp locked as necessary.

Additionally, use ERELOOKUP (as suggested by kib@) to simplify the
locking logic and eliminate unionfs_relookup() calls for file-copy/
shadow-directory cases that require tdvp's lock to be dropped.

Reviewed by:		kib (earlier version), olce
Tested by:		pho
Differential Revision:	https://reviews.freebsd.org/D44788
2024-04-28 20:19:48 -05:00
..
autofs Reduce reliance on sys/sysproto.h pollution 2024-04-15 21:35:40 +01:00
cd9660
cuse
deadfs
devfs cdevpriv(9): add iterator 2024-03-23 08:59:00 +02:00
ext2fs
fdescfs
fifofs
fuse fusefs: correct a comment 2024-04-04 14:18:56 -06:00
mntfs
msdosfs fs/msdosfs fatblock: use ulmin() rather than min() 2024-02-23 19:37:52 +02:00
nfs nfscl: Clear out a lot of cruft related to B_DIRECT 2024-04-27 17:10:48 -07:00
nfsclient nfscl: Clear out a lot of cruft related to B_DIRECT 2024-04-27 17:10:48 -07:00
nfsserver Revert "nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH" 2024-04-25 09:41:23 -07:00
nullfs nullfs: Show correct exported flag. 2024-04-13 17:21:01 +02:00
procfs
pseudofs
smbfs
tarfs tarfs(5): Grammar fix for a source code comment 2024-04-20 11:21:54 +02:00
tmpfs Reduce reliance on sys/sysproto.h pollution 2024-04-15 21:35:40 +01:00
udf udf: uma_zcreate() does not fail 2024-04-24 08:45:59 -04:00
unionfs unionfs_rename: fix numerous locking issues 2024-04-28 20:19:48 -05:00