Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfs: clean up argument list for vfs_create()

As Neil points out:

"I would be in favour of dropping the "dir" arg because it is always
d_inode(dentry->d_parent) which is stable."

...and...

"Also *every* caller of vfs_create() passes ".excl = true". So maybe we
don't need that arg at all."

Drop both arguments from vfs_create() and fix up the callers.

Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20251111-dir-deleg-ro-v6-9-52f3feebb2f2@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
85bbffca 134796f4

+11 -20
+1 -2
fs/ecryptfs/inode.c
··· 188 188 189 189 rc = lock_parent(ecryptfs_dentry, &lower_dentry, &lower_dir); 190 190 if (!rc) 191 - rc = vfs_create(&nop_mnt_idmap, lower_dir, 192 - lower_dentry, mode, true); 191 + rc = vfs_create(&nop_mnt_idmap, lower_dentry, mode); 193 192 if (rc) { 194 193 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " 195 194 "rc = [%d]\n", __func__, rc);
+4 -7
fs/namei.c
··· 3461 3461 /** 3462 3462 * vfs_create - create new file 3463 3463 * @idmap: idmap of the mount the inode was found from 3464 - * @dir: inode of the parent directory 3465 3464 * @dentry: dentry of the child file 3466 3465 * @mode: mode of the child file 3467 - * @want_excl: whether the file must not yet exist 3468 3466 * 3469 3467 * Create a new file. 3470 3468 * ··· 3472 3474 * On non-idmapped mounts or if permission checking is to be performed on the 3473 3475 * raw inode simply pass @nop_mnt_idmap. 3474 3476 */ 3475 - int vfs_create(struct mnt_idmap *idmap, struct inode *dir, 3476 - struct dentry *dentry, umode_t mode, bool want_excl) 3477 + int vfs_create(struct mnt_idmap *idmap, struct dentry *dentry, umode_t mode) 3477 3478 { 3479 + struct inode *dir = d_inode(dentry->d_parent); 3478 3480 int error; 3479 3481 3480 3482 error = may_create(idmap, dir, dentry); ··· 3488 3490 error = security_inode_create(dir, dentry, mode); 3489 3491 if (error) 3490 3492 return error; 3491 - error = dir->i_op->create(idmap, dir, dentry, mode, want_excl); 3493 + error = dir->i_op->create(idmap, dir, dentry, mode, true); 3492 3494 if (!error) 3493 3495 fsnotify_create(dir, dentry); 3494 3496 return error; ··· 4381 4383 idmap = mnt_idmap(path.mnt); 4382 4384 switch (mode & S_IFMT) { 4383 4385 case 0: case S_IFREG: 4384 - error = vfs_create(idmap, path.dentry->d_inode, 4385 - dentry, mode, true); 4386 + error = vfs_create(idmap, dentry, mode); 4386 4387 if (!error) 4387 4388 security_path_post_mknod(idmap, dentry); 4388 4389 break;
+1 -1
fs/nfsd/nfs3proc.c
··· 344 344 status = fh_fill_pre_attrs(fhp); 345 345 if (status != nfs_ok) 346 346 goto out; 347 - host_err = vfs_create(&nop_mnt_idmap, inode, child, iap->ia_mode, true); 347 + host_err = vfs_create(&nop_mnt_idmap, child, iap->ia_mode); 348 348 if (host_err < 0) { 349 349 status = nfserrno(host_err); 350 350 goto out;
+1 -2
fs/nfsd/vfs.c
··· 1552 1552 err = 0; 1553 1553 switch (type) { 1554 1554 case S_IFREG: 1555 - host_err = vfs_create(&nop_mnt_idmap, dirp, dchild, 1556 - iap->ia_mode, true); 1555 + host_err = vfs_create(&nop_mnt_idmap, dchild, iap->ia_mode); 1557 1556 if (!host_err) 1558 1557 nfsd_check_ignore_resizing(iap); 1559 1558 break;
+1 -3
fs/open.c
··· 1171 1171 if (IS_ERR(f)) 1172 1172 return f; 1173 1173 1174 - error = vfs_create(mnt_idmap(path->mnt), 1175 - d_inode(path->dentry->d_parent), 1176 - path->dentry, mode, true); 1174 + error = vfs_create(mnt_idmap(path->mnt), path->dentry, mode); 1177 1175 if (!error) 1178 1176 error = vfs_open(path, f); 1179 1177
+1 -1
fs/overlayfs/overlayfs.h
··· 235 235 struct inode *dir, struct dentry *dentry, 236 236 umode_t mode) 237 237 { 238 - int err = vfs_create(ovl_upper_mnt_idmap(ofs), dir, dentry, mode, true); 238 + int err = vfs_create(ovl_upper_mnt_idmap(ofs), dentry, mode); 239 239 240 240 pr_debug("create(%pd2, 0%o) = %i\n", dentry, mode, err); 241 241 return err;
+1 -2
fs/smb/server/vfs.c
··· 188 188 } 189 189 190 190 mode |= S_IFREG; 191 - err = vfs_create(mnt_idmap(path.mnt), d_inode(path.dentry), 192 - dentry, mode, true); 191 + err = vfs_create(mnt_idmap(path.mnt), dentry, mode); 193 192 if (!err) { 194 193 ksmbd_vfs_inherit_owner(work, d_inode(path.dentry), 195 194 d_inode(dentry));
+1 -2
include/linux/fs.h
··· 2111 2111 /* 2112 2112 * VFS helper functions.. 2113 2113 */ 2114 - int vfs_create(struct mnt_idmap *, struct inode *, 2115 - struct dentry *, umode_t, bool); 2114 + int vfs_create(struct mnt_idmap *, struct dentry *, umode_t); 2116 2115 struct dentry *vfs_mkdir(struct mnt_idmap *, struct inode *, 2117 2116 struct dentry *, umode_t, struct delegated_inode *); 2118 2117 int vfs_mknod(struct mnt_idmap *, struct inode *, struct dentry *,