]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ovl: change ovl_cleanup_and_whiteout() to take rename lock as needed
authorNeilBrown <neil@brown.name>
Wed, 16 Jul 2025 00:44:28 +0000 (10:44 +1000)
committerChristian Brauner <brauner@kernel.org>
Fri, 18 Jul 2025 09:10:42 +0000 (11:10 +0200)
commit2fa14cf2dca1913054e0225377d0a9999483d34d
tree771ba16f27e940c4912c5a145b265568455175de
parentc69566b1d11d781d6b586113126ce1a803bbf8fc
ovl: change ovl_cleanup_and_whiteout() to take rename lock as needed

Rather than locking the directory(s) before calling
ovl_cleanup_and_whiteout(), change it (and ovl_whiteout()) to do the
locking, so the locking can be fine grained as will be needed for
proposed locking changes.

Sometimes this is called to whiteout something in the index dir, in
which case only that dir must be locked.  In one case it is called on
something in an upperdir, so two directories must be locked.  We use
ovl_lock_rename_workdir() for this and remove the restriction that
upperdir cannot be indexdir - because now sometimes it is.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: NeilBrown <neil@brown.name>
Link: https://lore.kernel.org/20250716004725.1206467-18-neil@brown.name
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/overlayfs/dir.c
fs/overlayfs/readdir.c
fs/overlayfs/util.c