Home
last modified time | relevance | path

Searched hist:"05 e8ab627bc6fc6e607aea94b60fd264b8a6c736" (Results 1 – 1 of 1) sorted by relevance

/freebsd/sys/fs/unionfs/
H A Dunion_vnops.cdiff 05e8ab627bc6fc6e607aea94b60fd264b8a6c736 Sun Feb 18 01:20:51 CET 2024 Jason A. Harmening <jah@FreeBSD.org> 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