diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-13 13:55:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-13 13:55:58 -0400 |
commit | 9bf12df31f282e845b3dfaac1e5d5376a041da22 (patch) | |
tree | 10d7a21d34c7f2c47eff3e807f5efef46228d507 /fs/anon_inodes.c | |
parent | 399a946edbbe90bd03aec2e93ce58c9b3f18e70b (diff) | |
parent | d9b2c8714aef102dea95544a8cd9372b21af463f (diff) |
Merge git://git.kvack.org/~bcrl/aio-next
Pull aio changes from Ben LaHaise:
"First off, sorry for this pull request being late in the merge window.
Al had raised a couple of concerns about 2 items in the series below.
I addressed the first issue (the race introduced by Gu's use of
mm_populate()), but he has not provided any further details on how he
wants to rework the anon_inode.c changes (which were sent out months
ago but have yet to be commented on).
The bulk of the changes have been sitting in the -next tree for a few
months, with all the issues raised being addressed"
* git://git.kvack.org/~bcrl/aio-next: (22 commits)
aio: rcu_read_lock protection for new rcu_dereference calls
aio: fix race in ring buffer page lookup introduced by page migration support
aio: fix rcu sparse warnings introduced by ioctx table lookup patch
aio: remove unnecessary debugging from aio_free_ring()
aio: table lookup: verify ctx pointer
staging/lustre: kiocb->ki_left is removed
aio: fix error handling and rcu usage in "convert the ioctx list to table lookup v3"
aio: be defensive to ensure request batching is non-zero instead of BUG_ON()
aio: convert the ioctx list to table lookup v3
aio: double aio_max_nr in calculations
aio: Kill ki_dtor
aio: Kill ki_users
aio: Kill unneeded kiocb members
aio: Kill aio_rw_vect_retry()
aio: Don't use ctx->tail unnecessarily
aio: io_cancel() no longer returns the io_event
aio: percpu ioctx refcount
aio: percpu reqs_available
aio: reqs_active -> reqs_available
aio: fix build when migration is disabled
...
Diffstat (limited to 'fs/anon_inodes.c')
-rw-r--r-- | fs/anon_inodes.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 47a65df8c871..85c961849953 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
@@ -109,6 +109,72 @@ static struct file_system_type anon_inode_fs_type = { | |||
109 | }; | 109 | }; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * anon_inode_getfile_private - creates a new file instance by hooking it up to an | ||
113 | * anonymous inode, and a dentry that describe the "class" | ||
114 | * of the file | ||
115 | * | ||
116 | * @name: [in] name of the "class" of the new file | ||
117 | * @fops: [in] file operations for the new file | ||
118 | * @priv: [in] private data for the new file (will be file's private_data) | ||
119 | * @flags: [in] flags | ||
120 | * | ||
121 | * | ||
122 | * Similar to anon_inode_getfile, but each file holds a single inode. | ||
123 | * | ||
124 | */ | ||
125 | struct file *anon_inode_getfile_private(const char *name, | ||
126 | const struct file_operations *fops, | ||
127 | void *priv, int flags) | ||
128 | { | ||
129 | struct qstr this; | ||
130 | struct path path; | ||
131 | struct file *file; | ||
132 | struct inode *inode; | ||
133 | |||
134 | if (fops->owner && !try_module_get(fops->owner)) | ||
135 | return ERR_PTR(-ENOENT); | ||
136 | |||
137 | inode = anon_inode_mkinode(anon_inode_mnt->mnt_sb); | ||
138 | if (IS_ERR(inode)) { | ||
139 | file = ERR_PTR(-ENOMEM); | ||
140 | goto err_module; | ||
141 | } | ||
142 | |||
143 | /* | ||
144 | * Link the inode to a directory entry by creating a unique name | ||
145 | * using the inode sequence number. | ||
146 | */ | ||
147 | file = ERR_PTR(-ENOMEM); | ||
148 | this.name = name; | ||
149 | this.len = strlen(name); | ||
150 | this.hash = 0; | ||
151 | path.dentry = d_alloc_pseudo(anon_inode_mnt->mnt_sb, &this); | ||
152 | if (!path.dentry) | ||
153 | goto err_module; | ||
154 | |||
155 | path.mnt = mntget(anon_inode_mnt); | ||
156 | |||
157 | d_instantiate(path.dentry, inode); | ||
158 | |||
159 | file = alloc_file(&path, OPEN_FMODE(flags), fops); | ||
160 | if (IS_ERR(file)) | ||
161 | goto err_dput; | ||
162 | |||
163 | file->f_mapping = inode->i_mapping; | ||
164 | file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); | ||
165 | file->private_data = priv; | ||
166 | |||
167 | return file; | ||
168 | |||
169 | err_dput: | ||
170 | path_put(&path); | ||
171 | err_module: | ||
172 | module_put(fops->owner); | ||
173 | return file; | ||
174 | } | ||
175 | EXPORT_SYMBOL_GPL(anon_inode_getfile_private); | ||
176 | |||
177 | /** | ||
112 | * anon_inode_getfile - creates a new file instance by hooking it up to an | 178 | * anon_inode_getfile - creates a new file instance by hooking it up to an |
113 | * anonymous inode, and a dentry that describe the "class" | 179 | * anonymous inode, and a dentry that describe the "class" |
114 | * of the file | 180 | * of the file |