mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
ovl: narrow locking in ovl_cleanup_whiteouts()
Rather than lock the directory for the whole operation, use ovl_lookup_upper_unlocked() and ovl_cleanup_unlocked() to take the lock only when needed. This makes way for future changes where locks are taken on individual dentries rather than the whole directory. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: NeilBrown <neil@brown.name> Link: https://lore.kernel.org/20250716004725.1206467-11-neil@brown.name Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
05468498cd
commit
7dfb0722ad
|
|
@ -1034,14 +1034,13 @@ void ovl_cleanup_whiteouts(struct ovl_fs *ofs, struct dentry *upper,
|
|||
{
|
||||
struct ovl_cache_entry *p;
|
||||
|
||||
inode_lock_nested(upper->d_inode, I_MUTEX_CHILD);
|
||||
list_for_each_entry(p, list, l_node) {
|
||||
struct dentry *dentry;
|
||||
|
||||
if (WARN_ON(!p->is_whiteout || !p->is_upper))
|
||||
continue;
|
||||
|
||||
dentry = ovl_lookup_upper(ofs, p->name, upper, p->len);
|
||||
dentry = ovl_lookup_upper_unlocked(ofs, p->name, upper, p->len);
|
||||
if (IS_ERR(dentry)) {
|
||||
pr_err("lookup '%s/%.*s' failed (%i)\n",
|
||||
upper->d_name.name, p->len, p->name,
|
||||
|
|
@ -1049,10 +1048,9 @@ void ovl_cleanup_whiteouts(struct ovl_fs *ofs, struct dentry *upper,
|
|||
continue;
|
||||
}
|
||||
if (dentry->d_inode)
|
||||
ovl_cleanup(ofs, upper->d_inode, dentry);
|
||||
ovl_cleanup_unlocked(ofs, upper, dentry);
|
||||
dput(dentry);
|
||||
}
|
||||
inode_unlock(upper->d_inode);
|
||||
}
|
||||
|
||||
static bool ovl_check_d_type(struct dir_context *ctx, const char *name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user