diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 22:11:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 22:11:50 -0500 |
commit | 3aacd625f20129f5a41ea3ff3b5353b0e4dabd01 (patch) | |
tree | 7cf4ea65397f80098b30494df31cfc8f5fa26d63 /fs/autofs4/inode.c | |
parent | 7e21774db5cc9cf8fe93a64a2f0c6cf47db8ab24 (diff) | |
parent | 2a1d689c9ba42a6066540fb221b6ecbd6298b728 (diff) |
Merge branch 'akpm' (incoming from Andrew)
Merge second patch-bomb from Andrew Morton:
- various misc bits
- the rest of MM
- add generic fixmap.h, use it
- backlight updates
- dynamic_debug updates
- printk() updates
- checkpatch updates
- binfmt_elf
- ramfs
- init/
- autofs4
- drivers/rtc
- nilfs
- hfsplus
- Documentation/
- coredump
- procfs
- fork
- exec
- kexec
- kdump
- partitions
- rapidio
- rbtree
- userns
- memstick
- w1
- decompressors
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (197 commits)
lib/decompress_unlz4.c: always set an error return code on failures
romfs: fix returm err while getting inode in fill_super
drivers/w1/masters/w1-gpio.c: add strong pullup emulation
drivers/memstick/host/rtsx_pci_ms.c: fix ms card data transfer bug
userns: relax the posix_acl_valid() checks
arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of solution using repeated rb_erase()
fs-ext3-use-rbtree-postorder-iteration-helper-instead-of-opencoding-fix
fs/ext3: use rbtree postorder iteration helper instead of opencoding
fs/jffs2: use rbtree postorder iteration helper instead of opencoding
fs/ext4: use rbtree postorder iteration helper instead of opencoding
fs/ubifs: use rbtree postorder iteration helper instead of opencoding
net/netfilter/ipset/ip_set_hash_netiface.c: use rbtree postorder iteration instead of opencoding
rbtree/test: test rbtree_postorder_for_each_entry_safe()
rbtree/test: move rb_node to the middle of the test struct
rapidio: add modular rapidio core build into powerpc and mips branches
partitions/efi: complete documentation of gpt kernel param purpose
kdump: add /sys/kernel/vmcoreinfo ABI documentation
kdump: fix exported size of vmcoreinfo note
kexec: add sysctl to disable kexec_load
fs/exec.c: call arch_pick_mmap_layout() only once
...
Diffstat (limited to 'fs/autofs4/inode.c')
-rw-r--r-- | fs/autofs4/inode.c | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 3b9cc9b973c2..d7bd395ab586 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -56,8 +56,11 @@ void autofs4_kill_sb(struct super_block *sb) | |||
56 | * just call kill_anon_super when we are called from | 56 | * just call kill_anon_super when we are called from |
57 | * deactivate_super. | 57 | * deactivate_super. |
58 | */ | 58 | */ |
59 | if (sbi) /* Free wait queues, close pipe */ | 59 | if (sbi) { |
60 | /* Free wait queues, close pipe */ | ||
60 | autofs4_catatonic_mode(sbi); | 61 | autofs4_catatonic_mode(sbi); |
62 | put_pid(sbi->oz_pgrp); | ||
63 | } | ||
61 | 64 | ||
62 | DPRINTK("shutting down"); | 65 | DPRINTK("shutting down"); |
63 | kill_litter_super(sb); | 66 | kill_litter_super(sb); |
@@ -80,7 +83,7 @@ static int autofs4_show_options(struct seq_file *m, struct dentry *root) | |||
80 | if (!gid_eq(root_inode->i_gid, GLOBAL_ROOT_GID)) | 83 | if (!gid_eq(root_inode->i_gid, GLOBAL_ROOT_GID)) |
81 | seq_printf(m, ",gid=%u", | 84 | seq_printf(m, ",gid=%u", |
82 | from_kgid_munged(&init_user_ns, root_inode->i_gid)); | 85 | from_kgid_munged(&init_user_ns, root_inode->i_gid)); |
83 | seq_printf(m, ",pgrp=%d", sbi->oz_pgrp); | 86 | seq_printf(m, ",pgrp=%d", pid_vnr(sbi->oz_pgrp)); |
84 | seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ); | 87 | seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ); |
85 | seq_printf(m, ",minproto=%d", sbi->min_proto); | 88 | seq_printf(m, ",minproto=%d", sbi->min_proto); |
86 | seq_printf(m, ",maxproto=%d", sbi->max_proto); | 89 | seq_printf(m, ",maxproto=%d", sbi->max_proto); |
@@ -124,7 +127,8 @@ static const match_table_t tokens = { | |||
124 | }; | 127 | }; |
125 | 128 | ||
126 | static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, | 129 | static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, |
127 | pid_t *pgrp, unsigned int *type, int *minproto, int *maxproto) | 130 | int *pgrp, bool *pgrp_set, unsigned int *type, |
131 | int *minproto, int *maxproto) | ||
128 | { | 132 | { |
129 | char *p; | 133 | char *p; |
130 | substring_t args[MAX_OPT_ARGS]; | 134 | substring_t args[MAX_OPT_ARGS]; |
@@ -132,7 +136,6 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, | |||
132 | 136 | ||
133 | *uid = current_uid(); | 137 | *uid = current_uid(); |
134 | *gid = current_gid(); | 138 | *gid = current_gid(); |
135 | *pgrp = task_pgrp_nr(current); | ||
136 | 139 | ||
137 | *minproto = AUTOFS_MIN_PROTO_VERSION; | 140 | *minproto = AUTOFS_MIN_PROTO_VERSION; |
138 | *maxproto = AUTOFS_MAX_PROTO_VERSION; | 141 | *maxproto = AUTOFS_MAX_PROTO_VERSION; |
@@ -171,6 +174,7 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, | |||
171 | if (match_int(args, &option)) | 174 | if (match_int(args, &option)) |
172 | return 1; | 175 | return 1; |
173 | *pgrp = option; | 176 | *pgrp = option; |
177 | *pgrp_set = true; | ||
174 | break; | 178 | break; |
175 | case Opt_minproto: | 179 | case Opt_minproto: |
176 | if (match_int(args, &option)) | 180 | if (match_int(args, &option)) |
@@ -206,10 +210,13 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
206 | int pipefd; | 210 | int pipefd; |
207 | struct autofs_sb_info *sbi; | 211 | struct autofs_sb_info *sbi; |
208 | struct autofs_info *ino; | 212 | struct autofs_info *ino; |
213 | int pgrp; | ||
214 | bool pgrp_set = false; | ||
215 | int ret = -EINVAL; | ||
209 | 216 | ||
210 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 217 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
211 | if (!sbi) | 218 | if (!sbi) |
212 | goto fail_unlock; | 219 | return -ENOMEM; |
213 | DPRINTK("starting up, sbi = %p",sbi); | 220 | DPRINTK("starting up, sbi = %p",sbi); |
214 | 221 | ||
215 | s->s_fs_info = sbi; | 222 | s->s_fs_info = sbi; |
@@ -218,7 +225,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
218 | sbi->pipe = NULL; | 225 | sbi->pipe = NULL; |
219 | sbi->catatonic = 1; | 226 | sbi->catatonic = 1; |
220 | sbi->exp_timeout = 0; | 227 | sbi->exp_timeout = 0; |
221 | sbi->oz_pgrp = task_pgrp_nr(current); | 228 | sbi->oz_pgrp = NULL; |
222 | sbi->sb = s; | 229 | sbi->sb = s; |
223 | sbi->version = 0; | 230 | sbi->version = 0; |
224 | sbi->sub_version = 0; | 231 | sbi->sub_version = 0; |
@@ -243,8 +250,10 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
243 | * Get the root inode and dentry, but defer checking for errors. | 250 | * Get the root inode and dentry, but defer checking for errors. |
244 | */ | 251 | */ |
245 | ino = autofs4_new_ino(sbi); | 252 | ino = autofs4_new_ino(sbi); |
246 | if (!ino) | 253 | if (!ino) { |
254 | ret = -ENOMEM; | ||
247 | goto fail_free; | 255 | goto fail_free; |
256 | } | ||
248 | root_inode = autofs4_get_inode(s, S_IFDIR | 0755); | 257 | root_inode = autofs4_get_inode(s, S_IFDIR | 0755); |
249 | root = d_make_root(root_inode); | 258 | root = d_make_root(root_inode); |
250 | if (!root) | 259 | if (!root) |
@@ -255,12 +264,23 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
255 | 264 | ||
256 | /* Can this call block? */ | 265 | /* Can this call block? */ |
257 | if (parse_options(data, &pipefd, &root_inode->i_uid, &root_inode->i_gid, | 266 | if (parse_options(data, &pipefd, &root_inode->i_uid, &root_inode->i_gid, |
258 | &sbi->oz_pgrp, &sbi->type, &sbi->min_proto, | 267 | &pgrp, &pgrp_set, &sbi->type, &sbi->min_proto, |
259 | &sbi->max_proto)) { | 268 | &sbi->max_proto)) { |
260 | printk("autofs: called with bogus options\n"); | 269 | printk("autofs: called with bogus options\n"); |
261 | goto fail_dput; | 270 | goto fail_dput; |
262 | } | 271 | } |
263 | 272 | ||
273 | if (pgrp_set) { | ||
274 | sbi->oz_pgrp = find_get_pid(pgrp); | ||
275 | if (!sbi->oz_pgrp) { | ||
276 | pr_warn("autofs: could not find process group %d\n", | ||
277 | pgrp); | ||
278 | goto fail_dput; | ||
279 | } | ||
280 | } else { | ||
281 | sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID); | ||
282 | } | ||
283 | |||
264 | if (autofs_type_trigger(sbi->type)) | 284 | if (autofs_type_trigger(sbi->type)) |
265 | __managed_dentry_set_managed(root); | 285 | __managed_dentry_set_managed(root); |
266 | 286 | ||
@@ -284,14 +304,15 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
284 | sbi->version = sbi->max_proto; | 304 | sbi->version = sbi->max_proto; |
285 | sbi->sub_version = AUTOFS_PROTO_SUBVERSION; | 305 | sbi->sub_version = AUTOFS_PROTO_SUBVERSION; |
286 | 306 | ||
287 | DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp); | 307 | DPRINTK("pipe fd = %d, pgrp = %u", pipefd, pid_nr(sbi->oz_pgrp)); |
288 | pipe = fget(pipefd); | 308 | pipe = fget(pipefd); |
289 | 309 | ||
290 | if (!pipe) { | 310 | if (!pipe) { |
291 | printk("autofs: could not open pipe file descriptor\n"); | 311 | printk("autofs: could not open pipe file descriptor\n"); |
292 | goto fail_dput; | 312 | goto fail_dput; |
293 | } | 313 | } |
294 | if (autofs_prepare_pipe(pipe) < 0) | 314 | ret = autofs_prepare_pipe(pipe); |
315 | if (ret < 0) | ||
295 | goto fail_fput; | 316 | goto fail_fput; |
296 | sbi->pipe = pipe; | 317 | sbi->pipe = pipe; |
297 | sbi->pipefd = pipefd; | 318 | sbi->pipefd = pipefd; |
@@ -316,10 +337,10 @@ fail_dput: | |||
316 | fail_ino: | 337 | fail_ino: |
317 | kfree(ino); | 338 | kfree(ino); |
318 | fail_free: | 339 | fail_free: |
340 | put_pid(sbi->oz_pgrp); | ||
319 | kfree(sbi); | 341 | kfree(sbi); |
320 | s->s_fs_info = NULL; | 342 | s->s_fs_info = NULL; |
321 | fail_unlock: | 343 | return ret; |
322 | return -EINVAL; | ||
323 | } | 344 | } |
324 | 345 | ||
325 | struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode) | 346 | struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode) |