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()
Unified · Split
| @@ -61,7 +61,7 @@ inode_operations · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | prototypes:: | 62 | prototypes:: |
| 63 | 63 | ||
| 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); |
| 65 | struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); | 65 | struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); |
| 66 | int (*link) (struct dentry *,struct inode *,struct dentry *); | 66 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
| 67 | int (*unlink) (struct inode *,struct dentry *); | 67 | int (*unlink) (struct inode *,struct dentry *); |
| @@ -1401,3 +1401,11 @@ as with d_dispose_if_unused() these are not trivial; with this variant · 1400 unmodified lines | |||
| 1401 | of API it's more explicit, since grabbing ->d_lock is caller-side, but | 1401 | of API it's more explicit, since grabbing ->d_lock is caller-side, but |
| 1402 | d_dispose_if_unused() had all the same issues. It's a low-level primitive; | 1402 | d_dispose_if_unused() had all the same issues. It's a low-level primitive; |
| 1403 | use only if you have no alternative. | 1403 | 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. | ||
| @@ -415,7 +415,7 @@ As of kernel 2.6.22, the following members are defined: · 414 unmodified lines | |||
| 415 | .. code-block:: c | 415 | .. code-block:: c |
| 416 | 416 | ||
| 417 | struct inode_operations { | 417 | 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); |
| 419 | struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); | 419 | struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); |
| 420 | int (*link) (struct dentry *,struct inode *,struct dentry *); | 420 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
| 421 | int (*unlink) (struct inode *,struct dentry *); | 421 | int (*unlink) (struct inode *,struct dentry *); |
| @@ -645,7 +645,6 @@ error: · 644 unmodified lines | |||
| 645 | * @dir: The parent directory | 645 | * @dir: The parent directory |
| 646 | * @dentry: The name of file to be created | 646 | * @dentry: The name of file to be created |
| 647 | * @mode: The UNIX file mode to set | 647 | * @mode: The UNIX file mode to set |
| 648 | * @excl: True if the file must not yet exist | ||
| 649 | * | 648 | * |
| 650 | * open(.., O_CREAT) is handled in v9fs_vfs_atomic_open(). This is only called | 649 | * open(.., O_CREAT) is handled in v9fs_vfs_atomic_open(). This is only called |
| 651 | * for mknod(2). | 650 | * for mknod(2). |
| @@ -654,7 +653,7 @@ error: · 2 unmodified lines | |||
| 654 | 653 | ||
| 655 | static int | 654 | static int |
| 656 | v9fs_vfs_create(struct mnt_idmap *idmap, struct inode *dir, | 655 | 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) |
| 658 | { | 657 | { |
| 659 | struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); | 658 | struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); |
| 660 | u32 perm = unixmode2p9mode(v9ses, mode); | 659 | u32 perm = unixmode2p9mode(v9ses, mode); |
| @@ -213,12 +213,11 @@ int v9fs_open_to_dotl_flags(int flags) · 212 unmodified lines | |||
| 213 | * @dir: directory inode that is being created | 213 | * @dir: directory inode that is being created |
| 214 | * @dentry: dentry that is being deleted | 214 | * @dentry: dentry that is being deleted |
| 215 | * @omode: create permissions | 215 | * @omode: create permissions |
| 216 | * @excl: True if the file must not yet exist | ||
| 217 | * | 216 | * |
| 218 | */ | 217 | */ |
| 219 | static int | 218 | static int |
| 220 | v9fs_vfs_create_dotl(struct mnt_idmap *idmap, struct inode *dir, | 219 | 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) |
| 222 | { | 221 | { |
| 223 | return v9fs_vfs_mknod_dotl(idmap, dir, dentry, omode, 0); | 222 | return v9fs_vfs_mknod_dotl(idmap, dir, dentry, omode, 0); |
| 224 | } | 223 | } |
| @@ -169,7 +169,7 @@ extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int l · 168 unmodified lines | |||
| 169 | extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int); | 169 | extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int); |
| 170 | extern int affs_unlink(struct inode *dir, struct dentry *dentry); | 170 | extern int affs_unlink(struct inode *dir, struct dentry *dentry); |
| 171 | extern int affs_create(struct mnt_idmap *idmap, struct inode *dir, | 171 | 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); |
| 173 | extern struct dentry *affs_mkdir(struct mnt_idmap *idmap, struct inode *dir, | 173 | extern struct dentry *affs_mkdir(struct mnt_idmap *idmap, struct inode *dir, |
| 174 | struct dentry *dentry, umode_t mode); | 174 | struct dentry *dentry, umode_t mode); |
| 175 | extern int affs_rmdir(struct inode *dir, struct dentry *dentry); | 175 | extern int affs_rmdir(struct inode *dir, struct dentry *dentry); |
| @@ -243,7 +243,7 @@ affs_unlink(struct inode *dir, struct dentry *dentry) · 242 unmodified lines | |||
| 243 | 243 | ||
| 244 | int | 244 | int |
| 245 | affs_create(struct mnt_idmap *idmap, struct inode *dir, | 245 | 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) |
| 247 | { | 247 | { |
| 248 | struct super_block *sb = dir->i_sb; | 248 | struct super_block *sb = dir->i_sb; |
| 249 | struct inode *inode; | 249 | struct inode *inode; |
| @@ -34,7 +34,7 @@ static bool afs_lookup_filldir(struct dir_context *ctx, const char *name, int nl · 33 unmodified lines | |||
| 34 | u64 ino, u32 uniquifier); | 34 | u64 ino, u32 uniquifier); |
| 35 | #define AFS_LOOKUP ((filldir_t)0x137UL) | 35 | #define AFS_LOOKUP ((filldir_t)0x137UL) |
| 36 | static int afs_create(struct mnt_idmap *idmap, struct inode *dir, | 36 | 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); |
| 38 | static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir, | 38 | static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir, |
| 39 | struct dentry *dentry, umode_t mode); | 39 | struct dentry *dentry, umode_t mode); |
| 40 | static int afs_rmdir(struct inode *dir, struct dentry *dentry); | 40 | 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 | |||
| 1633 | * create a regular file on an AFS filesystem | 1633 | * create a regular file on an AFS filesystem |
| 1634 | */ | 1634 | */ |
| 1635 | static int afs_create(struct mnt_idmap *idmap, struct inode *dir, | 1635 | 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) |
| 1637 | { | 1637 | { |
| 1638 | struct afs_operation *op; | 1638 | struct afs_operation *op; |
| 1639 | struct afs_vnode *dvnode = AFS_FS_I(dir); | 1639 | struct afs_vnode *dvnode = AFS_FS_I(dir); |
| @@ -29,7 +29,7 @@ static const struct file_operations bad_file_ops = · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | static int bad_inode_create(struct mnt_idmap *idmap, | 30 | static int bad_inode_create(struct mnt_idmap *idmap, |
| 31 | struct inode *dir, struct dentry *dentry, | 31 | struct inode *dir, struct dentry *dentry, |
| 32 | umode_t mode, bool excl) | 32 | umode_t mode) |
| 33 | { | 33 | { |
| 34 | return -EIO; | 34 | return -EIO; |
| 35 | } | 35 | } |
| @@ -83,7 +83,7 @@ const struct file_operations bfs_dir_operations = { · 82 unmodified lines | |||
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | static int bfs_create(struct mnt_idmap *idmap, struct inode *dir, | 85 | 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) |
| 87 | { | 87 | { |
| 88 | int err; | 88 | int err; |
| 89 | struct inode *inode; | 89 | struct inode *inode; |
| @@ -7007,7 +7007,7 @@ static int btrfs_mknod(struct mnt_idmap *idmap, struct inode *dir, · 7006 unmodified lines | |||
| 7007 | } | 7007 | } |
| 7008 | 7008 | ||
| 7009 | static int btrfs_create(struct mnt_idmap *idmap, struct inode *dir, | 7009 | 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) |
| 7011 | { | 7011 | { |
| 7012 | struct inode *inode; | 7012 | struct inode *inode; |
| 7013 | 7013 | ||
| @@ -983,7 +983,7 @@ out: · 982 unmodified lines | |||
| 983 | } | 983 | } |
| 984 | 984 | ||
| 985 | static int ceph_create(struct mnt_idmap *idmap, struct inode *dir, | 985 | 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) |
| 987 | { | 987 | { |
| 988 | return ceph_mknod(idmap, dir, dentry, mode, 0); | 988 | return ceph_mknod(idmap, dir, dentry, mode, 0); |
| 989 | } | 989 | } |
| @@ -134,7 +134,7 @@ static inline void coda_dir_drop_nlink(struct inode *dir) · 133 unmodified lines | |||
| 134 | 134 | ||
| 135 | /* creation routines: create, mknod, mkdir, link, symlink */ | 135 | /* creation routines: create, mknod, mkdir, link, symlink */ |
| 136 | static int coda_create(struct mnt_idmap *idmap, struct inode *dir, | 136 | 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) |
| 138 | { | 138 | { |
| 139 | int error; | 139 | int error; |
| 140 | const char *name=de->d_name.name; | 140 | const char *name=de->d_name.name; |
| @@ -268,7 +268,7 @@ out: · 267 unmodified lines | |||
| 268 | static int | 268 | static int |
| 269 | ecryptfs_create(struct mnt_idmap *idmap, | 269 | ecryptfs_create(struct mnt_idmap *idmap, |
| 270 | struct inode *directory_inode, struct dentry *ecryptfs_dentry, | 270 | struct inode *directory_inode, struct dentry *ecryptfs_dentry, |
| 271 | umode_t mode, bool excl) | 271 | umode_t mode) |
| 272 | { | 272 | { |
| 273 | struct inode *ecryptfs_inode; | 273 | struct inode *ecryptfs_inode; |
| 274 | int rc; | 274 | int rc; |
| @@ -75,7 +75,7 @@ static bool efivarfs_valid_name(const char *str, int len) · 74 unmodified lines | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static int efivarfs_create(struct mnt_idmap *idmap, struct inode *dir, | 77 | 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) |
| 79 | { | 79 | { |
| 80 | struct inode *inode = NULL; | 80 | struct inode *inode = NULL; |
| 81 | struct efivar_entry *var; | 81 | struct efivar_entry *var; |
| @@ -538,7 +538,7 @@ out: · 537 unmodified lines | |||
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | static int exfat_create(struct mnt_idmap *idmap, struct inode *dir, | 540 | 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) |
| 542 | { | 542 | { |
| 543 | struct super_block *sb = dir->i_sb; | 543 | struct super_block *sb = dir->i_sb; |
| 544 | struct inode *inode; | 544 | struct inode *inode; |
| @@ -99,7 +99,7 @@ struct dentry *ext2_get_parent(struct dentry *child) · 98 unmodified lines | |||
| 99 | */ | 99 | */ |
| 100 | static int ext2_create (struct mnt_idmap * idmap, | 100 | static int ext2_create (struct mnt_idmap * idmap, |
| 101 | struct inode * dir, struct dentry * dentry, | 101 | struct inode * dir, struct dentry * dentry, |
| 102 | umode_t mode, bool excl) | 102 | umode_t mode) |
| 103 | { | 103 | { |
| 104 | struct inode *inode; | 104 | struct inode *inode; |
| 105 | int err; | 105 | int err; |
| @@ -2811,7 +2811,7 @@ static int ext4_add_nondir(handle_t *handle, · 2810 unmodified lines | |||
| 2811 | * with d_instantiate(). | 2811 | * with d_instantiate(). |
| 2812 | */ | 2812 | */ |
| 2813 | static int ext4_create(struct mnt_idmap *idmap, struct inode *dir, | 2813 | 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) |
| 2815 | { | 2815 | { |
| 2816 | handle_t *handle; | 2816 | handle_t *handle; |
| 2817 | struct inode *inode; | 2817 | struct inode *inode; |
| @@ -366,7 +366,7 @@ fail_drop: · 365 unmodified lines | |||
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | static int f2fs_create(struct mnt_idmap *idmap, struct inode *dir, | 368 | 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) |
| 370 | { | 370 | { |
| 371 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); | 371 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); |
| 372 | struct f2fs_lock_context lc; | 372 | struct f2fs_lock_context lc; |
| @@ -265,7 +265,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name, · 264 unmodified lines | |||
| 265 | 265 | ||
| 266 | /***** Create a file */ | 266 | /***** Create a file */ |
| 267 | static int msdos_create(struct mnt_idmap *idmap, struct inode *dir, | 267 | 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) |
| 269 | { | 269 | { |
| 270 | struct super_block *sb = dir->i_sb; | 270 | struct super_block *sb = dir->i_sb; |
| 271 | struct inode *inode = NULL; | 271 | struct inode *inode = NULL; |
| @@ -755,7 +755,7 @@ error: · 754 unmodified lines | |||
| 755 | } | 755 | } |
| 756 | 756 | ||
| 757 | static int vfat_create(struct mnt_idmap *idmap, struct inode *dir, | 757 | 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) |
| 759 | { | 759 | { |
| 760 | struct super_block *sb = dir->i_sb; | 760 | struct super_block *sb = dir->i_sb; |
| 761 | struct inode *inode; | 761 | struct inode *inode; |
| @@ -1084,7 +1084,7 @@ static int fuse_mknod(struct mnt_idmap *idmap, struct inode *dir, · 1083 unmodified lines | |||
| 1084 | } | 1084 | } |
| 1085 | 1085 | ||
| 1086 | static int fuse_create(struct mnt_idmap *idmap, struct inode *dir, | 1086 | 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) |
| 1088 | { | 1088 | { |
| 1089 | return fuse_mknod(idmap, dir, entry, mode, 0); | 1089 | return fuse_mknod(idmap, dir, entry, mode, 0); |
| 1090 | } | 1090 | } |
| @@ -963,15 +963,14 @@ fail: · 962 unmodified lines | |||
| 963 | * @dir: The directory in which to create the file | 963 | * @dir: The directory in which to create the file |
| 964 | * @dentry: The dentry of the new file | 964 | * @dentry: The dentry of the new file |
| 965 | * @mode: The mode of the new file | 965 | * @mode: The mode of the new file |
| 966 | * @excl: Force fail if inode exists | ||
| 967 | * | 966 | * |
| 968 | * Returns: errno | 967 | * Returns: errno |
| 969 | */ | 968 | */ |
| 970 | 969 | ||
| 971 | static int gfs2_create(struct mnt_idmap *idmap, struct inode *dir, | 970 | 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) |
| 973 | { | 972 | { |
| 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); |
| 975 | } | 974 | } |
| 976 | 975 | ||
| 977 | /** | 976 | /** |
| @@ -184,7 +184,7 @@ static int hfs_dir_release(struct inode *inode, struct file *file) · 183 unmodified lines | |||
| 184 | * the directory and the name (and its length) of the new file. | 184 | * the directory and the name (and its length) of the new file. |
| 185 | */ | 185 | */ |
| 186 | static int hfs_create(struct mnt_idmap *idmap, struct inode *dir, | 186 | 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) |
| 188 | { | 188 | { |
| 189 | struct inode *inode; | 189 | struct inode *inode; |
| 190 | int res; | 190 | int res; |
| @@ -562,7 +562,7 @@ out: · 561 unmodified lines | |||
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | static int hfsplus_create(struct mnt_idmap *idmap, struct inode *dir, | 564 | 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) |
| 566 | { | 566 | { |
| 567 | return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode, 0); | 567 | return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode, 0); |
| 568 | } | 568 | } |
| @@ -593,7 +593,7 @@ static struct inode *hostfs_iget(struct super_block *sb, char *name) · 592 unmodified lines | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | static int hostfs_create(struct mnt_idmap *idmap, struct inode *dir, | 595 | 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) |
| 597 | { | 597 | { |
| 598 | struct inode *inode; | 598 | struct inode *inode; |
| 599 | char *name; | 599 | char *name; |
| @@ -129,7 +129,7 @@ bail: · 128 unmodified lines | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir, | 131 | 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) |
| 133 | { | 133 | { |
| 134 | const unsigned char *name = dentry->d_name.name; | 134 | const unsigned char *name = dentry->d_name.name; |
| 135 | unsigned len = dentry->d_name.len; | 135 | unsigned len = dentry->d_name.len; |
| @@ -979,7 +979,7 @@ static struct dentry *hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dir · 978 unmodified lines | |||
| 979 | 979 | ||
| 980 | static int hugetlbfs_create(struct mnt_idmap *idmap, | 980 | static int hugetlbfs_create(struct mnt_idmap *idmap, |
| 981 | struct inode *dir, struct dentry *dentry, | 981 | struct inode *dir, struct dentry *dentry, |
| 982 | umode_t mode, bool excl) | 982 | umode_t mode) |
| 983 | { | 983 | { |
| 984 | return hugetlbfs_mknod(idmap, dir, dentry, mode | S_IFREG, 0); | 984 | return hugetlbfs_mknod(idmap, dir, dentry, mode | S_IFREG, 0); |
| 985 | } | 985 | } |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | static int jffs2_readdir (struct file *, struct dir_context *); | 26 | static int jffs2_readdir (struct file *, struct dir_context *); |
| 27 | 27 | ||
| 28 | static int jffs2_create (struct mnt_idmap *, struct inode *, | 28 | static int jffs2_create (struct mnt_idmap *, struct inode *, |
| 29 | struct dentry *, umode_t, bool); | 29 | struct dentry *, umode_t); |
| 30 | static struct dentry *jffs2_lookup (struct inode *,struct dentry *, | 30 | static struct dentry *jffs2_lookup (struct inode *,struct dentry *, |
| 31 | unsigned int); | 31 | unsigned int); |
| 32 | static int jffs2_link (struct dentry *,struct inode *,struct dentry *); | 32 | 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 | |||
| 163 | 163 | ||
| 164 | 164 | ||
| 165 | static int jffs2_create(struct mnt_idmap *idmap, struct inode *dir_i, | 165 | 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) |
| 167 | { | 167 | { |
| 168 | struct jffs2_raw_inode *ri; | 168 | struct jffs2_raw_inode *ri; |
| 169 | struct jffs2_inode_info *f, *dir_f; | 169 | struct jffs2_inode_info *f, *dir_f; |
| @@ -61,7 +61,7 @@ static inline void free_ea_wmap(struct inode *inode) · 60 unmodified lines | |||
| 61 | * | 61 | * |
| 62 | */ | 62 | */ |
| 63 | static int jfs_create(struct mnt_idmap *idmap, struct inode *dip, | 63 | 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) |
| 65 | { | 65 | { |
| 66 | int rc = 0; | 66 | int rc = 0; |
| 67 | tid_t tid; /* transaction id */ | 67 | tid_t tid; /* transaction id */ |
| @@ -64,7 +64,7 @@ static int minix_tmpfile(struct mnt_idmap *idmap, struct inode *dir, · 63 unmodified lines | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static int minix_create(struct mnt_idmap *idmap, struct inode *dir, | 66 | 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) |
| 68 | { | 68 | { |
| 69 | return minix_mknod(&nop_mnt_idmap, dir, dentry, mode, 0); | 69 | return minix_mknod(&nop_mnt_idmap, dir, dentry, mode, 0); |
| 70 | } | 70 | } |
| @@ -4199,7 +4199,7 @@ int vfs_create(struct mnt_idmap *idmap, struct dentry *dentry, umode_t mode, · 4198 unmodified lines | |||
| 4199 | error = try_break_deleg(dir, LEASE_BREAK_DIR_CREATE, di); | 4199 | error = try_break_deleg(dir, LEASE_BREAK_DIR_CREATE, di); |
| 4200 | if (error) | 4200 | if (error) |
| 4201 | return error; | 4201 | return error; |
| 4202 | error = dir->i_op->create(idmap, dir, dentry, mode, true); | 4202 | error = dir->i_op->create(idmap, dir, dentry, mode); |
| 4203 | if (!error) | 4203 | if (!error) |
| 4204 | fsnotify_create(dir, dentry); | 4204 | fsnotify_create(dir, dentry); |
| 4205 | return error; | 4205 | return error; |
| @@ -4336,50 +4336,83 @@ static int may_o_create(struct mnt_idmap *idmap, · 130 unmodified lines | |||
| 4336 | return security_inode_create(dir->dentry->d_inode, dentry, mode); | 4336 | return security_inode_create(dir->dentry->d_inode, dentry, mode); |
| 4337 | } | 4337 | } |
| 4338 | 4338 | ||
| 4339 | /* | 4339 | /** |
| 4340 | * Attempt to atomically look up, create and open a file from a negative | 4340 | * atomic_open() - atomically look up, create and open a file |
| 4341 | * dentry. | 4341 | * @path: parent directory path |
| 4342 | * | 4342 | * @dentry: child to ->atomic_open() |
| 4343 | * Returns 0 if successful. The file will have been created and attached to | 4343 | * @file: file to attach child to |
| 4344 | * @file by the filesystem calling finish_open(). | 4344 | * @open_flag: open flags |
| 4345 | * | 4345 | * @mode: create mode |
| 4346 | * If the file was looked up only or didn't need creating, FMODE_OPENED won't | 4346 | * @create_error: return value from may_o_create() |
| 4347 | * be set. The caller will need to perform the open themselves. @path will | 4347 | * |
| 4348 | * have been updated to point to the new dentry. This may be negative. | 4348 | * Attempt to look up, create and open @dentry, which must be negative, in a |
| 4349 | * | 4349 | * single call into the filesystem. |
| 4350 | * Returns an error code otherwise. | 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. | ||
| 4351 | */ | 4361 | */ |
| 4352 | static struct dentry *atomic_open(const struct path *path, struct dentry *dentry, | 4362 | static struct dentry *atomic_open(const struct path *path, struct dentry *dentry, |
| 4353 | struct file *file, | 4363 | struct file *file, |
| 4354 | int open_flag, umode_t mode) | 4364 | int open_flag, umode_t mode, int create_error) |
| 4355 | { | 4365 | { |
| 4356 | struct dentry *const DENTRY_NOT_SET = (void *) -1UL; | 4366 | 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; |
| 4358 | int error; | 4368 | int error; |
| 4359 | 4369 | ||
| 4360 | file->__f_path.dentry = DENTRY_NOT_SET; | 4370 | file->__f_path.dentry = DENTRY_NOT_SET; |
| 4361 | file->__f_path.mnt = path->mnt; | 4371 | 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, |
| 4363 | open_to_namei_flags(open_flag), mode); | 4373 | open_to_namei_flags(open_flag), mode); |
| 4364 | d_lookup_done(dentry); | 4374 | d_lookup_done(dentry); |
| 4375 | |||
| 4365 | if (!error) { | 4376 | if (!error) { |
| 4366 | if (file->f_mode & FMODE_OPENED) { | 4377 | 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)) { | ||
| 4368 | dput(dentry); | 4382 | dput(dentry); |
| 4369 | dentry = dget(file->f_path.dentry); | 4383 | dentry = dget(opened); |
| 4370 | } | 4384 | } |
| 4371 | } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { | 4385 | } else if (likely(file->f_path.dentry != DENTRY_NOT_SET)) { |
| 4372 | error = -EIO; | 4386 | /* finish_no_open() called */ |
| 4373 | } else { | 4387 | struct dentry *replaced = file->f_path.dentry; |
| 4374 | if (file->f_path.dentry) { | 4388 | |
| 4389 | if (replaced) { | ||
| 4375 | dput(dentry); | 4390 | dput(dentry); |
| 4376 | dentry = file->f_path.dentry; | 4391 | dentry = replaced; |
| 4377 | } | 4392 | } |
| 4378 | if (unlikely(d_is_negative(dentry))) | 4393 | if (unlikely(d_is_negative(dentry))) |
| 4379 | error = -ENOENT; | 4394 | 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; | ||
| 4380 | } | 4401 | } |
| 4381 | } | 4402 | } |
| 4403 | |||
| 4382 | if (error) { | 4404 | 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 | } | ||
| 4383 | dput(dentry); | 4416 | dput(dentry); |
| 4384 | dentry = ERR_PTR(error); | 4417 | dentry = ERR_PTR(error); |
| 4385 | } | 4418 | } |
| @@ -4389,32 +4422,52 @@ static struct dentry *atomic_open(const struct path *path, struct dentry *dentry · 3 unmodified lines | |||
| 4389 | /* | 4422 | /* |
| 4390 | * Look up and maybe create and open the last component. | 4423 | * Look up and maybe create and open the last component. |
| 4391 | * | 4424 | * |
| 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. | ||
| 4393 | * | 4428 | * |
| 4394 | * Returns 0 on success, that is, if | 4429 | * On success returns the dentry of the last component. If FMODE_OPENED is set |
| 4395 | * the file was successfully atomically created (if necessary) and opened, or | 4430 | * on file->f_mode the file was also opened and attached to @file; otherwise |
| 4396 | * the file was not completely opened at this time, though lookups and | 4431 | * only lookup and creation were performed and the caller has to open it. In |
| 4397 | * creations were performed. | 4432 | * the latter case the dentry may be negative if O_CREAT hadn't been specified. |
| 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. | ||
| 4401 | * | 4433 | * |
| 4402 | * An error code is returned on failure. | 4434 | * Returns ERR_PTR() on failure. |
| 4403 | */ | 4435 | */ |
| 4404 | static struct dentry *lookup_open(struct nameidata *nd, struct file *file, | 4436 | static struct dentry *lookup_open(struct nameidata *nd, struct file *file, |
| 4405 | const struct open_flags *op, | 4437 | const struct open_flags *op) |
| 4406 | bool got_write, struct delegated_inode *delegated_inode) | ||
| 4407 | { | 4438 | { |
| 4439 | struct delegated_inode delegated_inode = { }; | ||
| 4408 | struct mnt_idmap *idmap; | 4440 | struct mnt_idmap *idmap; |
| 4409 | struct dentry *dir = nd->path.dentry; | 4441 | struct dentry *dir = nd->path.dentry; |
| 4410 | struct inode *dir_inode = dir->d_inode; | 4442 | struct inode *dir_inode = dir->d_inode; |
| 4411 | int open_flag = op->open_flag; | 4443 | int open_flag; |
| 4412 | struct dentry *dentry; | 4444 | struct dentry *dentry; |
| 4413 | int error, create_error = 0; | 4445 | int error, create_error; |
| 4414 | umode_t mode = op->mode; | 4446 | umode_t mode; |
| 4447 | bool got_write; | ||
| 4415 | 4448 | ||
| 4416 | if (unlikely(IS_DEADDIR(dir_inode))) | 4449 | retry: |
| 4417 | return ERR_PTR(-ENOENT); | 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 | } | ||
| 4418 | 4471 | ||
| 4419 | file->f_mode &= ~FMODE_CREATED; | 4472 | file->f_mode &= ~FMODE_CREATED; |
| 4420 | dentry = d_lookup(dir, &nd->last); | 4473 | dentry = d_lookup(dir, &nd->last); |
| @@ -4422,7 +4475,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 1 unmodified line | |||
| 4422 | if (!dentry) { | 4475 | if (!dentry) { |
| 4423 | dentry = d_alloc_parallel(dir, &nd->last); | 4476 | dentry = d_alloc_parallel(dir, &nd->last); |
| 4424 | if (IS_ERR(dentry)) | 4477 | if (IS_ERR(dentry)) |
| 4425 | return dentry; | 4478 | goto out; |
| 4426 | } | 4479 | } |
| 4427 | if (d_in_lookup(dentry)) | 4480 | if (d_in_lookup(dentry)) |
| 4428 | break; | 4481 | break; |
| @@ -4437,8 +4490,8 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 8 unmodified lines | |||
| 4437 | dentry = NULL; | 4490 | dentry = NULL; |
| 4438 | } | 4491 | } |
| 4439 | if (dentry->d_inode) { | 4492 | if (dentry->d_inode) { |
| 4440 | /* Cached positive dentry: will open in f_op->open */ | 4493 | /* Cached positive dentry: will open in do_open(). */ |
| 4441 | return dentry; | 4494 | goto out; |
| 4442 | } | 4495 | } |
| 4443 | 4496 | ||
| 4444 | if (open_flag & O_CREAT) | 4497 | if (open_flag & O_CREAT) |
| @@ -4459,7 +4512,7 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 14 unmodified lines | |||
| 4459 | if (open_flag & O_CREAT) { | 4512 | if (open_flag & O_CREAT) { |
| 4460 | if (open_flag & O_EXCL) | 4513 | if (open_flag & O_EXCL) |
| 4461 | open_flag &= ~O_TRUNC; | 4514 | 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); |
| 4463 | if (likely(got_write)) | 4516 | if (likely(got_write)) |
| 4464 | create_error = may_o_create(idmap, &nd->path, | 4517 | create_error = may_o_create(idmap, &nd->path, |
| 4465 | dentry, mode); | 4518 | dentry, mode); |
| @@ -4471,10 +4524,9 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 5 unmodified lines | |||
| 4471 | if (dir_inode->i_op->atomic_open) { | 4524 | if (dir_inode->i_op->atomic_open) { |
| 4472 | if (nd->flags & LOOKUP_DIRECTORY) | 4525 | if (nd->flags & LOOKUP_DIRECTORY) |
| 4473 | open_flag |= O_DIRECTORY; | 4526 | open_flag |= O_DIRECTORY; |
| 4474 | dentry = atomic_open(&nd->path, dentry, file, open_flag, mode); | 4527 | dentry = atomic_open(&nd->path, dentry, file, open_flag, mode, |
| 4475 | if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) | 4528 | create_error); |
| 4476 | dentry = ERR_PTR(create_error); | 4529 | goto out; |
| 4477 | return dentry; | ||
| 4478 | } | 4530 | } |
| 4479 | 4531 | ||
| 4480 | if (d_in_lookup(dentry)) { | 4532 | if (d_in_lookup(dentry)) { |
| @@ -4490,37 +4542,164 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, · 9 unmodified lines | |||
| 4490 | dentry = res; | 4542 | dentry = res; |
| 4491 | } | 4543 | } |
| 4492 | } | 4544 | } |
| 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 | } | ||
| 4493 | 4552 | ||
| 4494 | /* Negative dentry, just create the file */ | 4553 | /* Negative dentry with O_CREAT flag set */ |
| 4495 | if (!dentry->d_inode && (open_flag & O_CREAT)) { | 4554 | audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); |
| 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; | ||
| 4500 | 4555 | ||
| 4501 | file->f_mode |= FMODE_CREATED; | 4556 | if (unlikely(create_error)) { |
| 4502 | audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); | 4557 | /* should have done a create, but we already errored */ |
| 4503 | if (!dir_inode->i_op->create) { | 4558 | error = create_error; |
| 4504 | error = -EACCES; | 4559 | goto out_dput; |
| 4505 | goto out_dput; | 4560 | } |
| 4506 | } | ||
| 4507 | 4561 | ||
| 4508 | error = dir_inode->i_op->create(idmap, dir_inode, dentry, | 4562 | error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, &delegated_inode); |
| 4509 | mode, open_flag & O_EXCL); | 4563 | if (error) |
| 4510 | if (error) | 4564 | goto out_dput; |
| 4511 | goto out_dput; | 4565 | |
| 4566 | file->f_mode |= FMODE_CREATED; | ||
| 4567 | if (!dir_inode->i_op->create) { | ||
| 4568 | error = -EACCES; | ||
| 4569 | goto out_dput; | ||
| 4512 | } | 4570 | } |
| 4513 | if (unlikely(create_error) && !dentry->d_inode) { | 4571 | |
| 4514 | error = create_error; | 4572 | error = dir_inode->i_op->create(idmap, dir_inode, dentry, mode); |
| 4573 | if (error) | ||
| 4515 | goto out_dput; | 4574 | 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); | ||
| 4516 | } | 4581 | } |
| 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 | |||
| 4517 | return dentry; | 4599 | return dentry; |
| 4518 | 4600 | ||
| 4519 | out_dput: | 4601 | out_dput: |
| 4520 | dput(dentry); | 4602 | dput(dentry); |
| 4521 | return ERR_PTR(error); | 4603 | dentry = ERR_PTR(error); |
| 4604 | goto out; | ||
| 4522 | } | 4605 | } |
| 4523 | 4606 | ||
| 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 | |||
| 4524 | static inline bool trailing_slashes(struct nameidata *nd) | 4703 | static inline bool trailing_slashes(struct nameidata *nd) |
| 4525 | { | 4704 | { |
| 4526 | return (bool)nd->last.name[nd->last.len]; | 4705 | 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 | |||
| 4560 | static const char *open_last_lookups(struct nameidata *nd, | 4739 | static const char *open_last_lookups(struct nameidata *nd, |
| 4561 | struct file *file, const struct open_flags *op) | 4740 | struct file *file, const struct open_flags *op) |
| 4562 | { | 4741 | { |
| 4563 | struct delegated_inode delegated_inode = { }; | ||
| 4564 | struct dentry *dir = nd->path.dentry; | ||
| 4565 | int open_flag = op->open_flag; | 4742 | int open_flag = op->open_flag; |
| 4566 | bool got_write = false; | ||
| 4567 | struct dentry *dentry; | 4743 | struct dentry *dentry; |
| 4568 | const char *res; | 4744 | const char *res; |
| 4569 | 4745 | ||
| @@ -4592,44 +4768,10 @@ static const char *open_last_lookups(struct nameidata *nd, · 22 unmodified lines | |||
| 4592 | return ERR_PTR(-ECHILD); | 4768 | return ERR_PTR(-ECHILD); |
| 4593 | } | 4769 | } |
| 4594 | } | 4770 | } |
| 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); | ||
| 4626 | 4771 | ||
| 4627 | if (!error) | 4772 | dentry = lookup_open(nd, file, op); |
| 4628 | goto retry; | 4773 | if (IS_ERR(dentry)) |
| 4629 | return ERR_PTR(error); | ||
| 4630 | } | ||
| 4631 | return ERR_CAST(dentry); | 4774 | return ERR_CAST(dentry); |
| 4632 | } | ||
| 4633 | 4775 | ||
| 4634 | if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) { | 4776 | if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) { |
| 4635 | dput(nd->path.dentry); | 4777 | dput(nd->path.dentry); |
| @@ -5051,7 +5193,7 @@ struct file *dentry_create(struct path *path, int flags, umode_t mode, · 415 unmodified lines | |||
| 5051 | 5193 | ||
| 5052 | /* atomic_open will dput(dentry) on error */ | 5194 | /* atomic_open will dput(dentry) on error */ |
| 5053 | dget(orig_dentry); | 5195 | dget(orig_dentry); |
| 5054 | dentry = atomic_open(path, dentry, file, flags, mode); | 5196 | dentry = atomic_open(path, dentry, file, flags, mode, create_error); |
| 5055 | error = PTR_ERR_OR_ZERO(dentry); | 5197 | error = PTR_ERR_OR_ZERO(dentry); |
| 5056 | 5198 | ||
| 5057 | if (IS_ERR(dentry)) | 5199 | if (IS_ERR(dentry)) |
| @@ -5061,9 +5203,6 @@ struct file *dentry_create(struct path *path, int flags, umode_t mode, · 3 unmodified lines | |||
| 5061 | /* Drop the extra reference */ | 5203 | /* Drop the extra reference */ |
| 5062 | dput(orig_dentry); | 5204 | dput(orig_dentry); |
| 5063 | 5205 | ||
| 5064 | if (unlikely(create_error) && error == -ENOENT) | ||
| 5065 | error = create_error; | ||
| 5066 | |||
| 5067 | if (!error) { | 5206 | if (!error) { |
| 5068 | if (file->f_mode & FMODE_CREATED) | 5207 | if (file->f_mode & FMODE_CREATED) |
| 5069 | fsnotify_create(dir->d_inode, dentry); | 5208 | fsnotify_create(dir->d_inode, dentry); |
| @@ -2427,9 +2427,9 @@ out_err: · 2426 unmodified lines | |||
| 2427 | } | 2427 | } |
| 2428 | 2428 | ||
| 2429 | int nfs_create(struct mnt_idmap *idmap, struct inode *dir, | 2429 | 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) |
| 2431 | { | 2431 | { |
| 2432 | return nfs_do_create(dir, dentry, mode, excl ? O_EXCL : 0); | 2432 | return nfs_do_create(dir, dentry, mode, O_EXCL); |
| 2433 | } | 2433 | } |
| 2434 | EXPORT_SYMBOL_GPL(nfs_create); | 2434 | EXPORT_SYMBOL_GPL(nfs_create); |
| 2435 | 2435 | ||
| @@ -395,7 +395,7 @@ extern unsigned long nfs_access_cache_scan(struct shrinker *shrink, · 394 unmodified lines | |||
| 395 | struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); | 395 | struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); |
| 396 | void nfs_d_prune_case_insensitive_aliases(struct inode *inode); | 396 | void nfs_d_prune_case_insensitive_aliases(struct inode *inode); |
| 397 | int nfs_create(struct mnt_idmap *, struct inode *, struct dentry *, | 397 | int nfs_create(struct mnt_idmap *, struct inode *, struct dentry *, |
| 398 | umode_t, bool); | 398 | umode_t); |
| 399 | struct dentry *nfs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *, | 399 | struct dentry *nfs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *, |
| 400 | umode_t); | 400 | umode_t); |
| 401 | int nfs_rmdir(struct inode *, struct dentry *); | 401 | int nfs_rmdir(struct inode *, struct dentry *); |
| @@ -86,7 +86,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) · 85 unmodified lines | |||
| 86 | * with d_instantiate(). | 86 | * with d_instantiate(). |
| 87 | */ | 87 | */ |
| 88 | static int nilfs_create(struct mnt_idmap *idmap, struct inode *dir, | 88 | 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) |
| 90 | { | 90 | { |
| 91 | struct inode *inode; | 91 | struct inode *inode; |
| 92 | struct nilfs_transaction_info ti; | 92 | struct nilfs_transaction_info ti; |
| @@ -737,7 +737,7 @@ err_out: · 736 unmodified lines | |||
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | static int ntfs_create(struct mnt_idmap *idmap, struct inode *dir, | 739 | 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) |
| 741 | { | 741 | { |
| 742 | struct ntfs_volume *vol = NTFS_SB(dir->i_sb); | 742 | struct ntfs_volume *vol = NTFS_SB(dir->i_sb); |
| 743 | struct ntfs_inode *ni; | 743 | struct ntfs_inode *ni; |
| @@ -105,7 +105,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry, · 104 unmodified lines | |||
| 105 | * ntfs_create - inode_operations::create | 105 | * ntfs_create - inode_operations::create |
| 106 | */ | 106 | */ |
| 107 | static int ntfs_create(struct mnt_idmap *idmap, struct inode *dir, | 107 | 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) |
| 109 | { | 109 | { |
| 110 | return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFREG | mode, 0, | 110 | return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFREG | mode, 0, |
| 111 | NULL, 0, NULL); | 111 | NULL, 0, NULL); |
| @@ -453,8 +453,7 @@ bail: · 452 unmodified lines | |||
| 453 | static int dlmfs_create(struct mnt_idmap *idmap, | 453 | static int dlmfs_create(struct mnt_idmap *idmap, |
| 454 | struct inode *dir, | 454 | struct inode *dir, |
| 455 | struct dentry *dentry, | 455 | struct dentry *dentry, |
| 456 | umode_t mode, | 456 | umode_t mode) |
| 457 | bool excl) | ||
| 458 | { | 457 | { |
| 459 | int status = 0; | 458 | int status = 0; |
| 460 | struct inode *inode; | 459 | struct inode *inode; |
| @@ -667,8 +667,7 @@ static struct dentry *ocfs2_mkdir(struct mnt_idmap *idmap, · 666 unmodified lines | |||
| 667 | static int ocfs2_create(struct mnt_idmap *idmap, | 667 | static int ocfs2_create(struct mnt_idmap *idmap, |
| 668 | struct inode *dir, | 668 | struct inode *dir, |
| 669 | struct dentry *dentry, | 669 | struct dentry *dentry, |
| 670 | umode_t mode, | 670 | umode_t mode) |
| 671 | bool excl) | ||
| 672 | { | 671 | { |
| 673 | int ret; | 672 | int ret; |
| 674 | 673 | ||
| @@ -286,7 +286,7 @@ static struct dentry *omfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 285 unmodified lines | |||
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | static int omfs_create(struct mnt_idmap *idmap, struct inode *dir, | 288 | 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) |
| 290 | { | 290 | { |
| 291 | return omfs_add_node(dir, dentry, mode | S_IFREG); | 291 | return omfs_add_node(dir, dentry, mode | S_IFREG); |
| 292 | } | 292 | } |
| @@ -18,8 +18,7 @@ · 17 unmodified lines | |||
| 18 | static int orangefs_create(struct mnt_idmap *idmap, | 18 | static int orangefs_create(struct mnt_idmap *idmap, |
| 19 | struct inode *dir, | 19 | struct inode *dir, |
| 20 | struct dentry *dentry, | 20 | struct dentry *dentry, |
| 21 | umode_t mode, | 21 | umode_t mode) |
| 22 | bool exclusive) | ||
| 23 | { | 22 | { |
| 24 | struct orangefs_inode_s *parent = ORANGEFS_I(dir); | 23 | struct orangefs_inode_s *parent = ORANGEFS_I(dir); |
| 25 | struct orangefs_kernel_op_s *new_op; | 24 | struct orangefs_kernel_op_s *new_op; |
| @@ -732,7 +732,7 @@ out: · 731 unmodified lines | |||
| 732 | } | 732 | } |
| 733 | 733 | ||
| 734 | static int ovl_create(struct mnt_idmap *idmap, struct inode *dir, | 734 | 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) |
| 736 | { | 736 | { |
| 737 | return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); | 737 | return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); |
| 738 | } | 738 | } |
| @@ -128,7 +128,7 @@ static struct dentry *ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 127 unmodified lines | |||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static int ramfs_create(struct mnt_idmap *idmap, struct inode *dir, | 130 | 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) |
| 132 | { | 132 | { |
| 133 | return ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0); | 133 | return ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFREG, 0); |
| 134 | } | 134 | } |
| @@ -54,7 +54,7 @@ void cifs_sb_deactive(struct super_block *sb); · 53 unmodified lines | |||
| 54 | extern const struct inode_operations cifs_dir_inode_ops; | 54 | extern const struct inode_operations cifs_dir_inode_ops; |
| 55 | struct inode *cifs_root_iget(struct super_block *sb); | 55 | struct inode *cifs_root_iget(struct super_block *sb); |
| 56 | int cifs_create(struct mnt_idmap *idmap, struct inode *dir, | 56 | 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); |
| 58 | int cifs_atomic_open(struct inode *dir, struct dentry *direntry, | 58 | int cifs_atomic_open(struct inode *dir, struct dentry *direntry, |
| 59 | struct file *file, unsigned int oflags, umode_t mode); | 59 | struct file *file, unsigned int oflags, umode_t mode); |
| 60 | int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, | 60 | int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, |
| @@ -645,7 +645,7 @@ out_free_xid: · 644 unmodified lines | |||
| 645 | * hashed-positive by calling d_instantiate(). | 645 | * hashed-positive by calling d_instantiate(). |
| 646 | */ | 646 | */ |
| 647 | int cifs_create(struct mnt_idmap *idmap, struct inode *dir, | 647 | 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) |
| 649 | { | 649 | { |
| 650 | struct cifs_sb_info *cifs_sb = CIFS_SB(dir); | 650 | struct cifs_sb_info *cifs_sb = CIFS_SB(dir); |
| 651 | int rc; | 651 | int rc; |
| @@ -303,7 +303,7 @@ static int ubifs_prepare_create(struct inode *dir, struct dentry *dentry, · 302 unmodified lines | |||
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | static int ubifs_create(struct mnt_idmap *idmap, struct inode *dir, | 305 | 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) |
| 307 | { | 307 | { |
| 308 | struct inode *inode; | 308 | struct inode *inode; |
| 309 | struct ubifs_info *c = dir->i_sb->s_fs_info; | 309 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
| @@ -371,7 +371,7 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode) · 370 unmodified lines | |||
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | static int udf_create(struct mnt_idmap *idmap, struct inode *dir, | 373 | 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) |
| 375 | { | 375 | { |
| 376 | struct inode *inode = udf_new_inode(dir, mode); | 376 | struct inode *inode = udf_new_inode(dir, mode); |
| 377 | 377 | ||
| @@ -70,8 +70,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsi · 69 unmodified lines | |||
| 70 | * with d_instantiate(). | 70 | * with d_instantiate(). |
| 71 | */ | 71 | */ |
| 72 | static int ufs_create (struct mnt_idmap * idmap, | 72 | static int ufs_create (struct mnt_idmap * idmap, |
| 73 | struct inode * dir, struct dentry * dentry, umode_t mode, | 73 | struct inode * dir, struct dentry * dentry, umode_t mode) |
| 74 | bool excl) | ||
| 75 | { | 74 | { |
| 76 | struct inode *inode; | 75 | struct inode *inode; |
| 77 | 76 | ||
| @@ -298,9 +298,9 @@ out: · 297 unmodified lines | |||
| 298 | 298 | ||
| 299 | static int vboxsf_dir_mkfile(struct mnt_idmap *idmap, | 299 | static int vboxsf_dir_mkfile(struct mnt_idmap *idmap, |
| 300 | struct inode *parent, struct dentry *dentry, | 300 | struct inode *parent, struct dentry *dentry, |
| 301 | umode_t mode, bool excl) | 301 | umode_t mode) |
| 302 | { | 302 | { |
| 303 | return vboxsf_dir_create(parent, dentry, mode, false, excl, NULL); | 303 | return vboxsf_dir_create(parent, dentry, mode, false, true, NULL); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | static struct dentry *vboxsf_dir_mkdir(struct mnt_idmap *idmap, | 306 | static struct dentry *vboxsf_dir_mkdir(struct mnt_idmap *idmap, |
| @@ -293,8 +293,7 @@ xfs_vn_create( · 292 unmodified lines | |||
| 293 | struct mnt_idmap *idmap, | 293 | struct mnt_idmap *idmap, |
| 294 | struct inode *dir, | 294 | struct inode *dir, |
| 295 | struct dentry *dentry, | 295 | struct dentry *dentry, |
| 296 | umode_t mode, | 296 | umode_t mode) |
| 297 | bool flags) | ||
| 298 | { | 297 | { |
| 299 | return xfs_generic_create(idmap, dir, dentry, mode, 0, NULL); | 298 | return xfs_generic_create(idmap, dir, dentry, mode, 0, NULL); |
| 300 | } | 299 | } |
| @@ -338,7 +337,7 @@ STATIC struct dentry * · 37 unmodified lines | |||
| 338 | xfs_vn_ci_lookup( | 337 | xfs_vn_ci_lookup( |
| 339 | struct inode *dir, | 338 | struct inode *dir, |
| 340 | struct dentry *dentry, | 339 | struct dentry *dentry, |
| 341 | unsigned int flags) | 340 | unsigned int flags) |
| 342 | { | 341 | { |
| 343 | struct xfs_inode *ip; | 342 | struct xfs_inode *ip; |
| 344 | struct xfs_name xname; | 343 | struct xfs_name xname; |
| @@ -2002,7 +2002,7 @@ struct inode_operations { · 2001 unmodified lines | |||
| 2002 | int (*readlink) (struct dentry *, char __user *,int); | 2002 | int (*readlink) (struct dentry *, char __user *,int); |
| 2003 | 2003 | ||
| 2004 | int (*create) (struct mnt_idmap *, struct inode *,struct dentry *, | 2004 | int (*create) (struct mnt_idmap *, struct inode *,struct dentry *, |
| 2005 | umode_t, bool); | 2005 | umode_t); |
| 2006 | int (*link) (struct dentry *,struct inode *,struct dentry *); | 2006 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
| 2007 | int (*unlink) (struct inode *,struct dentry *); | 2007 | int (*unlink) (struct inode *,struct dentry *); |
| 2008 | int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *, | 2008 | int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *, |
| @@ -97,6 +97,9 @@ struct dentry *start_creating_dentry(struct dentry *parent, · 96 unmodified lines | |||
| 97 | struct dentry *start_removing_dentry(struct dentry *parent, | 97 | struct dentry *start_removing_dentry(struct dentry *parent, |
| 98 | struct dentry *child); | 98 | struct dentry *child); |
| 99 | 99 | ||
| 100 | struct file *vfs_lookup_open(struct path *parent, struct qstr *last, | ||
| 101 | int open_flag, umode_t mode); | ||
| 102 | |||
| 100 | /* end_creating - finish action started with start_creating | 103 | /* end_creating - finish action started with start_creating |
| 101 | * @child: dentry returned by start_creating() or vfs_mkdir() | 104 | * @child: dentry returned by start_creating() or vfs_mkdir() |
| 102 | * | 105 | * |
| @@ -608,7 +608,7 @@ out_unlock: · 607 unmodified lines | |||
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | static int mqueue_create(struct mnt_idmap *idmap, struct inode *dir, | 610 | 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) |
| 612 | { | 612 | { |
| 613 | return mqueue_create_attr(dentry, mode, NULL); | 613 | return mqueue_create_attr(dentry, mode, NULL); |
| 614 | } | 614 | } |
| @@ -3874,7 +3874,7 @@ static struct dentry *shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 3873 unmodified lines | |||
| 3874 | } | 3874 | } |
| 3875 | 3875 | ||
| 3876 | static int shmem_create(struct mnt_idmap *idmap, struct inode *dir, | 3876 | 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) |
| 3878 | { | 3878 | { |
| 3879 | return shmem_mknod(idmap, dir, dentry, mode | S_IFREG, 0); | 3879 | return shmem_mknod(idmap, dir, dentry, mode | S_IFREG, 0); |
| 3880 | } | 3880 | } |