mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
ovl: narrow locking in ovl_clear_empty()
Drop the locks immediately after rename, and use a separate lock for cleanup. This makes way for future changes where locks are taken on individual dentries rather than the whole directory. Note that ovl_cleanup_whiteouts() operates on "upper", a child of "upperdir" and does not require upperdir or workdir to be locked. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: NeilBrown <neil@brown.name> Link: https://lore.kernel.org/20250716004725.1206467-7-neil@brown.name Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
a07052e07b
commit
4f622bd9f3
|
|
@ -353,7 +353,6 @@ static struct dentry *ovl_clear_empty(struct dentry *dentry,
|
|||
{
|
||||
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
|
||||
struct dentry *workdir = ovl_workdir(dentry);
|
||||
struct inode *wdir = workdir->d_inode;
|
||||
struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
|
||||
struct path upperpath;
|
||||
struct dentry *upper;
|
||||
|
|
@ -399,12 +398,12 @@ static struct dentry *ovl_clear_empty(struct dentry *dentry,
|
|||
goto out_cleanup;
|
||||
|
||||
err = ovl_do_rename(ofs, workdir, opaquedir, upperdir, upper, RENAME_EXCHANGE);
|
||||
unlock_rename(workdir, upperdir);
|
||||
if (err)
|
||||
goto out_cleanup;
|
||||
goto out_cleanup_unlocked;
|
||||
|
||||
ovl_cleanup_whiteouts(ofs, upper, list);
|
||||
ovl_cleanup(ofs, wdir, upper);
|
||||
unlock_rename(workdir, upperdir);
|
||||
ovl_cleanup_unlocked(ofs, workdir, upper);
|
||||
|
||||
/* dentry's upper doesn't match now, get rid of it */
|
||||
d_drop(dentry);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user