aboutsummaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-13 22:58:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-13 22:58:36 -0400
commita66b4cd1e7163adb327838a3c81faaf6a9330d5a (patch)
tree2b123a010bb0f1566ff6f34e529f01ddf10ee308 /fs/aio.c
parentb16528466786a540cb00148acb124e0149d62710 (diff)
parent5f336e722cc961be94d264d96b90c92888fffae1 (diff)
Merge branch 'work.open3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs open-related updates from Al Viro: - "do we need fput() or put_filp()" rules are gone - it's always fput() now. We keep track of that state where it belongs - in ->f_mode. - int *opened mess killed - in finish_open(), in ->atomic_open() instances and in fs/namei.c code around do_last()/lookup_open()/atomic_open(). - alloc_file() wrappers with saner calling conventions are introduced (alloc_file_clone() and alloc_file_pseudo()); callers converted, with much simplification. - while we are at it, saner calling conventions for path_init() and link_path_walk(), simplifying things inside fs/namei.c (both on open-related paths and elsewhere). * 'work.open3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (40 commits) few more cleanups of link_path_walk() callers allow link_path_walk() to take ERR_PTR() make path_init() unconditionally paired with terminate_walk() document alloc_file() changes make alloc_file() static do_shmat(): grab shp->shm_file earlier, switch to alloc_file_clone() new helper: alloc_file_clone() create_pipe_files(): switch the first allocation to alloc_file_pseudo() anon_inode_getfile(): switch to alloc_file_pseudo() hugetlb_file_setup(): switch to alloc_file_pseudo() ocxlflash_getfile(): switch to alloc_file_pseudo() cxl_getfile(): switch to alloc_file_pseudo() ... and switch shmem_file_setup() to alloc_file_pseudo() __shmem_file_setup(): reorder allocations new wrapper: alloc_file_pseudo() kill FILE_{CREATED,OPENED} switch atomic_open() and lookup_open() to returning 0 in all success cases document ->atomic_open() changes ->atomic_open(): return 0 in all success cases get rid of 'opened' in path_openat() and the helpers downstream ...
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 27454594e37a..16f1f25bfd89 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -202,9 +202,7 @@ static const struct address_space_operations aio_ctx_aops;
202 202
203static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) 203static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
204{ 204{
205 struct qstr this = QSTR_INIT("[aio]", 5);
206 struct file *file; 205 struct file *file;
207 struct path path;
208 struct inode *inode = alloc_anon_inode(aio_mnt->mnt_sb); 206 struct inode *inode = alloc_anon_inode(aio_mnt->mnt_sb);
209 if (IS_ERR(inode)) 207 if (IS_ERR(inode))
210 return ERR_CAST(inode); 208 return ERR_CAST(inode);
@@ -213,31 +211,17 @@ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
213 inode->i_mapping->private_data = ctx; 211 inode->i_mapping->private_data = ctx;
214 inode->i_size = PAGE_SIZE * nr_pages; 212 inode->i_size = PAGE_SIZE * nr_pages;
215 213
216 path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); 214 file = alloc_file_pseudo(inode, aio_mnt, "[aio]",
217 if (!path.dentry) { 215 O_RDWR, &aio_ring_fops);
216 if (IS_ERR(file))
218 iput(inode); 217 iput(inode);
219 return ERR_PTR(-ENOMEM);
220 }
221 path.mnt = mntget(aio_mnt);
222
223 d_instantiate(path.dentry, inode);
224 file = alloc_file(&path, FMODE_READ | FMODE_WRITE, &aio_ring_fops);
225 if (IS_ERR(file)) {
226 path_put(&path);
227 return file;
228 }
229
230 file->f_flags = O_RDWR;
231 return file; 218 return file;
232} 219}
233 220
234static struct dentry *aio_mount(struct file_system_type *fs_type, 221static struct dentry *aio_mount(struct file_system_type *fs_type,
235 int flags, const char *dev_name, void *data) 222 int flags, const char *dev_name, void *data)
236{ 223{
237 static const struct dentry_operations ops = { 224 struct dentry *root = mount_pseudo(fs_type, "aio:", NULL, NULL,
238 .d_dname = simple_dname,
239 };
240 struct dentry *root = mount_pseudo(fs_type, "aio:", NULL, &ops,
241 AIO_RING_MAGIC); 225 AIO_RING_MAGIC);
242 226
243 if (!IS_ERR(root)) 227 if (!IS_ERR(root))