vfs: remove the excl argument from the ->create() inode_operation
Subsystems (41)
Jeff Layton
maintainerPATCH 1/1 vfs: remove the excl argument from the ->create() inode_operation
Since ce8644fcadc5 ("lookup_open(): expand the call of vfs_create()"), the "excl" argument to the ->create() inode_operation is always set to true. Remove it, and fix up all of the create implementations.
---
The latest directory delegation patchset has a patch in it to clean up the arguments for vfs_create() [1]. If that looks sane, then I think this would be the next logical step.
Full disclosure: I did use claude code to generate the first approximation, but I had to fix a number of things that it missed. I probably could have given it better prompts. In any case, I'm not sure how to properly attribute this (or if I even need to).
[1]: https://lore.kernel.org/linux-nfs/[email protected]/
--- fs/9p/vfs_inode.c | 2 +- fs/9p/vfs_inode_dotl.c | 2 +- fs/affs/affs.h | 2 +- fs/affs/namei.c | 2 +- fs/afs/dir.c | 4 ++-- fs/bad_inode.c | 2 +- fs/bfs/dir.c | 2 +- fs/btrfs/inode.c | 2 +- fs/ceph/dir.c | 2 +- fs/coda/dir.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/efivarfs/inode.c | 2 +- fs/exfat/namei.c | 2 +- fs/ext2/namei.c | 2 +- fs/ext4/namei.c | 2 +- fs/f2fs/namei.c | 2 +- fs/fat/namei_msdos.c | 2 +- fs/fat/namei_vfat.c | 2 +- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 5 ++--- fs/hfs/dir.c | 2 +- fs/hfsplus/dir.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/namei.c | 2 +- fs/hugetlbfs/inode.c | 2 +- fs/jffs2/dir.c | 4 ++-- fs/jfs/namei.c | 2 +- fs/minix/namei.c | 2 +- fs/namei.c | 4 ++-- fs/nfs/dir.c | 4 ++-- fs/nfs/internal.h | 2 +- fs/nilfs2/namei.c | 2 +- fs/ntfs3/namei.c | 2 +- fs/ocfs2/dlmfs/dlmfs.c | 3 +-- fs/ocfs2/namei.c | 3 +-- fs/omfs/dir.c | 2 +- fs/orangefs/namei.c | 3 +-- fs/overlayfs/dir.c | 2 +- fs/ramfs/inode.c | 2 +- fs/smb/client/cifsfs.h | 2 +- fs/smb/client/dir.c | 2 +- fs/ubifs/dir.c | 2 +- fs/udf/namei.c | 2 +- fs/ufs/namei.c | 3 +-- fs/vboxsf/dir.c | 2 +- fs/xfs/xfs_iops.c | 3 +-- include/linux/fs.h | 4 ++-- ipc/mqueue.c | 2 +- mm/shmem.c | 2 +- 49 files changed, 55 insertions(+), 61 deletions(-)
fs/9p/vfs_inode.c +1 -1
@@ -643,7 +643,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,static int v9fs_vfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct v9fs_session_info *v9ses =v9fs_inode2v9ses (dir);u32 perm =unixmode2p9mode (v9ses, mode);
fs/9p/vfs_inode_dotl.c +1 -1
@@ -218,7 +218,7 @@ int v9fs_open_to_dotl_flags(int flags)*/ static int v9fs_vfs_create_dotl (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t omode,bool excl) +struct dentry *dentry,umode_t omode) {return v9fs_vfs_mknod_dotl (idmap, dir, dentry, omode,0 ); }
fs/affs/affs.h +1 -1
@@ -167,7 +167,7 @@ extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int lextern struct dentry *affs_lookup (struct inode *dir,struct dentry *dentry,unsigned int );extern int affs_unlink (struct inode *dir,struct dentry *dentry);extern int affs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool ); +struct dentry *dentry,umode_t mode);extern struct dentry *affs_mkdir (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry,umode_t mode);extern int affs_rmdir (struct inode *dir,struct dentry *dentry);
fs/affs/namei.c +1 -1
@@ -243,7 +243,7 @@ affs_unlink(struct inode *dir, struct dentry *dentry)int affs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct super_block *sb = dir->i_sb;struct inode *inode;
fs/afs/dir.c +2 -2
@@ -32,7 +32,7 @@ static bool afs_lookup_one_filldir(struct dir_context *ctx, const char *name, instatic bool afs_lookup_filldir (struct dir_context *ctx,const char *name,int nlen,loff_t fpos,u64 ino,unsigned dtype);static int afs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl); +struct dentry *dentry,umode_t mode);static struct dentry *afs_mkdir (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry,umode_t mode);static int afs_rmdir (struct inode *dir,struct dentry *dentry);
@@ -1637,7 +1637,7 @@ static const struct afs_operation_ops afs_create_operation = {* create a regular file on an AFS filesystem */ static int afs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct afs_operation *op;struct afs_vnode *dvnode =AFS_FS_I (dir);
fs/bad_inode.c +1 -1
@@ -29,7 +29,7 @@ static const struct file_operations bad_file_ops =static int bad_inode_create (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry, -umode_t mode,bool excl) +umode_t mode) {return -EIO ; }
fs/bfs/dir.c +1 -1
@@ -76,7 +76,7 @@ const struct file_operations bfs_dir_operations = { };static int bfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {int err;struct inode *inode;
fs/btrfs/inode.c +1 -1
@@ -6816,7 +6816,7 @@ static int btrfs_mknod(struct mnt_idmap *idmap, struct inode *dir, }static int btrfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode;
fs/ceph/dir.c +1 -1
@@ -976,7 +976,7 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir, }static int ceph_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return ceph_mknod (idmap, dir, dentry, mode,0 ); }
fs/coda/dir.c +1 -1
@@ -134,7 +134,7 @@ static inline void coda_dir_drop_nlink(struct inode *dir)/* creation routines: create, mknod, mkdir, link, symlink */ static int coda_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *de,umode_t mode,bool excl) +struct dentry *de,umode_t mode) {int error;const char *name=de->d_name.name;
fs/ecryptfs/inode.c +1 -1
@@ -262,7 +262,7 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,static int ecryptfs_create (struct mnt_idmap *idmap,struct inode *directory_inode,struct dentry *ecryptfs_dentry, -umode_t mode,bool excl) +umode_t mode) {struct inode *ecryptfs_inode;int rc;
fs/efivarfs/inode.c +1 -1
@@ -75,7 +75,7 @@ static bool efivarfs_valid_name(const char *str, int len) }static int efivarfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode =NULL ;struct efivar_entry *var;
fs/exfat/namei.c +1 -1
@@ -543,7 +543,7 @@ static int exfat_add_entry(struct inode *inode, const char *path, }static int exfat_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct super_block *sb = dir->i_sb;struct inode *inode;
fs/ext2/namei.c +1 -1
@@ -101,7 +101,7 @@ struct dentry *ext2_get_parent(struct dentry *child)*/ static int ext2_create (struct mnt_idmap * idmap,struct inode * dir,struct dentry * dentry, -umode_t mode,bool excl) +umode_t mode) {struct inode *inode;int err;
fs/ext4/namei.c +1 -1
@@ -2806,7 +2806,7 @@ static int ext4_add_nondir(handle_t *handle,* with d_instantiate(). */ static int ext4_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {handle_t *handle;struct inode *inode;
fs/f2fs/namei.c +1 -1
@@ -351,7 +351,7 @@ static struct inode *f2fs_new_inode(struct mnt_idmap *idmap, }static int f2fs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct f2fs_sb_info *sbi =F2FS_I_SB (dir);struct inode *inode;
fs/fat/namei_msdos.c +1 -1
@@ -262,7 +262,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,/***** Create a file */ static int msdos_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct super_block *sb = dir->i_sb;struct inode *inode =NULL ;
fs/fat/namei_vfat.c +1 -1
@@ -754,7 +754,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, }static int vfat_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct super_block *sb = dir->i_sb;struct inode *inode;
fs/fuse/dir.c +1 -1
@@ -889,7 +889,7 @@ static int fuse_mknod(struct mnt_idmap *idmap, struct inode *dir, }static int fuse_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *entry,umode_t mode,bool excl) +struct dentry *entry,umode_t mode) {return fuse_mknod (idmap, dir, entry, mode,0 ); }
fs/gfs2/inode.c +2 -3
@@ -942,15 +942,14 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,* @dir: The directory in which to create the file * @dentry: The dentry of the new file * @mode: The mode of the new file -* @excl: Force fail if inode exists * * Returns: errno */ static int gfs2_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) { -return gfs2_create_inode (dir, dentry,NULL ,S_IFREG | mode,0 ,NULL ,0 , excl); +return gfs2_create_inode (dir, dentry,NULL ,S_IFREG | mode,0 ,NULL ,0 ,1 ); }/**
fs/hfs/dir.c +1 -1
@@ -190,7 +190,7 @@ static int hfs_dir_release(struct inode *inode, struct file *file)* the directory and the name (and its length) of the new file. */ static int hfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode;int res;
fs/hfsplus/dir.c +1 -1
@@ -518,7 +518,7 @@ static int hfsplus_mknod(struct mnt_idmap *idmap, struct inode *dir, }static int hfsplus_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return hfsplus_mknod (&nop_mnt_idmap, dir, dentry, mode,0 ); }
fs/hostfs/hostfs_kern.c +1 -1
@@ -593,7 +593,7 @@ static struct inode *hostfs_iget(struct super_block *sb, char *name) }static int hostfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode;char *name;
fs/hpfs/namei.c +1 -1
@@ -129,7 +129,7 @@ static struct dentry *hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, }static int hpfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {const unsigned char *name = dentry->d_name.name;unsigned len = dentry->d_name.len;
fs/hugetlbfs/inode.c +1 -1
@@ -1001,7 +1001,7 @@ static struct dentry *hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dirstatic int hugetlbfs_create (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry, -umode_t mode,bool excl) +umode_t mode) {return hugetlbfs_mknod (idmap, dir, dentry, mode |S_IFREG ,0 ); }
fs/jffs2/dir.c +2 -2
@@ -25,7 +25,7 @@static int jffs2_readdir (struct file *,struct dir_context *);static int jffs2_create (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ,bool ); +struct dentry *,umode_t );static struct dentry *jffs2_lookup (struct inode *,struct dentry *,unsigned int );static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
@@ -161,7 +161,7 @@ static int jffs2_readdir(struct file *file, struct dir_context *ctx)static int jffs2_create (struct mnt_idmap *idmap,struct inode *dir_i, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct jffs2_raw_inode *ri;struct jffs2_inode_info *f, *dir_f;
fs/jfs/namei.c +1 -1
@@ -60,7 +60,7 @@ static inline void free_ea_wmap(struct inode *inode)* */ static int jfs_create (struct mnt_idmap *idmap,struct inode *dip, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {int rc =0 ;tid_t tid;/* transaction id */
fs/minix/namei.c +1 -1
@@ -64,7 +64,7 @@ static int minix_tmpfile(struct mnt_idmap *idmap, struct inode *dir, }static int minix_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return minix_mknod (&nop_mnt_idmap, dir, dentry, mode,0 ); }
fs/namei.c +2 -2
@@ -3493,7 +3493,7 @@ int vfs_create(struct mnt_idmap *idmap, struct dentry *dentry, umode_t mode, error =try_break_deleg (dir, di);if (error)return error; - error = dir->i_op->create (idmap, dir, dentry, mode, true); + error = dir->i_op->create (idmap, dir, dentry, mode);if (!error)fsnotify_create (dir, dentry);return error;
@@ -3802,7 +3802,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, } error = dir_inode->i_op->create (idmap, dir_inode, dentry, - mode, open_flag &O_EXCL ); + mode);if (error) goto out_dput; }
fs/nfs/dir.c +2 -2
@@ -2377,9 +2377,9 @@ static int nfs_do_create(struct inode *dir, struct dentry *dentry, }int nfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) { -return nfs_do_create (dir, dentry, mode, excl ?O_EXCL :0 ); +return nfs_do_create (dir, dentry, mode,O_EXCL ); }EXPORT_SYMBOL_GPL (nfs_create);
fs/nfs/internal.h +1 -1
@@ -398,7 +398,7 @@ extern unsigned long nfs_access_cache_scan(struct shrinker *shrink,struct dentry *nfs_lookup (struct inode *,struct dentry *,unsigned int );void nfs_d_prune_case_insensitive_aliases (struct inode *inode);int nfs_create (struct mnt_idmap *,struct inode *,struct dentry *, -umode_t ,bool ); +umode_t );struct dentry *nfs_mkdir (struct mnt_idmap *,struct inode *,struct dentry *,umode_t );int nfs_rmdir (struct inode *,struct dentry *);
fs/nilfs2/namei.c +1 -1
@@ -86,7 +86,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)* with d_instantiate(). */ static int nilfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode;struct nilfs_transaction_info ti;
fs/ntfs3/namei.c +1 -1
@@ -105,7 +105,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry,* ntfs_create - inode_operations::create */ static int ntfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return ntfs_create_inode (idmap, dir, dentry,NULL ,S_IFREG | mode,0 ,NULL ,0 ,NULL );
fs/ocfs2/dlmfs/dlmfs.c +1 -2
@@ -454,8 +454,7 @@ static struct dentry *dlmfs_mkdir(struct mnt_idmap * idmap,static int dlmfs_create (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry, -umode_t mode, -bool excl) +umode_t mode) {int status =0 ;struct inode *inode;
fs/ocfs2/namei.c +1 -2
@@ -666,8 +666,7 @@ static struct dentry *ocfs2_mkdir(struct mnt_idmap *idmap,static int ocfs2_create (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry, -umode_t mode, -bool excl) +umode_t mode) {int ret;
fs/omfs/dir.c +1 -1
@@ -286,7 +286,7 @@ static struct dentry *omfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, }static int omfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return omfs_add_node (dir, dentry, mode |S_IFREG ); }
fs/orangefs/namei.c +1 -2
@@ -18,8 +18,7 @@static int orangefs_create (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry, -umode_t mode, -bool exclusive) +umode_t mode) {struct orangefs_inode_s *parent =ORANGEFS_I (dir);struct orangefs_kernel_op_s *new_op;
fs/overlayfs/dir.c +1 -1
@@ -704,7 +704,7 @@ static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev, }static int ovl_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return ovl_create_object (dentry, (mode &07777 ) |S_IFREG ,0 ,NULL ); }
fs/ramfs/inode.c +1 -1
@@ -129,7 +129,7 @@ static struct dentry *ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, }static int ramfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return ramfs_mknod (&nop_mnt_idmap, dir, dentry, mode |S_IFREG ,0 ); }
fs/smb/client/cifsfs.h +1 -1
@@ -50,7 +50,7 @@ extern void cifs_sb_deactive(struct super_block *sb);extern const struct inode_operations cifs_dir_inode_ops;extern struct inode *cifs_root_iget (struct super_block *);extern int cifs_create (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ,bool excl); +struct dentry *,umode_t );extern int cifs_atomic_open (struct inode *,struct dentry *,struct file *,unsigned ,umode_t ); extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
fs/smb/client/dir.c +1 -1
@@ -566,7 +566,7 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, }int cifs_create (struct mnt_idmap *idmap,struct inode *inode, -struct dentry *direntry,umode_t mode,bool excl) +struct dentry *direntry,umode_t mode) {int rc;unsigned int xid =get_xid ();
fs/ubifs/dir.c +1 -1
@@ -303,7 +303,7 @@ static int ubifs_prepare_create(struct inode *dir, struct dentry *dentry, }static int ubifs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode;struct ubifs_info *c = dir->i_sb->s_fs_info;
fs/udf/namei.c +1 -1
@@ -371,7 +371,7 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode) }static int udf_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {struct inode *inode =udf_new_inode (dir, mode);
fs/ufs/namei.c +1 -2
@@ -70,8 +70,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsi* with d_instantiate(). */ static int ufs_create (struct mnt_idmap * idmap, -struct inode * dir,struct dentry * dentry,umode_t mode, -bool excl) +struct inode * dir,struct dentry * dentry,umode_t mode) {struct inode *inode;
fs/vboxsf/dir.c +1 -1
@@ -298,7 +298,7 @@ static int vboxsf_dir_create(struct inode *parent, struct dentry *dentry,static int vboxsf_dir_mkfile (struct mnt_idmap *idmap,struct inode *parent,struct dentry *dentry, -umode_t mode,bool excl) +umode_t mode) {return vboxsf_dir_create (parent, dentry, mode, false, excl,NULL ); }
fs/xfs/xfs_iops.c +1 -2
@@ -293,8 +293,7 @@ xfs_vn_create(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, - umode_t mode, - bool flags) + umode_t mode) { return xfs_generic_create(idmap, dir, dentry, mode, 0, NULL); }
include/linux/fs.h +2 -2
@@ -2345,8 +2345,8 @@ struct inode_operations {int (*readlink) (struct dentry *,char __user *,int ); -int (*create) (struct mnt_idmap *,struct inode *,struct dentry *, -umode_t ,bool ); +int (*create) (struct mnt_idmap *,struct inode *,struct dentry *, +umode_t );int (*link) (struct dentry *,struct inode *,struct dentry *);int (*unlink) (struct inode *,struct dentry *); int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,
ipc/mqueue.c +1 -1
@@ -610,7 +610,7 @@ static int mqueue_create_attr(struct dentry *dentry, umode_t mode, void *arg) }static int mqueue_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return mqueue_create_attr (dentry, mode,NULL ); }
mm/shmem.c +1 -1
@@ -3912,7 +3912,7 @@ static struct dentry *shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir, }static int shmem_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool excl) +struct dentry *dentry,umode_t mode) {return shmem_mknod (idmap, dir, dentry, mode |S_IFREG ,0 ); }
---
base-commit: 76ddfe7d66d631e5e31ef4e5dd59797fa03acbf7
change-id: 20251105-create-excl-2b366d9bf3bb
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 3 lines · Jeff Layton
Since
ce8644fcadc5("lookup_open(): expand the call ofvfs_create()"), the "excl" argument to the ->create()inode_operationis always set to true. Remove it, and fix up all of the create implementations.
nonono
fs/namei.c static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · line 3805
Quoted 6 lines
fs/namei.c +1
-1@@ -3802,7 +3802,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, } error = dir_inode->i_op->create (idmap, dir_inode, dentry, - mode, open_flag &O_EXCL ); + mode);
"open_flag & O_EXCL" is not the same as "true".
It is true that "all calls to vfs_create() pass true for 'excl'" The same is NOT true for inode_operations.create.
NeilBrown
Jeff Layton
maintainerQuoted 11 lines · NeilBrown
Quoted 3 lines · Jeff Layton
Since
ce8644fcadc5("lookup_open(): expand the call ofvfs_create()"), the "excl" argument to the ->create()inode_operationis always set to true. Remove it, and fix up all of the create implementations.nonono
Quoted 3 lines
(quoted diff) +0
-0@@ -3802,7 +3802,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, }
Quoted 9 lines
fs/namei.c static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · line 3805
Quoted 3 lines
fs/namei.c +1
-1error = dir_inode->i_op->create (idmap, dir_inode, dentry, - mode, open_flag &O_EXCL ); + mode);"
open_flag&O_EXCL" is not the same as "true".It is true that "all calls to
vfs_create()pass true for 'excl'" The same is NOT true for inode_operations.create.
I don't think this is a problem, actually:
Almost all of the existing ->create() operations ignore the "excl" bool. There are only two that I found that do not: NFS and GFS2. Both of those have an ->atomic_open() operation though, so lookup_open() will never call ->create() for those filesystems. This means that -
Quoted 1 line
create()_is_ always called with excl == true.
Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
maintainerQuoted 22 lines · Jeff Layton
Quoted 11 lines · NeilBrown
Quoted 3 lines · Jeff Layton
Since
ce8644fcadc5("lookup_open(): expand the call ofvfs_create()"), the "excl" argument to the ->create()inode_operationis always set to true. Remove it, and fix up all of the create implementations.nonono
Quoted 3 lines
(quoted diff) +0
-0@@ -3802,7 +3802,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, }Quoted 9 lines
fs/namei.c static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · line 3805
Quoted 3 lines
fs/namei.c +1
-1error = dir_inode->i_op->create (idmap, dir_inode, dentry, - mode, open_flag &O_EXCL ); + mode);"
open_flag&O_EXCL" is not the same as "true".It is true that "all calls to
vfs_create()pass true for 'excl'" The same is NOT true for inode_operations.create.
Quoted 7 lines
I don't think this is a problem, actually:
Almost all of the existing ->create() operations ignore the "excl" bool. There are only two that I found that do not: NFS and GFS2. Both of those have an ->atomic_open() operation though, so
lookup_open()will never call ->create() for those filesystems. This means that -Quoted 1 line
create()_is_ always called with excl == true.
How about this for a revised changelog, which makes the above clear:
vfs: remove the excl argument from the ->create() inode_operation
Since ce8644fcadc5 ("lookup_open(): expand the call of vfs_create()"),
the "excl" argument to the ->create() inode_operation is always set to
true in vfs_create().
There is another call to ->create() in lookup_open() that can set it to
either true or false. All of the ->create() operations in the kernel
ignore the excl argument, except for NFS and GFS2. Both NFS and GFS2
have an ->atomic_open() operation, however so lookup_open() will never
call ->create() on those filesystems.
Remove the "excl" argument from the ->create() operation, and fix up the
filesystems accordingly.Maybe we also need some comments or updates to Documentation/ to make it clear that ->create() always implies O_EXCL semantics?
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 33 lines · Jeff Layton
Quoted 22 lines · Jeff Layton
Quoted 11 lines · NeilBrown
Quoted 3 lines · Jeff Layton
Since
ce8644fcadc5("lookup_open(): expand the call ofvfs_create()"), the "excl" argument to the ->create()inode_operationis always set to true. Remove it, and fix up all of the create implementations.nonono
Quoted 3 lines
(quoted diff) +0
-0@@ -3802,7 +3802,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, }Quoted 9 lines
fs/namei.c static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · line 3805
Quoted 3 lines
fs/namei.c +1
-1error = dir_inode->i_op->create (idmap, dir_inode, dentry, - mode, open_flag &O_EXCL ); + mode);"
open_flag&O_EXCL" is not the same as "true".It is true that "all calls to
vfs_create()pass true for 'excl'" The same is NOT true for inode_operations.create.Quoted 7 lines
I don't think this is a problem, actually:
Almost all of the existing ->create() operations ignore the "excl" bool. There are only two that I found that do not: NFS and GFS2. Both of those have an ->atomic_open() operation though, so
lookup_open()will never call ->create() for those filesystems. This means that -Quoted 1 line
create()_is_ always called with excl == true.How about this for a revised changelog, which makes the above clear:
Quoted 14 lines
vfs: remove the excl argument from the ->create() inode_operation
Since ce8644fcadc5 ("lookup_open(): expand the call of vfs_create()"),
the "excl" argument to the ->create() inode_operation is always set to
true in vfs_create().
There is another call to ->create() in lookup_open() that can set it to
either true or false. All of the ->create() operations in the kernel
ignore the excl argument, except for NFS and GFS2. Both NFS and GFS2
have an ->atomic_open() operation, however so lookup_open() will never
call ->create() on those filesystems.
Remove the "excl" argument from the ->create() operation, and fix up the
filesystems accordingly.Thanks, that is a substantial improvement. I see your point now and I think this is a really nice cleanup to make - thanks.
I think the commit message could be improved further by leading with the detail that is central - that most ->create function ignore 'excl'.
With two exceptions, ->create() methods provided by filesystems ignore the "excl" flag. Those exception are NFS and GFS2 which both also provide ->atomic_open.
excl is always true when ->create is called from vfs_create() (since commit......) so the only time it can be false is when it is called by lookup_open() for filesystems that do not provide ->atomic_open.
So the excl flag to ->create is either ignored or true. So we can remove it and change NFS and GFS2 to acts as though it were true.
Quoted 3 lines
Maybe we also need some comments or updates to
Documentation/to make it clear that ->create() always impliesO_EXCLsemantics?
Definitely, something in porting.rst and something in vfs.rst.
I would be worth saying somewhere that if the fs needs to mediate non-exclusive creation, it must provide atomic_open().
Thanks,
NeilBrown
Quoted 3 lines
Signature · 1 line
Jeff Layton <[email protected]>