diff options
author | Sukadev Bhattiprolu <sukadev@us.ibm.com> | 2007-05-10 22:23:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 08:29:36 -0700 |
commit | fa0334f19f0e1a1e570fc2a160dfe53536599ade (patch) | |
tree | d223dcb53af7b5dd80958a1710c335ca942e1bcc /fs/autofs/inode.c | |
parent | d78e53c89a820471837e0cb91fe36b7be1a7c9de (diff) | |
download | linux-fa0334f19f0e1a1e570fc2a160dfe53536599ade.tar.bz2 |
Replace pid_t in autofs with struct pid reference
Make autofs container-friendly by caching struct pid reference rather than
pid_t and using pid_nr() to retreive a task's pid_t.
ChangeLog:
- Fix Eric Biederman's comments - Use find_get_pid() to hold a
reference to oz_pgrp and release while unmounting; separate out
changes to autofs and autofs4.
- Fix Cedric's comments: retain old prototype of parse_options()
and move necessary change to its caller.
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: containers@lists.osdl.org
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs/inode.c')
-rw-r--r-- | fs/autofs/inode.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index d8315e61731e..e7204d71acc9 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -37,6 +37,8 @@ void autofs_kill_sb(struct super_block *sb) if (!sbi->catatonic) autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */ + put_pid(sbi->oz_pgrp); + autofs_hash_nuke(sbi); for (n = 0; n < AUTOFS_MAX_SYMLINKS; n++) { if (test_bit(n, sbi->symlink_bitmap)) @@ -139,6 +141,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) int pipefd; struct autofs_sb_info *sbi; int minproto, maxproto; + pid_t pgid; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) @@ -150,7 +153,6 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) sbi->pipe = NULL; sbi->catatonic = 1; sbi->exp_timeout = 0; - sbi->oz_pgrp = process_group(current); autofs_initialize_hash(&sbi->dirhash); sbi->queues = NULL; memset(sbi->symlink_bitmap, 0, sizeof(long)*AUTOFS_SYMLINK_BITMAP_LEN); @@ -171,7 +173,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) /* Can this call block? - WTF cares? s is locked. */ if (parse_options(data, &pipefd, &root_inode->i_uid, - &root_inode->i_gid, &sbi->oz_pgrp, &minproto, + &root_inode->i_gid, &pgid, &minproto, &maxproto)) { printk("autofs: called with bogus options\n"); goto fail_dput; @@ -184,13 +186,21 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) goto fail_dput; } - DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp)); + DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, pgid)); + sbi->oz_pgrp = find_get_pid(pgid); + + if (!sbi->oz_pgrp) { + printk("autofs: could not find process group %d\n", pgid); + goto fail_dput; + } + pipe = fget(pipefd); if (!pipe) { printk("autofs: could not open pipe file descriptor\n"); - goto fail_dput; + goto fail_put_pid; } + if (!pipe->f_op || !pipe->f_op->write) goto fail_fput; sbi->pipe = pipe; @@ -205,6 +215,8 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) fail_fput: printk("autofs: pipe file descriptor does not contain proper ops\n"); fput(pipe); +fail_put_pid: + put_pid(sbi->oz_pgrp); fail_dput: dput(root); goto fail_free; |