From: NeilBrown Date: Wed, 16 Jul 2025 00:44:15 +0000 (+1000) Subject: ovl: narrow the locked region in ovl_copy_up_workdir() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a735bdf0b78528970f169870ced234dd3a33ea7b;p=thirdparty%2Fkernel%2Flinux.git ovl: narrow the locked region in ovl_copy_up_workdir() In ovl_copy_up_workdir() unlock immediately after the rename. There is nothing else in the function that needs the lock. Signed-off-by: NeilBrown Link: https://lore.kernel.org/20250716004725.1206467-5-neil@brown.name Reviewed-by: Amir Goldstein Signed-off-by: Christian Brauner --- diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index fef873d18b2da..8f8dbe8a1d54e 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -829,9 +829,10 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c) goto cleanup; err = ovl_do_rename(ofs, c->workdir, temp, c->destdir, upper, 0); + unlock_rename(c->workdir, c->destdir); dput(upper); if (err) - goto cleanup; + goto cleanup_unlocked; inode = d_inode(c->dentry); if (c->metacopy_digest) @@ -845,7 +846,6 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c) ovl_inode_update(inode, temp); if (S_ISDIR(inode->i_mode)) ovl_set_flag(OVL_WHITEOUTS, inode); - unlock_rename(c->workdir, c->destdir); out: ovl_end_write(c->dentry);