diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-21 13:07:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-21 13:07:25 -0400 |
commit | 90125edbc49ec58b9101c4271bb1d87b04a4620f (patch) | |
tree | 068353d4234435b17ade687b50a5d5015bdf1ad9 /fs/kernfs | |
parent | 0a8adf584759cbcbce5d88d419db01a8d0373abf (diff) | |
parent | 9a3c4145af32125c5ee39c0272662b47307a8323 (diff) |
Merge 3.16-rc6 into driver-core-next
We want the platform changes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/mount.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index d171b98a6cdd..f973ae9b05f1 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c | |||
@@ -211,6 +211,36 @@ void kernfs_kill_sb(struct super_block *sb) | |||
211 | kernfs_put(root_kn); | 211 | kernfs_put(root_kn); |
212 | } | 212 | } |
213 | 213 | ||
214 | /** | ||
215 | * kernfs_pin_sb: try to pin the superblock associated with a kernfs_root | ||
216 | * @kernfs_root: the kernfs_root in question | ||
217 | * @ns: the namespace tag | ||
218 | * | ||
219 | * Pin the superblock so the superblock won't be destroyed in subsequent | ||
220 | * operations. This can be used to block ->kill_sb() which may be useful | ||
221 | * for kernfs users which dynamically manage superblocks. | ||
222 | * | ||
223 | * Returns NULL if there's no superblock associated to this kernfs_root, or | ||
224 | * -EINVAL if the superblock is being freed. | ||
225 | */ | ||
226 | struct super_block *kernfs_pin_sb(struct kernfs_root *root, const void *ns) | ||
227 | { | ||
228 | struct kernfs_super_info *info; | ||
229 | struct super_block *sb = NULL; | ||
230 | |||
231 | mutex_lock(&kernfs_mutex); | ||
232 | list_for_each_entry(info, &root->supers, node) { | ||
233 | if (info->ns == ns) { | ||
234 | sb = info->sb; | ||
235 | if (!atomic_inc_not_zero(&info->sb->s_active)) | ||
236 | sb = ERR_PTR(-EINVAL); | ||
237 | break; | ||
238 | } | ||
239 | } | ||
240 | mutex_unlock(&kernfs_mutex); | ||
241 | return sb; | ||
242 | } | ||
243 | |||
214 | void __init kernfs_init(void) | 244 | void __init kernfs_init(void) |
215 | { | 245 | { |
216 | kernfs_node_cache = kmem_cache_create("kernfs_node_cache", | 246 | kernfs_node_cache = kmem_cache_create("kernfs_node_cache", |