History

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

Pull vfs lookup updates from Christian Brauner: "This refactors lookup_open() and adds vfs_lookup_open() for nfsd. mnt_want_write() and parent locking are moved into lookup_open() itself. audit_inode_child() is also now called in lookup_open() on failure. That is the calling convention in vfs_create() and vfs_mkdir(), but lookup_open() made no such call when atomic_open() should have created a file and did not. And neither did the regular ->create() path fwiw. This also contains work to remove the unneeded excl argument from the ->create() inode op" * tag 'vfs-7.3-rc1.lookup' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: fs/namei.c: fix coding style in atomic_open() and lookup_open() fs/namei.c: fix kerneldoc of atomic_open() and vfs_lookup_open() fs/namei.c: update stale comments in lookup_open() Remove excl arg to ->create inode_operation fs/namei.c: update kerneldoc of atomic_open() vfs: call audit_inode_child() in lookup_open() on failure vfs: move create error && negative dentry case in lookup_open() up VFS: add vfs_lookup_open() for nfsd VFS: move delegated_inode retry loop into lookup_open() VFS: move mnt_want_write() and locking into lookup_open()

Linus Torvalds committed 2 months ago

Commit ab5ed082 parents fff0150 895741754 files · +316 −174Browse files

Unified · Split

54 files
  1. Documentation/filesystems/locking.rst +1 −1
  2. Documentation/filesystems/porting.rst +8 −0
  3. Documentation/filesystems/vfs.rst +1 −1
  4. fs/9p/vfs_inode.c +1 −2
  5. fs/9p/vfs_inode_dotl.c +1 −2
  6. fs/affs/affs.h +1 −1
  7. fs/affs/namei.c +1 −1
  8. fs/afs/dir.c +2 −2
  9. fs/bad_inode.c +1 −1
  10. fs/bfs/dir.c +1 −1
  11. fs/btrfs/inode.c +1 −1
  12. fs/ceph/dir.c +1 −1
  13. fs/coda/dir.c +1 −1
  14. fs/ecryptfs/inode.c +1 −1
  15. fs/efivarfs/inode.c +1 −1
  16. fs/exfat/namei.c +1 −1
  17. fs/ext2/namei.c +1 −1
  18. fs/ext4/namei.c +1 −1
  19. fs/f2fs/namei.c +1 −1
  20. fs/fat/namei_msdos.c +1 −1
  21. fs/fat/namei_vfat.c +1 −1
  22. fs/fuse/dir.c +1 −1
  23. fs/gfs2/inode.c +2 −3
  24. fs/hfs/dir.c +1 −1
  25. fs/hfsplus/dir.c +1 −1
  26. fs/hostfs/hostfs_kern.c +1 −1
  27. fs/hpfs/namei.c +1 −1
  28. fs/hugetlbfs/inode.c +1 −1
  29. fs/jffs2/dir.c +2 −2
  30. fs/jfs/namei.c +1 −1
  31. fs/minix/namei.c +1 −1
  32. fs/namei.c +248 −109
  33. fs/nfs/dir.c +2 −2
  34. fs/nfs/internal.h +1 −1
  35. fs/nilfs2/namei.c +1 −1
  36. fs/ntfs/namei.c +1 −1
  37. fs/ntfs3/namei.c +1 −1
  38. fs/ocfs2/dlmfs/dlmfs.c +1 −2
  39. fs/ocfs2/namei.c +1 −2
  40. fs/omfs/dir.c +1 −1
  41. fs/orangefs/namei.c +1 −2
  42. fs/overlayfs/dir.c +1 −1
  43. fs/ramfs/inode.c +1 −1
  44. fs/smb/client/cifsfs.h +1 −1
  45. fs/smb/client/dir.c +1 −1
  46. fs/ubifs/dir.c +1 −1
  47. fs/udf/namei.c +1 −1
  48. fs/ufs/namei.c +1 −2
  49. fs/vboxsf/dir.c +2 −2
  50. fs/xfs/xfs_iops.c +2 −3
  51. include/linux/fs.h +1 −1
  52. include/linux/namei.h +3 −0
  53. ipc/mqueue.c +1 −1
  54. mm/shmem.c +1 −1
Documentation/filesystems/locking.rst+1−1
@@ -61,7 +61,7 @@ inode_operations · 60 unmodified lines
6161
6262 prototypes::
6363
64− int (*create) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t, bool);
64+ int (*create) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
6565 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
6666 int (*link) (struct dentry *,struct inode *,struct dentry *);
6767 int (*unlink) (struct inode *,struct dentry *);
Documentation/filesystems/porting.rst+8−0
@@ -1401,3 +1401,11 @@ as with d_dispose_if_unused() these are not trivial; with this variant · 1400 unmodified lines
14011401 of API it's more explicit, since grabbing ->d_lock is caller-side, but
14021402 d_dispose_if_unused() had all the same issues. It's a low-level primitive;
14031403 use only if you have no alternative.
1404+
1405+---
1406+
1407+**mandatory**
1408+
1409+The .create inode_operation no longer receives the 'excl' arg. It must
1410+always assume the file does not already exist. If the filesystem needs
1411+to be involved in non-exclusive create, it should provide atomic_open.
Documentation/filesystems/vfs.rst+1−1
@@ -415,7 +415,7 @@ As of kernel 2.6.22, the following members are defined: · 414 unmodified lines
415415 .. code-block:: c
416416
417417 struct inode_operations {
418− int (*create) (struct mnt_idmap *, struct inode *,struct dentry *, umode_t, bool);
418+ int (*create) (struct mnt_idmap *, struct inode *,struct dentry *, umode_t);
419419 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
420420 int (*link) (struct dentry *,struct inode *,struct dentry *);
421421 int (*unlink) (struct inode *,struct dentry *);
fs/9p/vfs_inode.c+1−2
@@ -645,7 +645,6 @@ error: · 644 unmodified lines
645645 * @dir: The parent directory
646646 * @dentry: The name of file to be created
647647 * @mode: The UNIX file mode to set
648− * @excl: True if the file must not yet exist
649648 *
650649 * open(.., O_CREAT) is handled in v9fs_vfs_atomic_open(). This is only called
651650 * for mknod(2).
@@ -654,7 +653,7 @@ error: · 2 unmodified lines
654653
655654 static int
656655 v9fs_vfs_create(struct mnt_idmap *idmap, struct inode *dir,
657− struct dentry *dentry, umode_t mode, bool excl)
656+ struct dentry *dentry, umode_t mode)
658657 {
659658 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
660659 u32 perm = unixmode2p9mode(v9ses, mode);
fs/9p/vfs_inode_dotl.c+1−2
@@ -213,12 +213,11 @@ int v9fs_open_to_dotl_flags(int flags) · 212 unmodified lines
213213 * @dir: directory inode that is being created
214214 * @dentry: dentry that is being deleted
215215 * @omode: create permissions
216− * @excl: True if the file must not yet exist
217216 *
218217 */
219218 static int
220219 v9fs_vfs_create_dotl(struct mnt_idmap *idmap, struct inode *dir,
221− struct dentry *dentry, umode_t omode, bool excl)
220+ struct dentry *dentry, umode_t omode)
222221 {
223222 return v9fs_vfs_mknod_dotl(idmap, dir, dentry, omode, 0);
224223 }
fs/affs/affs.h+1−1
@@ -169,7 +169,7 @@ extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int l · 168 unmodified lines
169169 extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int);
170170 extern int affs_unlink(struct inode *dir, struct dentry *dentry);
171171 extern int affs_create(struct mnt_idmap *idmap, struct inode *dir,
172− struct dentry *dentry, umode_t mode, bool);
172+ struct dentry *dentry, umode_t mode);
173173 extern struct dentry *affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
174174 struct dentry *dentry, umode_t mode);
175175 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) · 242 unmodified lines
243243
244244 int
245245 affs_create(struct mnt_idmap *idmap, struct inode *dir,
246− struct dentry *dentry, umode_t mode, bool excl)
246+ struct dentry *dentry, umode_t mode)
247247 {
248248 struct super_block *sb = dir->i_sb;
249249 struct inode *inode;
fs/afs/dir.c+2−2
@@ -34,7 +34,7 @@ static bool afs_lookup_filldir(struct dir_context *ctx, const char *name, int nl · 33 unmodified lines
3434 u64 ino, u32 uniquifier);
3535 #define AFS_LOOKUP ((filldir_t)0x137UL)
3636 static int afs_create(struct mnt_idmap *idmap, struct inode *dir,
37− struct dentry *dentry, umode_t mode, bool excl);
37+ struct dentry *dentry, umode_t mode);
3838 static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
3939 struct dentry *dentry, umode_t mode);
4040 static int afs_rmdir(struct inode *dir, struct dentry *dentry);
@@ -1633,7 +1633,7 @@ static const struct afs_operation_ops afs_create_operation = { · 1592 unmodified lines
16331633 * create a regular file on an AFS filesystem
16341634 */
16351635 static int afs_create(struct mnt_idmap *idmap, struct inode *dir,
1636− struct dentry *dentry, umode_t mode, bool excl)
1636+ struct dentry *dentry, umode_t mode)
16371637 {
16381638 struct afs_operation *op;
16391639 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 = · 28 unmodified lines
2929
3030 static int bad_inode_create(struct mnt_idmap *idmap,
3131 struct inode *dir, struct dentry *dentry,
32− umode_t mode, bool excl)
32+ umode_t mode)
3333 {
3434 return -EIO;
3535 }
fs/bfs/dir.c+1−1
@@ -83,7 +83,7 @@ const struct file_operations bfs_dir_operations = { · 82 unmodified lines
8383 };
8484
8585 static int bfs_create(struct mnt_idmap *idmap, struct inode *dir,
86− struct dentry *dentry, umode_t mode, bool excl)
86+ struct dentry *dentry, umode_t mode)
8787 {
8888 int err;
8989 struct inode *inode;
fs/btrfs/inode.c+1−1
@@ -7007,7 +7007,7 @@ static int btrfs_mknod(struct mnt_idmap *idmap, struct inode *dir, · 7006 unmodified lines
70077007 }
70087008
70097009 static int btrfs_create(struct mnt_idmap *idmap, struct inode *dir,
7010− struct dentry *dentry, umode_t mode, bool excl)
7010+ struct dentry *dentry, umode_t mode)
70117011 {
70127012 struct inode *inode;
70137013
fs/ceph/dir.c+1−1
@@ -983,7 +983,7 @@ out: · 982 unmodified lines
983983 }
984984
985985 static int ceph_create(struct mnt_idmap *idmap, struct inode *dir,
986− struct dentry *dentry, umode_t mode, bool excl)
986+ struct dentry *dentry, umode_t mode)
987987 {
988988 return ceph_mknod(idmap, dir, dentry, mode, 0);
989989 }
fs/coda/dir.c+1−1
@@ -134,7 +134,7 @@ static inline void coda_dir_drop_nlink(struct inode *dir) · 133 unmodified lines
134134
135135 /* creation routines: create, mknod, mkdir, link, symlink */
136136 static int coda_create(struct mnt_idmap *idmap, struct inode *dir,
137− struct dentry *de, umode_t mode, bool excl)
137+ struct dentry *de, umode_t mode)
138138 {
139139 int error;
140140 const char *name=de->d_name.name;
fs/ecryptfs/inode.c+1−1
@@ -268,7 +268,7 @@ out: · 267 unmodified lines
268268 static int
269269 ecryptfs_create(struct mnt_idmap *idmap,
270270 struct inode *directory_inode, struct dentry *ecryptfs_dentry,
271− umode_t mode, bool excl)
271+ umode_t mode)
272272 {
273273 struct inode *ecryptfs_inode;
274274 int rc;
fs/efivarfs/inode.c+1−1
@@ -75,7 +75,7 @@ static bool efivarfs_valid_name(const char *str, int len) · 74 unmodified lines
7575 }
7676
7777 static int efivarfs_create(struct mnt_idmap *idmap, struct inode *dir,
78− struct dentry *dentry, umode_t mode, bool excl)
78+ struct dentry *dentry, umode_t mode)
7979 {
8080 struct inode *inode = NULL;
8181 struct efivar_entry *var;
fs/exfat/namei.c+1−1
@@ -538,7 +538,7 @@ out: · 537 unmodified lines
538538 }
539539
540540 static int exfat_create(struct mnt_idmap *idmap, struct inode *dir,
541− struct dentry *dentry, umode_t mode, bool excl)
541+ struct dentry *dentry, umode_t mode)
542542 {
543543 struct super_block *sb = dir->i_sb;
544544 struct inode *inode;
fs/ext2/namei.c+1−1
@@ -99,7 +99,7 @@ struct dentry *ext2_get_parent(struct dentry *child) · 98 unmodified lines
9999 */
100100 static int ext2_create (struct mnt_idmap * idmap,
101101 struct inode * dir, struct dentry * dentry,
102− umode_t mode, bool excl)
102+ umode_t mode)
103103 {
104104 struct inode *inode;
105105 int err;
fs/ext4/namei.c+1−1
@@ -2811,7 +2811,7 @@ static int ext4_add_nondir(handle_t *handle, · 2810 unmodified lines
28112811 * with d_instantiate().
28122812 */
28132813 static int ext4_create(struct mnt_idmap *idmap, struct inode *dir,
2814− struct dentry *dentry, umode_t mode, bool excl)
2814+ struct dentry *dentry, umode_t mode)
28152815 {
28162816 handle_t *handle;
28172817 struct inode *inode;
fs/f2fs/namei.c+1−1
@@ -366,7 +366,7 @@ fail_drop: · 365 unmodified lines
366366 }
367367
368368 static int f2fs_create(struct mnt_idmap *idmap, struct inode *dir,
369− struct dentry *dentry, umode_t mode, bool excl)
369+ struct dentry *dentry, umode_t mode)
370370 {
371371 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
372372 struct f2fs_lock_context lc;
fs/fat/namei_msdos.c+1−1
@@ -265,7 +265,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name, · 264 unmodified lines
265265
266266 /***** Create a file */
267267 static int msdos_create(struct mnt_idmap *idmap, struct inode *dir,
268− struct dentry *dentry, umode_t mode, bool excl)
268+ struct dentry *dentry, umode_t mode)
269269 {
270270 struct super_block *sb = dir->i_sb;
271271 struct inode *inode = NULL;
fs/fat/namei_vfat.c+1−1
@@ -755,7 +755,7 @@ error: · 754 unmodified lines
755755 }
756756
757757 static int vfat_create(struct mnt_idmap *idmap, struct inode *dir,
758− struct dentry *dentry, umode_t mode, bool excl)
758+ struct dentry *dentry, umode_t mode)
759759 {
760760 struct super_block *sb = dir->i_sb;
761761 struct inode *inode;
fs/fuse/dir.c+1−1
@@ -1084,7 +1084,7 @@ static int fuse_mknod(struct mnt_idmap *idmap, struct inode *dir, · 1083 unmodified lines
10841084 }
10851085
10861086 static int fuse_create(struct mnt_idmap *idmap, struct inode *dir,
1087− struct dentry *entry, umode_t mode, bool excl)
1087+ struct dentry *entry, umode_t mode)
10881088 {
10891089 return fuse_mknod(idmap, dir, entry, mode, 0);
10901090 }
fs/gfs2/inode.c+2−3
@@ -963,15 +963,14 @@ fail: · 962 unmodified lines
963963 * @dir: The directory in which to create the file
964964 * @dentry: The dentry of the new file
965965 * @mode: The mode of the new file
966− * @excl: Force fail if inode exists
967966 *
968967 * Returns: errno
969968 */
970969
971970 static int gfs2_create(struct mnt_idmap *idmap, struct inode *dir,
972− struct dentry *dentry, umode_t mode, bool excl)
971+ struct dentry *dentry, umode_t mode)
973972 {
974− return gfs2_create_inode(dir, dentry, NULL, S_IFREG | mode, 0, NULL, 0, excl);
973+ return gfs2_create_inode(dir, dentry, NULL, S_IFREG | mode, 0, NULL, 0, 1);
975974 }
976975
977976 /**
fs/hfs/dir.c+1−1
@@ -184,7 +184,7 @@ static int hfs_dir_release(struct inode *inode, struct file *file) · 183 unmodified lines
184184 * the directory and the name (and its length) of the new file.
185185 */
186186 static int hfs_create(struct mnt_idmap *idmap, struct inode *dir,
187− struct dentry *dentry, umode_t mode, bool excl)
187+ struct dentry *dentry, umode_t mode)
188188 {
189189 struct inode *inode;
190190 int res;
fs/hfsplus/dir.c+1−1
@@ -562,7 +562,7 @@ out: · 561 unmodified lines
562562 }
563563
564564 static int hfsplus_create(struct mnt_idmap *idmap, struct inode *dir,
565− struct dentry *dentry, umode_t mode, bool excl)
565+ struct dentry *dentry, umode_t mode)
566566 {
567567 return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
568568 }
fs/hostfs/hostfs_kern.c+1−1
@@ -593,7 +593,7 @@ static struct inode *hostfs_iget(struct super_block *sb, char *name) · 592 unmodified lines
593593 }
594594
595595 static int hostfs_create(struct mnt_idmap *idmap, struct inode *dir,
596− struct dentry *dentry, umode_t mode, bool excl)
596+ struct dentry *dentry, umode_t mode)
597597 {
598598 struct inode *inode;
599599 char *name;
fs/hpfs/namei.c+1−1
@@ -129,7 +129,7 @@ bail: · 128 unmodified lines
129129 }
130130
131131 static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
132− struct dentry *dentry, umode_t mode, bool excl)
132+ struct dentry *dentry, umode_t mode)
133133 {
134134 const unsigned char *name = dentry->d_name.name;
135135 unsigned len = dentry->d_name.len;
fs/hugetlbfs/inode.c+1−1
@@ -979,7 +979,7 @@ static struct dentry *hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dir · 978 unmodified lines
979979
980980 static int hugetlbfs_create(struct mnt_idmap *idmap,
981981 struct inode *dir, struct dentry *dentry,
982− umode_t mode, bool excl)
982+ umode_t mode)
983983 {
984984 return hugetlbfs_mknod(idmap, dir, dentry, mode | S_IFREG, 0);
985985 }
fs/jffs2/dir.c+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 static int jffs2_readdir (struct file *, struct dir_context *);
2727
2828 static int jffs2_create (struct mnt_idmap *, struct inode *,
29− struct dentry *, umode_t, bool);
29+ struct dentry *, umode_t);
3030 static struct dentry *jffs2_lookup (struct inode *,struct dentry *,
3131 unsigned int);
3232 static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
@@ -163,7 +163,7 @@ static int jffs2_readdir(struct file *file, struct dir_context *ctx) · 130 unmodified lines
163163
164164
165165 static int jffs2_create(struct mnt_idmap *idmap, struct inode *dir_i,
166− struct dentry *dentry, umode_t mode, bool excl)
166+ struct dentry *dentry, umode_t mode)
167167 {
168168 struct jffs2_raw_inode *ri;
169169 struct jffs2_inode_info *f, *dir_f;
fs/jfs/namei.c+1−1
@@ -61,7 +61,7 @@ static inline void free_ea_wmap(struct inode *inode) · 60 unmodified lines
6161 *
6262 */
6363 static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
64− struct dentry *dentry, umode_t mode, bool excl)
64+ struct dentry *dentry, umode_t mode)
6565 {
6666 int rc = 0;
6767 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, · 63 unmodified lines
6464 }
6565
6666 static int minix_create(struct mnt_idmap *idmap, struct inode *dir,
67− struct dentry *dentry, umode_t mode, bool excl)
67+ struct dentry *dentry, umode_t mode)
6868 {
6969 return minix_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
7070 }
fs/namei.c+248−109
@@ -4199,7 +4199,7 @@ int vfs_create(struct mnt_idmap *idmap, struct dentry *dentry, umode_t mode, · 4198 unmodified lines
41994199 error = try_break_deleg(dir, LEASE_BREAK_DIR_CREATE, di);
42004200 if (error)
42014201 return error;
4202− error = dir->i_op->create(idmap, dir, dentry, mode, true);
4202+ error = dir->i_op->create(idmap, dir, dentry, mode);
42034203 if (!error)
42044204 fsnotify_create(dir, dentry);
42054205 return error;
@@ -4336,50 +4336,83 @@ static int may_o_create(struct mnt_idmap *idmap, · 130 unmodified lines
43364336 return security_inode_create(dir->dentry->d_inode, dentry, mode);
43374337 }
43384338
4339−/*
4340− * Attempt to atomically look up, create and open a file from a negative
4341− * dentry.
4342− *
4343− * Returns 0 if successful. The file will have been created and attached to
4344− * @file by the filesystem calling finish_open().
4345− *
4346− * If the file was looked up only or didn't need creating, FMODE_OPENED won't
4347− * be set. The caller will need to perform the open themselves. @path will
4348− * have been updated to point to the new dentry. This may be negative.
4349− *
4350− * Returns an error code otherwise.
4339+/**
4340+ * atomic_open() - atomically look up, create and open a file
4341+ * @path: parent directory path
4342+ * @dentry: child to ->atomic_open()
4343+ * @file: file to attach child to
4344+ * @open_flag: open flags
4345+ * @mode: create mode
4346+ * @create_error: return value from may_o_create()
4347+ *
4348+ * Attempt to look up, create and open @dentry, which must be negative, in a
4349+ * single call into the filesystem.
4350+ *
4351+ * If a non-error dentry is returned then: when FMODE_OPENED is set,
4352+ * the file will have been attached to @file by the filesystem calling
4353+ * finish_open(). If FMODE_OPENED isn't set, the filesystem instead called
4354+ * finish_no_open() and the caller will need to perform the open themselves.
4355+ *
4356+ * FMODE_CREATED is set when the call to ->atomic_open() actually created
4357+ * the file.
4358+ *
4359+ * Returns: the opened or looked-up dentry, or ERR_PTR() on failure. The
4360+ * reference to @dentry is consumed in either case.
43514361 */
43524362 static struct dentry *atomic_open(const struct path *path, struct dentry *dentry,
43534363 struct file *file,
4354− int open_flag, umode_t mode)
4364+ int open_flag, umode_t mode, int create_error)
43554365 {
43564366 struct dentry *const DENTRY_NOT_SET = (void *) -1UL;
4357− struct inode *dir = path->dentry->d_inode;
4367+ struct inode *dir_inode = path->dentry->d_inode;
43584368 int error;
43594369
43604370 file->__f_path.dentry = DENTRY_NOT_SET;
43614371 file->__f_path.mnt = path->mnt;
4362− error = dir->i_op->atomic_open(dir, dentry, file,
4372+ error = dir_inode->i_op->atomic_open(dir_inode, dentry, file,
43634373 open_to_namei_flags(open_flag), mode);
43644374 d_lookup_done(dentry);
4375+
43654376 if (!error) {
43664377 if (file->f_mode & FMODE_OPENED) {
4367− if (unlikely(dentry != file->f_path.dentry)) {
4378+ /* finish_open() called */
4379+ struct dentry *opened = file->f_path.dentry;
4380+
4381+ if (unlikely(opened != dentry)) {
43684382 dput(dentry);
4369− dentry = dget(file->f_path.dentry);
4383+ dentry = dget(opened);
43704384 }
4371− } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) {
4372− error = -EIO;
4373− } else {
4374− if (file->f_path.dentry) {
4385+ } else if (likely(file->f_path.dentry != DENTRY_NOT_SET)) {
4386+ /* finish_no_open() called */
4387+ struct dentry *replaced = file->f_path.dentry;
4388+
4389+ if (replaced) {
43754390 dput(dentry);
4376− dentry = file->f_path.dentry;
4391+ dentry = replaced;
43774392 }
43784393 if (unlikely(d_is_negative(dentry)))
43794394 error = -ENOENT;
4395+ } else {
4396+ const char *fsname = dentry->d_sb->s_type->name;
4397+
4398+ WARN(1, "%s: ->atomic_open() left file->f_path.dentry unset!\n",
4399+ fsname);
4400+ error = -EIO;
43804401 }
43814402 }
4403+
43824404 if (error) {
4405+ if (unlikely(create_error) && error == -ENOENT) {
4406+ /*
4407+ * Should have done a create, but errored before.
4408+ * Some filesystems return -ENOENT directly instead of
4409+ * calling finish_no_open() with a negative dentry;
4410+ * either way it should only mean the child doesn't exist,
4411+ * so a refused create is safe to record here.
4412+ */
4413+ audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE);
4414+ error = create_error;
4415+ }
43834416 dput(dentry);
43844417 dentry = ERR_PTR(error);
43854418 }
@@ -4389,32 +4422,52 @@ static struct dentry *atomic_open(const struct path *path, struct dentry *dentry · 3 unmodified lines
43894422 /*
43904423 * Look up and maybe create and open the last component.
43914424 *
4392− * Must be called with parent locked (exclusive in O_CREAT case).
4425+ * Takes the parent inode lock itself, exclusive if O_CREAT was requested and
4426+ * shared otherwise, and drops it again before returning. The caller must not
4427+ * hold it.
43934428 *
4394− * Returns 0 on success, that is, if
4395− * the file was successfully atomically created (if necessary) and opened, or
4396− * the file was not completely opened at this time, though lookups and
4397− * creations were performed.
4398− * These case are distinguished by presence of FMODE_OPENED on file->f_mode.
4399− * In the latter case dentry returned in @path might be negative if O_CREAT
4400− * hadn't been specified.
4429+ * On success returns the dentry of the last component. If FMODE_OPENED is set
4430+ * on file->f_mode the file was also opened and attached to @file; otherwise
4431+ * only lookup and creation were performed and the caller has to open it. In
4432+ * the latter case the dentry may be negative if O_CREAT hadn't been specified.
44014433 *
4402− * An error code is returned on failure.
4434+ * Returns ERR_PTR() on failure.
44034435 */
44044436 static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
4405− const struct open_flags *op,
4406− bool got_write, struct delegated_inode *delegated_inode)
4437+ const struct open_flags *op)
44074438 {
4439+ struct delegated_inode delegated_inode = { };
44084440 struct mnt_idmap *idmap;
44094441 struct dentry *dir = nd->path.dentry;
44104442 struct inode *dir_inode = dir->d_inode;
4411− int open_flag = op->open_flag;
4443+ int open_flag;
44124444 struct dentry *dentry;
4413− int error, create_error = 0;
4414− umode_t mode = op->mode;
4445+ int error, create_error;
4446+ umode_t mode;
4447+ bool got_write;
44154448
4416− if (unlikely(IS_DEADDIR(dir_inode)))
4417− return ERR_PTR(-ENOENT);
4449+retry:
4450+ open_flag = op->open_flag;
4451+ got_write = false;
4452+ mode = op->mode;
4453+ create_error = 0;
4454+
4455+ if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
4456+ got_write = !mnt_want_write(nd->path.mnt);
4457+ /*
4458+ * do _not_ fail yet - we might not need that or fail with
4459+ * a different error; we'll be dropping this one anyway.
4460+ */
4461+ }
4462+ if (open_flag & O_CREAT)
4463+ inode_lock(dir_inode);
4464+ else
4465+ inode_lock_shared(dir_inode);
4466+
4467+ if (unlikely(IS_DEADDIR(dir_inode))) {
4468+ dentry = ERR_PTR(-ENOENT);
4469+ goto out;
4470+ }
44184471
44194472 file->f_mode &= ~FMODE_CREATED;
44204473 dentry = d_lookup(dir, &nd->last);
@@ -4422,7 +4475,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 1 unmodified line
44224475 if (!dentry) {
44234476 dentry = d_alloc_parallel(dir, &nd->last);
44244477 if (IS_ERR(dentry))
4425− return dentry;
4478+ goto out;
44264479 }
44274480 if (d_in_lookup(dentry))
44284481 break;
@@ -4437,8 +4490,8 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 8 unmodified lines
44374490 dentry = NULL;
44384491 }
44394492 if (dentry->d_inode) {
4440− /* Cached positive dentry: will open in f_op->open */
4441− return dentry;
4493+ /* Cached positive dentry: will open in do_open(). */
4494+ goto out;
44424495 }
44434496
44444497 if (open_flag & O_CREAT)
@@ -4459,7 +4512,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 14 unmodified lines
44594512 if (open_flag & O_CREAT) {
44604513 if (open_flag & O_EXCL)
44614514 open_flag &= ~O_TRUNC;
4462− mode = vfs_prepare_mode(idmap, dir->d_inode, mode, mode, mode);
4515+ mode = vfs_prepare_mode(idmap, dir_inode, mode, mode, mode);
44634516 if (likely(got_write))
44644517 create_error = may_o_create(idmap, &nd->path,
44654518 dentry, mode);
@@ -4471,10 +4524,9 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 5 unmodified lines
44714524 if (dir_inode->i_op->atomic_open) {
44724525 if (nd->flags & LOOKUP_DIRECTORY)
44734526 open_flag |= O_DIRECTORY;
4474− dentry = atomic_open(&nd->path, dentry, file, open_flag, mode);
4475− if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT))
4476− dentry = ERR_PTR(create_error);
4477− return dentry;
4527+ dentry = atomic_open(&nd->path, dentry, file, open_flag, mode,
4528+ create_error);
4529+ goto out;
44784530 }
44794531
44804532 if (d_in_lookup(dentry)) {
@@ -4490,37 +4542,164 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 9 unmodified lines
44904542 dentry = res;
44914543 }
44924544 }
4545+ if (dentry->d_inode || !(op->open_flag & O_CREAT)) {
4546+ /*
4547+ * No need to create a file. If lookup returned a positive
4548+ * dentry, the file will be opened in do_open().
4549+ */
4550+ goto out;
4551+ }
44934552
4494− /* Negative dentry, just create the file */
4495− if (!dentry->d_inode && (open_flag & O_CREAT)) {
4496− /* but break the directory lease first! */
4497− error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, delegated_inode);
4498− if (error)
4499− goto out_dput;
4553+ /* Negative dentry with O_CREAT flag set */
4554+ audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE);
45004555
4501− file->f_mode |= FMODE_CREATED;
4502− audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE);
4503− if (!dir_inode->i_op->create) {
4504− error = -EACCES;
4505− goto out_dput;
4506− }
4556+ if (unlikely(create_error)) {
4557+ /* should have done a create, but we already errored */
4558+ error = create_error;
4559+ goto out_dput;
4560+ }
45074561
4508− error = dir_inode->i_op->create(idmap, dir_inode, dentry,
4509− mode, open_flag & O_EXCL);
4510− if (error)
4511− goto out_dput;
4562+ error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, &delegated_inode);
4563+ if (error)
4564+ goto out_dput;
4565+
4566+ file->f_mode |= FMODE_CREATED;
4567+ if (!dir_inode->i_op->create) {
4568+ error = -EACCES;
4569+ goto out_dput;
45124570 }
4513− if (unlikely(create_error) && !dentry->d_inode) {
4514− error = create_error;
4571+
4572+ error = dir_inode->i_op->create(idmap, dir_inode, dentry, mode);
4573+ if (error)
45154574 goto out_dput;
4575+out:
4576+ if (!IS_ERR(dentry)) {
4577+ if (file->f_mode & FMODE_CREATED)
4578+ fsnotify_create(dir_inode, dentry);
4579+ if (file->f_mode & FMODE_OPENED)
4580+ fsnotify_open(file);
45164581 }
4582+ if ((open_flag & O_CREAT) || create_error)
4583+ inode_unlock(dir_inode);
4584+ else
4585+ inode_unlock_shared(dir_inode);
4586+
4587+ if (got_write)
4588+ mnt_drop_write(nd->path.mnt);
4589+
4590+ if (is_delegated(&delegated_inode)) {
4591+ /* Must have come through out_dput: dentry is an ERR_PTR() */
4592+ error = break_deleg_wait(&delegated_inode);
4593+
4594+ if (!error)
4595+ goto retry;
4596+ dentry = ERR_PTR(error);
4597+ }
4598+
45174599 return dentry;
45184600
45194601 out_dput:
45204602 dput(dentry);
4521− return ERR_PTR(error);
4603+ dentry = ERR_PTR(error);
4604+ goto out;
45224605 }
45234606
4607+/**
4608+ * vfs_lookup_open - open and possibly create a regular file
4609+ * @parent: directory to contain file
4610+ * @last: final component of file name
4611+ * @open_flag: O_flags
4612+ * @mode: initial permissions for file
4613+ *
4614+ * Open a file after lookup and/or create. This provides similar
4615+ * functionality to open_last_lookups() for non-VFS users, particularly
4616+ * nfsd.
4617+ * It uses ->atomic_open or ->lookup / ->create / ->open as appropriate.
4618+ *
4619+ * If the fs object found is not a regular file then an error is returned.
4620+ * In some cases, related errors are repurposed so that the caller can
4621+ * determine the type of file found from the error.
4622+ * -EISDIR : a directory was found
4623+ * -ELOOP : a symlink was found
4624+ * -ENODEV : a block or character device special file was found
4625+ * -EFTYPE : any other non-regular file was found, such as FIFO or SOCK.
4626+ * or ->atomic_open responded to __O_REGULAR.
4627+ *
4628+ * Returns: the opened struct file, or an error.
4629+ */
4630+struct file *vfs_lookup_open(struct path *parent, struct qstr *last,
4631+ int open_flag, umode_t mode)
4632+{
4633+ struct file *file __free(fput) = NULL;
4634+ struct nameidata nd = {};
4635+ struct open_flags op = {};
4636+ struct dentry *dentry;
4637+ int error = 0;
4638+
4639+ WARN_ONCE(mode & ~S_IALLUGO, "mode must only have permission bits");
4640+ WARN_ONCE(open_flag & ~(O_ACCMODE|O_CREAT|O_EXCL|O_TRUNC|__O_REGULAR),
4641+ "open_flag has unsupported flags");
4642+
4643+ mode |= S_IFREG;
4644+ open_flag |= __O_REGULAR;
4645+
4646+ error = lookup_noperm_common(last, parent->dentry);
4647+ if (error)
4648+ return ERR_PTR(error);
4649+
4650+ file = alloc_empty_file(open_flag, current_cred());
4651+ if (IS_ERR(file))
4652+ return file;
4653+
4654+ nd.path = *parent;
4655+ nd.last = *last;
4656+ nd.flags = LOOKUP_OPEN;
4657+ if (open_flag & O_CREAT) {
4658+ nd.flags |= LOOKUP_CREATE;
4659+ if (open_flag & O_EXCL)
4660+ nd.flags |= LOOKUP_EXCL;
4661+ }
4662+ op.open_flag = open_flag;
4663+ op.mode = mode;
4664+ dentry = lookup_open(&nd, file, &op);
4665+
4666+ if (IS_ERR(dentry))
4667+ return ERR_CAST(dentry);
4668+
4669+ if (d_really_is_negative(dentry)) {
4670+ error = -ENOENT;
4671+ } else if (!(file->f_mode & FMODE_CREATED) && (open_flag & O_EXCL)) {
4672+ error = -EEXIST;
4673+ } else if ((dentry->d_inode->i_mode & S_IFMT) != S_IFREG) {
4674+ switch (dentry->d_inode->i_mode & S_IFMT) {
4675+ case S_IFDIR:
4676+ error = -EISDIR;
4677+ break;
4678+ case S_IFLNK:
4679+ error = -ELOOP;
4680+ break;
4681+ case S_IFBLK:
4682+ case S_IFCHR:
4683+ error = -ENODEV;
4684+ break;
4685+ case S_IFIFO:
4686+ case S_IFSOCK:
4687+ default:
4688+ error = -EFTYPE;
4689+ break;
4690+ }
4691+ } else if (!(file->f_mode & FMODE_OPENED)) {
4692+ nd.path.dentry = dentry;
4693+ error = vfs_open(&nd.path, file);
4694+ }
4695+ dput(dentry);
4696+
4697+ if (error)
4698+ return ERR_PTR(error);
4699+ return no_free_ptr(file);
4700+}
4701+EXPORT_SYMBOL_FOR_MODULES(vfs_lookup_open, "nfsd");
4702+
45244703 static inline bool trailing_slashes(struct nameidata *nd)
45254704 {
45264705 return (bool)nd->last.name[nd->last.len];
@@ -4560,10 +4739,7 @@ static struct dentry *lookup_fast_for_open(struct nameidata *nd, int open_flag) · 33 unmodified lines
45604739 static const char *open_last_lookups(struct nameidata *nd,
45614740 struct file *file, const struct open_flags *op)
45624741 {
4563− struct delegated_inode delegated_inode = { };
4564− struct dentry *dir = nd->path.dentry;
45654742 int open_flag = op->open_flag;
4566− bool got_write = false;
45674743 struct dentry *dentry;
45684744 const char *res;
45694745
@@ -4592,44 +4768,10 @@ static const char *open_last_lookups(struct nameidata *nd, · 22 unmodified lines
45924768 return ERR_PTR(-ECHILD);
45934769 }
45944770 }
4595−retry:
4596− if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
4597− got_write = !mnt_want_write(nd->path.mnt);
4598− /*
4599− * do _not_ fail yet - we might not need that or fail with
4600− * a different error; let lookup_open() decide; we'll be
4601− * dropping this one anyway.
4602− */
4603− }
4604− if (open_flag & O_CREAT)
4605− inode_lock(dir->d_inode);
4606− else
4607− inode_lock_shared(dir->d_inode);
4608− dentry = lookup_open(nd, file, op, got_write, &delegated_inode);
4609− if (!IS_ERR(dentry)) {
4610− if (file->f_mode & FMODE_CREATED)
4611− fsnotify_create(dir->d_inode, dentry);
4612− if (file->f_mode & FMODE_OPENED)
4613− fsnotify_open(file);
4614− }
4615− if (open_flag & O_CREAT)
4616− inode_unlock(dir->d_inode);
4617− else
4618− inode_unlock_shared(dir->d_inode);
4619−
4620− if (got_write)
4621− mnt_drop_write(nd->path.mnt);
4622−
4623− if (IS_ERR(dentry)) {
4624− if (is_delegated(&delegated_inode)) {
4625− int error = break_deleg_wait(&delegated_inode);
46264771
4627− if (!error)
4628− goto retry;
4629− return ERR_PTR(error);
4630− }
4772+ dentry = lookup_open(nd, file, op);
4773+ if (IS_ERR(dentry))
46314774 return ERR_CAST(dentry);
4632− }
46334775
46344776 if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) {
46354777 dput(nd->path.dentry);
@@ -5051,7 +5193,7 @@ struct file *dentry_create(struct path *path, int flags, umode_t mode, · 415 unmodified lines
50515193
50525194 /* atomic_open will dput(dentry) on error */
50535195 dget(orig_dentry);
5054− dentry = atomic_open(path, dentry, file, flags, mode);
5196+ dentry = atomic_open(path, dentry, file, flags, mode, create_error);
50555197 error = PTR_ERR_OR_ZERO(dentry);
50565198
50575199 if (IS_ERR(dentry))
@@ -5061,9 +5203,6 @@ struct file *dentry_create(struct path *path, int flags, umode_t mode, · 3 unmodified lines
50615203 /* Drop the extra reference */
50625204 dput(orig_dentry);
50635205
5064− if (unlikely(create_error) && error == -ENOENT)
5065− error = create_error;
5066−
50675206 if (!error) {
50685207 if (file->f_mode & FMODE_CREATED)
50695208 fsnotify_create(dir->d_inode, dentry);
fs/nfs/dir.c+2−2
@@ -2427,9 +2427,9 @@ out_err: · 2426 unmodified lines
24272427 }
24282428
24292429 int nfs_create(struct mnt_idmap *idmap, struct inode *dir,
2430− struct dentry *dentry, umode_t mode, bool excl)
2430+ struct dentry *dentry, umode_t mode)
24312431 {
2432− return nfs_do_create(dir, dentry, mode, excl ? O_EXCL : 0);
2432+ return nfs_do_create(dir, dentry, mode, O_EXCL);
24332433 }
24342434 EXPORT_SYMBOL_GPL(nfs_create);
24352435
fs/nfs/internal.h+1−1
@@ -395,7 +395,7 @@ extern unsigned long nfs_access_cache_scan(struct shrinker *shrink, · 394 unmodified lines
395395 struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int);
396396 void nfs_d_prune_case_insensitive_aliases(struct inode *inode);
397397 int nfs_create(struct mnt_idmap *, struct inode *, struct dentry *,
398− umode_t, bool);
398+ umode_t);
399399 struct dentry *nfs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
400400 umode_t);
401401 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) · 85 unmodified lines
8686 * with d_instantiate().
8787 */
8888 static int nilfs_create(struct mnt_idmap *idmap, struct inode *dir,
89− struct dentry *dentry, umode_t mode, bool excl)
89+ struct dentry *dentry, umode_t mode)
9090 {
9191 struct inode *inode;
9292 struct nilfs_transaction_info ti;
fs/ntfs/namei.c+1−1
@@ -737,7 +737,7 @@ err_out: · 736 unmodified lines
737737 }
738738
739739 static int ntfs_create(struct mnt_idmap *idmap, struct inode *dir,
740− struct dentry *dentry, umode_t mode, bool excl)
740+ struct dentry *dentry, umode_t mode)
741741 {
742742 struct ntfs_volume *vol = NTFS_SB(dir->i_sb);
743743 struct ntfs_inode *ni;
fs/ntfs3/namei.c+1−1
@@ -105,7 +105,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry, · 104 unmodified lines
105105 * ntfs_create - inode_operations::create
106106 */
107107 static int ntfs_create(struct mnt_idmap *idmap, struct inode *dir,
108− struct dentry *dentry, umode_t mode, bool excl)
108+ struct dentry *dentry, umode_t mode)
109109 {
110110 return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFREG | mode, 0,
111111 NULL, 0, NULL);
fs/ocfs2/dlmfs/dlmfs.c+1−2
@@ -453,8 +453,7 @@ bail: · 452 unmodified lines
453453 static int dlmfs_create(struct mnt_idmap *idmap,
454454 struct inode *dir,
455455 struct dentry *dentry,
456− umode_t mode,
457− bool excl)
456+ umode_t mode)
458457 {
459458 int status = 0;
460459 struct inode *inode;
fs/ocfs2/namei.c+1−2
@@ -667,8 +667,7 @@ static struct dentry *ocfs2_mkdir(struct mnt_idmap *idmap, · 666 unmodified lines
667667 static int ocfs2_create(struct mnt_idmap *idmap,
668668 struct inode *dir,
669669 struct dentry *dentry,
670− umode_t mode,
671− bool excl)
670+ umode_t mode)
672671 {
673672 int ret;
674673
fs/omfs/dir.c+1−1
@@ -286,7 +286,7 @@ static struct dentry *omfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 285 unmodified lines
286286 }
287287
288288 static int omfs_create(struct mnt_idmap *idmap, struct inode *dir,
289− struct dentry *dentry, umode_t mode, bool excl)
289+ struct dentry *dentry, umode_t mode)
290290 {
291291 return omfs_add_node(dir, dentry, mode | S_IFREG);
292292 }
fs/orangefs/namei.c+1−2
@@ -18,8 +18,7 @@ · 17 unmodified lines
1818 static int orangefs_create(struct mnt_idmap *idmap,
1919 struct inode *dir,
2020 struct dentry *dentry,
21− umode_t mode,
22− bool exclusive)
21+ umode_t mode)
2322 {
2423 struct orangefs_inode_s *parent = ORANGEFS_I(dir);
2524 struct orangefs_kernel_op_s *new_op;
fs/overlayfs/dir.c+1−1
@@ -732,7 +732,7 @@ out: · 731 unmodified lines
732732 }
733733
734734 static int ovl_create(struct mnt_idmap *idmap, struct inode *dir,
735− struct dentry *dentry, umode_t mode, bool excl)
735+ struct dentry *dentry, umode_t mode)
736736 {
737737 return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL);
738738 }
fs/ramfs/inode.c+1−1
@@ -128,7 +128,7 @@ static struct dentry *ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 127 unmodified lines
128128 }
129129
130130 static int ramfs_create(struct mnt_idmap *idmap, struct inode *dir,
131− struct dentry *dentry, umode_t mode, bool excl)
131+ struct dentry *dentry, umode_t mode)
132132 {
133133 return ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0);
134134 }
fs/smb/client/cifsfs.h+1−1
@@ -54,7 +54,7 @@ void cifs_sb_deactive(struct super_block *sb); · 53 unmodified lines
5454 extern const struct inode_operations cifs_dir_inode_ops;
5555 struct inode *cifs_root_iget(struct super_block *sb);
5656 int cifs_create(struct mnt_idmap *idmap, struct inode *dir,
57− struct dentry *direntry, umode_t mode, bool excl);
57+ struct dentry *direntry, umode_t mode);
5858 int cifs_atomic_open(struct inode *dir, struct dentry *direntry,
5959 struct file *file, unsigned int oflags, umode_t mode);
6060 int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
fs/smb/client/dir.c+1−1
@@ -645,7 +645,7 @@ out_free_xid: · 644 unmodified lines
645645 * hashed-positive by calling d_instantiate().
646646 */
647647 int cifs_create(struct mnt_idmap *idmap, struct inode *dir,
648− struct dentry *direntry, umode_t mode, bool excl)
648+ struct dentry *direntry, umode_t mode)
649649 {
650650 struct cifs_sb_info *cifs_sb = CIFS_SB(dir);
651651 int rc;
fs/ubifs/dir.c+1−1
@@ -303,7 +303,7 @@ static int ubifs_prepare_create(struct inode *dir, struct dentry *dentry, · 302 unmodified lines
303303 }
304304
305305 static int ubifs_create(struct mnt_idmap *idmap, struct inode *dir,
306− struct dentry *dentry, umode_t mode, bool excl)
306+ struct dentry *dentry, umode_t mode)
307307 {
308308 struct inode *inode;
309309 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) · 370 unmodified lines
371371 }
372372
373373 static int udf_create(struct mnt_idmap *idmap, struct inode *dir,
374− struct dentry *dentry, umode_t mode, bool excl)
374+ struct dentry *dentry, umode_t mode)
375375 {
376376 struct inode *inode = udf_new_inode(dir, mode);
377377
fs/ufs/namei.c+1−2
@@ -70,8 +70,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsi · 69 unmodified lines
7070 * with d_instantiate().
7171 */
7272 static int ufs_create (struct mnt_idmap * idmap,
73− struct inode * dir, struct dentry * dentry, umode_t mode,
74− bool excl)
73+ struct inode * dir, struct dentry * dentry, umode_t mode)
7574 {
7675 struct inode *inode;
7776
fs/vboxsf/dir.c+2−2
@@ -298,9 +298,9 @@ out: · 297 unmodified lines
298298
299299 static int vboxsf_dir_mkfile(struct mnt_idmap *idmap,
300300 struct inode *parent, struct dentry *dentry,
301− umode_t mode, bool excl)
301+ umode_t mode)
302302 {
303− return vboxsf_dir_create(parent, dentry, mode, false, excl, NULL);
303+ return vboxsf_dir_create(parent, dentry, mode, false, true, NULL);
304304 }
305305
306306 static struct dentry *vboxsf_dir_mkdir(struct mnt_idmap *idmap,
fs/xfs/xfs_iops.c+2−3
@@ -293,8 +293,7 @@ xfs_vn_create( · 292 unmodified lines
293293 struct mnt_idmap *idmap,
294294 struct inode *dir,
295295 struct dentry *dentry,
296− umode_t mode,
297− bool flags)
296+ umode_t mode)
298297 {
299298 return xfs_generic_create(idmap, dir, dentry, mode, 0, NULL);
300299 }
@@ -338,7 +337,7 @@ STATIC struct dentry * · 37 unmodified lines
338337 xfs_vn_ci_lookup(
339338 struct inode *dir,
340339 struct dentry *dentry,
341− unsigned int flags)
340+ unsigned int flags)
342341 {
343342 struct xfs_inode *ip;
344343 struct xfs_name xname;
include/linux/fs.h+1−1
@@ -2002,7 +2002,7 @@ struct inode_operations { · 2001 unmodified lines
20022002 int (*readlink) (struct dentry *, char __user *,int);
20032003
20042004 int (*create) (struct mnt_idmap *, struct inode *,struct dentry *,
2005− umode_t, bool);
2005+ umode_t);
20062006 int (*link) (struct dentry *,struct inode *,struct dentry *);
20072007 int (*unlink) (struct inode *,struct dentry *);
20082008 int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,
include/linux/namei.h+3−0
@@ -97,6 +97,9 @@ struct dentry *start_creating_dentry(struct dentry *parent, · 96 unmodified lines
9797 struct dentry *start_removing_dentry(struct dentry *parent,
9898 struct dentry *child);
9999
100+struct file *vfs_lookup_open(struct path *parent, struct qstr *last,
101+ int open_flag, umode_t mode);
102+
100103 /* end_creating - finish action started with start_creating
101104 * @child: dentry returned by start_creating() or vfs_mkdir()
102105 *
ipc/mqueue.c+1−1
@@ -608,7 +608,7 @@ out_unlock: · 607 unmodified lines
608608 }
609609
610610 static int mqueue_create(struct mnt_idmap *idmap, struct inode *dir,
611− struct dentry *dentry, umode_t mode, bool excl)
611+ struct dentry *dentry, umode_t mode)
612612 {
613613 return mqueue_create_attr(dentry, mode, NULL);
614614 }
mm/shmem.c+1−1
@@ -3874,7 +3874,7 @@ static struct dentry *shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 3873 unmodified lines
38743874 }
38753875
38763876 static int shmem_create(struct mnt_idmap *idmap, struct inode *dir,
3877− struct dentry *dentry, umode_t mode, bool excl)
3877+ struct dentry *dentry, umode_t mode)
38783878 {
38793879 return shmem_mknod(idmap, dir, dentry, mode | S_IFREG, 0);
38803880 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t