Merge tag 'vfs-7.1-rc1.directory' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs directory updates from Christian Brauner:
 "Recently 'start_creating', 'start_removing', 'start_renaming' and
  related interfaces were added which combine the locking and the
  lookup.

  At that time many callers were changed to use the new interfaces.
  However there are still an assortment of places out side of the core
  vfs where the directory is locked explictly, whether with inode_lock()
  or lock_rename() or similar. These were missed in the first pass for
  an assortment of uninteresting reasons.

  This addresses the remaining places where explicit locking is used,
  and changes them to use the new interfaces, or otherwise removes the
  explicit locking.

  The biggest changes are in overlayfs. The other changes are quite
  simple, though maybe the cachefiles changes is the least simple of
  those"

* tag 'vfs-7.1-rc1.directory' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  VFS: unexport lock_rename(), lock_rename_child(), unlock_rename()
  ovl: remove ovl_lock_rename_workdir()
  ovl: use is_subdir() for testing if one thing is a subdir of another
  ovl: change ovl_create_real() to get a new lock when re-opening created file.
  ovl: pass name buffer to ovl_start_creating_temp()
  cachefiles: change cachefiles_bury_object to use start_renaming_dentry()
  ovl: Simplify ovl_lookup_real_one()
  VFS: make lookup_one_qstr_excl() static.
  nfsd: switch purge_old() to use start_removing_noperm()
  selinux: Use simple_start_creating() / simple_done_creating()
  Apparmor: Use simple_start_creating() / simple_done_creating()
  libfs: change simple_done_creating() to use end_creating()
  VFS: move the start_dirop() kerndoc comment to before start_dirop()
  fs/proc: Don't lock root inode when creating "self" and "thread-self"
  VFS: note error returns in documentation for various lookup functions
This commit is contained in:
Linus Torvalds
2026-04-13 10:24:33 -07:00
15 changed files with 190 additions and 244 deletions

View File

@@ -351,35 +351,24 @@ static struct dentry *aafs_create(const char *name, umode_t mode,
dir = d_inode(parent);
inode_lock(dir);
dentry = lookup_noperm(&QSTR(name), parent);
dentry = simple_start_creating(parent, name);
if (IS_ERR(dentry)) {
error = PTR_ERR(dentry);
goto fail_lock;
}
if (d_really_is_positive(dentry)) {
error = -EEXIST;
goto fail_dentry;
goto fail;
}
error = __aafs_setup_d_inode(dir, dentry, mode, data, link, fops, iops);
simple_done_creating(dentry);
if (error)
goto fail_dentry;
inode_unlock(dir);
goto fail;
if (data)
aa_get_common_ref(data);
return dentry;
fail_dentry:
dput(dentry);
fail_lock:
inode_unlock(dir);
fail:
simple_release_fs(&aafs_mnt, &aafs_count);
return ERR_PTR(error);
}
@@ -2628,8 +2617,7 @@ static int aa_mk_null_file(struct dentry *parent)
if (error)
return error;
inode_lock(d_inode(parent));
dentry = lookup_noperm(&QSTR(NULL_FILE_NAME), parent);
dentry = simple_start_creating(parent, NULL_FILE_NAME);
if (IS_ERR(dentry)) {
error = PTR_ERR(dentry);
goto out;
@@ -2637,7 +2625,7 @@ static int aa_mk_null_file(struct dentry *parent)
inode = new_inode(parent->d_inode->i_sb);
if (!inode) {
error = -ENOMEM;
goto out1;
goto out;
}
inode->i_ino = get_next_ino();
@@ -2649,18 +2637,12 @@ static int aa_mk_null_file(struct dentry *parent)
aa_null.dentry = dget(dentry);
aa_null.mnt = mntget(mount);
error = 0;
out1:
dput(dentry);
out:
inode_unlock(d_inode(parent));
simple_done_creating(dentry);
simple_release_fs(&mount, &count);
return error;
}
static const char *policy_get_link(struct dentry *dentry,
struct inode *inode,
struct delayed_call *done)

View File

@@ -1931,27 +1931,26 @@ static const struct inode_operations swapover_dir_inode_operations = {
static struct dentry *sel_make_swapover_dir(struct super_block *sb,
unsigned long *ino)
{
struct dentry *dentry = d_alloc_name(sb->s_root, ".swapover");
struct dentry *dentry;
struct inode *inode;
if (!dentry)
inode = sel_make_inode(sb, S_IFDIR);
if (!inode)
return ERR_PTR(-ENOMEM);
inode = sel_make_inode(sb, S_IFDIR);
if (!inode) {
dput(dentry);
return ERR_PTR(-ENOMEM);
dentry = simple_start_creating(sb->s_root, ".swapover");
if (IS_ERR(dentry)) {
iput(inode);
return dentry;
}
inode->i_op = &swapover_dir_inode_operations;
inode->i_ino = ++(*ino);
/* directory inodes start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode);
inode_lock(sb->s_root->d_inode);
d_make_persistent(dentry, inode);
inc_nlink(sb->s_root->d_inode);
inode_unlock(sb->s_root->d_inode);
dput(dentry);
simple_done_creating(dentry);
return dentry; // borrowed
}