Commit ebfc3b49a7ac25920cb5be5445f602e51d2ea559
1 parent
72bd866a01
Exists in
master
and in
20 other branches
don't pass nameidata to ->create()
boolean "does it have to be exclusive?" flag is passed instead; Local filesystem should just ignore it - the object is guaranteed not to be there yet. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 51 changed files with 62 additions and 64 deletions Side-by-side Diff
- Documentation/filesystems/Locking
- Documentation/filesystems/porting
- Documentation/filesystems/vfs.txt
- fs/9p/vfs_inode.c
- fs/9p/vfs_inode_dotl.c
- fs/affs/affs.h
- fs/affs/namei.c
- fs/afs/dir.c
- fs/bad_inode.c
- fs/bfs/dir.c
- fs/btrfs/inode.c
- fs/ceph/dir.c
- fs/cifs/cifsfs.h
- fs/cifs/dir.c
- fs/coda/dir.c
- fs/ecryptfs/inode.c
- fs/exofs/namei.c
- fs/ext2/namei.c
- fs/ext3/namei.c
- fs/ext4/namei.c
- fs/fat/namei_msdos.c
- fs/fat/namei_vfat.c
- fs/fuse/dir.c
- fs/gfs2/inode.c
- fs/hfs/dir.c
- fs/hfsplus/dir.c
- fs/hostfs/hostfs_kern.c
- fs/hpfs/namei.c
- fs/hugetlbfs/inode.c
- fs/jffs2/dir.c
- fs/jfs/namei.c
- fs/logfs/dir.c
- fs/minix/namei.c
- fs/namei.c
- fs/ncpfs/dir.c
- fs/nfs/dir.c
- fs/nilfs2/namei.c
- fs/ocfs2/dlmfs/dlmfs.c
- fs/ocfs2/namei.c
- fs/omfs/dir.c
- fs/ramfs/inode.c
- fs/reiserfs/namei.c
- fs/reiserfs/xattr.c
- fs/sysv/namei.c
- fs/ubifs/dir.c
- fs/udf/namei.c
- fs/ufs/namei.c
- fs/xfs/xfs_iops.c
- include/linux/fs.h
- ipc/mqueue.c
- mm/shmem.c
Documentation/filesystems/Locking
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | |
38 | 38 | --------------------------- inode_operations --------------------------- |
39 | 39 | prototypes: |
40 | - int (*create) (struct inode *,struct dentry *,umode_t, struct nameidata *); | |
40 | + int (*create) (struct inode *,struct dentry *,umode_t, bool); | |
41 | 41 | struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); |
42 | 42 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
43 | 43 | int (*unlink) (struct inode *,struct dentry *); |
Documentation/filesystems/porting
... | ... | @@ -436,4 +436,10 @@ |
436 | 436 | [mandatory] |
437 | 437 | The witch is dead! Well, 2/3 of it, anyway. ->d_revalidate() and |
438 | 438 | ->lookup() do *not* take struct nameidata anymore; just the flags. |
439 | +-- | |
440 | +[mandatory] | |
441 | + ->create() doesn't take struct nameidata *; unlike the previous | |
442 | +two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that | |
443 | +local filesystems can ignore tha argument - they are guaranteed that the | |
444 | +object doesn't exist. It's remote/distributed ones that might care... |
Documentation/filesystems/vfs.txt
... | ... | @@ -341,7 +341,7 @@ |
341 | 341 | filesystem. As of kernel 2.6.22, the following members are defined: |
342 | 342 | |
343 | 343 | struct inode_operations { |
344 | - int (*create) (struct inode *,struct dentry *, umode_t, struct nameidata *); | |
344 | + int (*create) (struct inode *,struct dentry *, umode_t, bool); | |
345 | 345 | struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); |
346 | 346 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
347 | 347 | int (*unlink) (struct inode *,struct dentry *); |
fs/9p/vfs_inode.c
... | ... | @@ -725,7 +725,7 @@ |
725 | 725 | |
726 | 726 | static int |
727 | 727 | v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
728 | - struct nameidata *nd) | |
728 | + bool excl) | |
729 | 729 | { |
730 | 730 | struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); |
731 | 731 | u32 perm = unixmode2p9mode(v9ses, mode); |
fs/9p/vfs_inode_dotl.c
fs/affs/affs.h
... | ... | @@ -155,7 +155,7 @@ |
155 | 155 | extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len); |
156 | 156 | extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int); |
157 | 157 | extern int affs_unlink(struct inode *dir, struct dentry *dentry); |
158 | -extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *); | |
158 | +extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool); | |
159 | 159 | extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); |
160 | 160 | extern int affs_rmdir(struct inode *dir, struct dentry *dentry); |
161 | 161 | extern int affs_link(struct dentry *olddentry, struct inode *dir, |
fs/affs/namei.c
... | ... | @@ -255,7 +255,7 @@ |
255 | 255 | } |
256 | 256 | |
257 | 257 | int |
258 | -affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) | |
258 | +affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) | |
259 | 259 | { |
260 | 260 | struct super_block *sb = dir->i_sb; |
261 | 261 | struct inode *inode; |
fs/afs/dir.c
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, |
30 | 30 | loff_t fpos, u64 ino, unsigned dtype); |
31 | 31 | static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
32 | - struct nameidata *nd); | |
32 | + bool excl); | |
33 | 33 | static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); |
34 | 34 | static int afs_rmdir(struct inode *dir, struct dentry *dentry); |
35 | 35 | static int afs_unlink(struct inode *dir, struct dentry *dentry); |
... | ... | @@ -949,7 +949,7 @@ |
949 | 949 | * create a regular file on an AFS filesystem |
950 | 950 | */ |
951 | 951 | static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
952 | - struct nameidata *nd) | |
952 | + bool excl) | |
953 | 953 | { |
954 | 954 | struct afs_file_status status; |
955 | 955 | struct afs_callback cb; |
fs/bad_inode.c
fs/bfs/dir.c
fs/btrfs/inode.c
... | ... | @@ -4893,7 +4893,7 @@ |
4893 | 4893 | } |
4894 | 4894 | |
4895 | 4895 | static int btrfs_create(struct inode *dir, struct dentry *dentry, |
4896 | - umode_t mode, struct nameidata *nd) | |
4896 | + umode_t mode, bool excl) | |
4897 | 4897 | { |
4898 | 4898 | struct btrfs_trans_handle *trans; |
4899 | 4899 | struct btrfs_root *root = BTRFS_I(dir)->root; |
fs/ceph/dir.c
fs/cifs/cifsfs.h
... | ... | @@ -45,7 +45,7 @@ |
45 | 45 | extern const struct inode_operations cifs_dir_inode_ops; |
46 | 46 | extern struct inode *cifs_root_iget(struct super_block *); |
47 | 47 | extern int cifs_create(struct inode *, struct dentry *, umode_t, |
48 | - struct nameidata *); | |
48 | + bool excl); | |
49 | 49 | extern int cifs_atomic_open(struct inode *, struct dentry *, |
50 | 50 | struct file *, unsigned, umode_t, |
51 | 51 | int *); |
fs/cifs/dir.c
fs/coda/dir.c
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | #include "coda_int.h" |
31 | 31 | |
32 | 32 | /* dir inode-ops */ |
33 | -static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, struct nameidata *nd); | |
33 | +static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, bool excl); | |
34 | 34 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, unsigned int flags); |
35 | 35 | static int coda_link(struct dentry *old_dentry, struct inode *dir_inode, |
36 | 36 | struct dentry *entry); |
... | ... | @@ -188,7 +188,7 @@ |
188 | 188 | } |
189 | 189 | |
190 | 190 | /* creation routines: create, mknod, mkdir, link, symlink */ |
191 | -static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, struct nameidata *nd) | |
191 | +static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, bool excl) | |
192 | 192 | { |
193 | 193 | int error; |
194 | 194 | const char *name=de->d_name.name; |
fs/ecryptfs/inode.c
... | ... | @@ -240,7 +240,6 @@ |
240 | 240 | * @dir: The inode of the directory in which to create the file. |
241 | 241 | * @dentry: The eCryptfs dentry |
242 | 242 | * @mode: The mode of the new file. |
243 | - * @nd: nameidata | |
244 | 243 | * |
245 | 244 | * Creates a new file. |
246 | 245 | * |
... | ... | @@ -248,7 +247,7 @@ |
248 | 247 | */ |
249 | 248 | static int |
250 | 249 | ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, |
251 | - umode_t mode, struct nameidata *nd) | |
250 | + umode_t mode, bool excl) | |
252 | 251 | { |
253 | 252 | struct inode *ecryptfs_inode; |
254 | 253 | int rc; |
fs/exofs/namei.c
fs/ext2/namei.c
... | ... | @@ -94,7 +94,7 @@ |
94 | 94 | * If the create succeeds, we fill in the inode information |
95 | 95 | * with d_instantiate(). |
96 | 96 | */ |
97 | -static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd) | |
97 | +static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, bool excl) | |
98 | 98 | { |
99 | 99 | struct inode *inode; |
100 | 100 |
fs/ext3/namei.c
fs/ext4/namei.c
fs/fat/namei_msdos.c
fs/fat/namei_vfat.c
fs/fuse/dir.c
fs/gfs2/inode.c
... | ... | @@ -755,11 +755,8 @@ |
755 | 755 | */ |
756 | 756 | |
757 | 757 | static int gfs2_create(struct inode *dir, struct dentry *dentry, |
758 | - umode_t mode, struct nameidata *nd) | |
758 | + umode_t mode, bool excl) | |
759 | 759 | { |
760 | - int excl = 0; | |
761 | - if (nd && (nd->flags & LOOKUP_EXCL)) | |
762 | - excl = 1; | |
763 | 760 | return gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0, excl); |
764 | 761 | } |
765 | 762 |
fs/hfs/dir.c
fs/hfsplus/dir.c
fs/hostfs/hostfs_kern.c
fs/hpfs/namei.c
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | return err; |
116 | 116 | } |
117 | 117 | |
118 | -static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) | |
118 | +static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) | |
119 | 119 | { |
120 | 120 | const unsigned char *name = dentry->d_name.name; |
121 | 121 | unsigned len = dentry->d_name.len; |
fs/hugetlbfs/inode.c
... | ... | @@ -565,7 +565,7 @@ |
565 | 565 | return retval; |
566 | 566 | } |
567 | 567 | |
568 | -static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) | |
568 | +static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) | |
569 | 569 | { |
570 | 570 | return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0); |
571 | 571 | } |
fs/jffs2/dir.c
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | static int jffs2_readdir (struct file *, void *, filldir_t); |
26 | 26 | |
27 | 27 | static int jffs2_create (struct inode *,struct dentry *,umode_t, |
28 | - struct nameidata *); | |
28 | + bool); | |
29 | 29 | static struct dentry *jffs2_lookup (struct inode *,struct dentry *, |
30 | 30 | unsigned int); |
31 | 31 | static int jffs2_link (struct dentry *,struct inode *,struct dentry *); |
... | ... | @@ -175,7 +175,7 @@ |
175 | 175 | |
176 | 176 | |
177 | 177 | static int jffs2_create(struct inode *dir_i, struct dentry *dentry, |
178 | - umode_t mode, struct nameidata *nd) | |
178 | + umode_t mode, bool excl) | |
179 | 179 | { |
180 | 180 | struct jffs2_raw_inode *ri; |
181 | 181 | struct jffs2_inode_info *f, *dir_f; |
fs/jfs/namei.c
fs/logfs/dir.c
fs/minix/namei.c
fs/namei.c
... | ... | @@ -2082,7 +2082,6 @@ |
2082 | 2082 | struct nameidata *nd) |
2083 | 2083 | { |
2084 | 2084 | int error = may_create(dir, dentry); |
2085 | - | |
2086 | 2085 | if (error) |
2087 | 2086 | return error; |
2088 | 2087 | |
... | ... | @@ -2093,7 +2092,7 @@ |
2093 | 2092 | error = security_inode_create(dir, dentry, mode); |
2094 | 2093 | if (error) |
2095 | 2094 | return error; |
2096 | - error = dir->i_op->create(dir, dentry, mode, nd); | |
2095 | + error = dir->i_op->create(dir, dentry, mode, !nd || (nd->flags & LOOKUP_EXCL)); | |
2097 | 2096 | if (!error) |
2098 | 2097 | fsnotify_create(dir, dentry); |
2099 | 2098 | return error; |
fs/ncpfs/dir.c
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | |
31 | 31 | static int ncp_readdir(struct file *, void *, filldir_t); |
32 | 32 | |
33 | -static int ncp_create(struct inode *, struct dentry *, umode_t, struct nameidata *); | |
33 | +static int ncp_create(struct inode *, struct dentry *, umode_t, bool); | |
34 | 34 | static struct dentry *ncp_lookup(struct inode *, struct dentry *, unsigned int); |
35 | 35 | static int ncp_unlink(struct inode *, struct dentry *); |
36 | 36 | static int ncp_mkdir(struct inode *, struct dentry *, umode_t); |
... | ... | @@ -980,7 +980,7 @@ |
980 | 980 | } |
981 | 981 | |
982 | 982 | static int ncp_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
983 | - struct nameidata *nd) | |
983 | + bool excl) | |
984 | 984 | { |
985 | 985 | return ncp_create_new(dir, dentry, mode, 0, 0); |
986 | 986 | } |
fs/nfs/dir.c
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | static int nfs_closedir(struct inode *, struct file *); |
48 | 48 | static int nfs_readdir(struct file *, void *, filldir_t); |
49 | 49 | static struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); |
50 | -static int nfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *); | |
50 | +static int nfs_create(struct inode *, struct dentry *, umode_t, bool); | |
51 | 51 | static int nfs_mkdir(struct inode *, struct dentry *, umode_t); |
52 | 52 | static int nfs_rmdir(struct inode *, struct dentry *); |
53 | 53 | static int nfs_unlink(struct inode *, struct dentry *); |
54 | 54 | |
55 | 55 | |
56 | 56 | |
... | ... | @@ -1589,20 +1589,17 @@ |
1589 | 1589 | * reply path made it appear to have failed. |
1590 | 1590 | */ |
1591 | 1591 | static int nfs_create(struct inode *dir, struct dentry *dentry, |
1592 | - umode_t mode, struct nameidata *nd) | |
1592 | + umode_t mode, bool excl) | |
1593 | 1593 | { |
1594 | 1594 | struct iattr attr; |
1595 | + int open_flags = excl ? O_CREAT | O_EXCL : O_CREAT; | |
1595 | 1596 | int error; |
1596 | - int open_flags = O_CREAT|O_EXCL; | |
1597 | 1597 | |
1598 | 1598 | dfprintk(VFS, "NFS: create(%s/%ld), %s\n", |
1599 | 1599 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); |
1600 | 1600 | |
1601 | 1601 | attr.ia_mode = mode; |
1602 | 1602 | attr.ia_valid = ATTR_MODE; |
1603 | - | |
1604 | - if (nd && !(nd->flags & LOOKUP_EXCL)) | |
1605 | - open_flags = O_CREAT; | |
1606 | 1603 | |
1607 | 1604 | error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags); |
1608 | 1605 | if (error != 0) |
fs/nilfs2/namei.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/namei.c
fs/omfs/dir.c
fs/ramfs/inode.c
... | ... | @@ -114,7 +114,7 @@ |
114 | 114 | return retval; |
115 | 115 | } |
116 | 116 | |
117 | -static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) | |
117 | +static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) | |
118 | 118 | { |
119 | 119 | return ramfs_mknod(dir, dentry, mode | S_IFREG, 0); |
120 | 120 | } |
fs/reiserfs/namei.c
fs/reiserfs/xattr.c
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 | static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) |
63 | 63 | { |
64 | 64 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
65 | - return dir->i_op->create(dir, dentry, mode, NULL); | |
65 | + return dir->i_op->create(dir, dentry, mode, true); | |
66 | 66 | } |
67 | 67 | #endif |
68 | 68 |
fs/sysv/namei.c
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 | return err; |
81 | 81 | } |
82 | 82 | |
83 | -static int sysv_create(struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd) | |
83 | +static int sysv_create(struct inode * dir, struct dentry * dentry, umode_t mode, bool excl) | |
84 | 84 | { |
85 | 85 | return sysv_mknod(dir, dentry, mode, 0); |
86 | 86 | } |
fs/ubifs/dir.c
fs/udf/namei.c
fs/ufs/namei.c
fs/xfs/xfs_iops.c
include/linux/fs.h
... | ... | @@ -1674,7 +1674,7 @@ |
1674 | 1674 | int (*readlink) (struct dentry *, char __user *,int); |
1675 | 1675 | void (*put_link) (struct dentry *, struct nameidata *, void *); |
1676 | 1676 | |
1677 | - int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *); | |
1677 | + int (*create) (struct inode *,struct dentry *, umode_t, bool); | |
1678 | 1678 | int (*link) (struct dentry *,struct inode *,struct dentry *); |
1679 | 1679 | int (*unlink) (struct inode *,struct dentry *); |
1680 | 1680 | int (*symlink) (struct inode *,struct dentry *,const char *); |
ipc/mqueue.c
mm/shmem.c