]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/autofs4/inode.c
autofs4: don't make expiring dentry negative
[linux-2.6-omap-h63xx.git] / fs / autofs4 / inode.c
index 26063dc84a2a623da272a92a5c323058eb63ebb2..94bfc154d7a2a5ac9fcc69279a692d885cb6ee51 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/pagemap.h>
 #include <linux/parser.h>
 #include <linux/bitops.h>
-#include <linux/smp_lock.h>
 #include <linux/magic.h>
 #include "autofs_i.h"
 #include <linux/module.h>
@@ -48,7 +47,7 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
        ino->dentry = NULL;
        ino->size = 0;
 
-       INIT_LIST_HEAD(&ino->rehash);
+       INIT_LIST_HEAD(&ino->expiring);
 
        ino->last_used = jiffies;
        atomic_set(&ino->count, 0);
@@ -177,11 +176,16 @@ out_kill_sb:
 static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
 {
        struct autofs_sb_info *sbi = autofs4_sbi(mnt->mnt_sb);
+       struct inode *root_inode = mnt->mnt_sb->s_root->d_inode;
 
        if (!sbi)
                return 0;
 
        seq_printf(m, ",fd=%d", sbi->pipefd);
+       if (root_inode->i_uid != 0)
+               seq_printf(m, ",uid=%u", root_inode->i_uid);
+       if (root_inode->i_gid != 0)
+               seq_printf(m, ",gid=%u", root_inode->i_gid);
        seq_printf(m, ",pgrp=%d", sbi->oz_pgrp);
        seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ);
        seq_printf(m, ",minproto=%d", sbi->min_proto);
@@ -219,8 +223,7 @@ static match_table_t tokens = {
 };
 
 static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
-                        pid_t *pgrp, unsigned int *type,
-                        int *minproto, int *maxproto)
+               pid_t *pgrp, unsigned int *type, int *minproto, int *maxproto)
 {
        char *p;
        substring_t args[MAX_OPT_ARGS];
@@ -228,7 +231,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
 
        *uid = current->uid;
        *gid = current->gid;
-       *pgrp = process_group(current);
+       *pgrp = task_pgrp_nr(current);
 
        *minproto = AUTOFS_MIN_PROTO_VERSION;
        *maxproto = AUTOFS_MAX_PROTO_VERSION;
@@ -314,20 +317,18 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        struct autofs_sb_info *sbi;
        struct autofs_info *ino;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
-       if ( !sbi )
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
+       if (!sbi)
                goto fail_unlock;
        DPRINTK("starting up, sbi = %p",sbi);
 
-       memset(sbi, 0, sizeof(*sbi));
-
        s->s_fs_info = sbi;
        sbi->magic = AUTOFS_SBI_MAGIC;
        sbi->pipefd = -1;
        sbi->pipe = NULL;
        sbi->catatonic = 1;
        sbi->exp_timeout = 0;
-       sbi->oz_pgrp = process_group(current);
+       sbi->oz_pgrp = task_pgrp_nr(current);
        sbi->sb = s;
        sbi->version = 0;
        sbi->sub_version = 0;
@@ -337,8 +338,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        mutex_init(&sbi->wq_mutex);
        spin_lock_init(&sbi->fs_lock);
        sbi->queues = NULL;
-       spin_lock_init(&sbi->rehash_lock);
-       INIT_LIST_HEAD(&sbi->rehash_list);
+       spin_lock_init(&sbi->lookup_lock);
+       INIT_LIST_HEAD(&sbi->expiring_list);
        s->s_blocksize = 1024;
        s->s_blocksize_bits = 10;
        s->s_magic = AUTOFS_SUPER_MAGIC;
@@ -364,10 +365,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        root->d_fsdata = ino;
 
        /* Can this call block? */
-       if (parse_options(data, &pipefd,
-                         &root_inode->i_uid, &root_inode->i_gid,
-                         &sbi->oz_pgrp, &sbi->type,
-                         &sbi->min_proto, &sbi->max_proto)) {
+       if (parse_options(data, &pipefd, &root_inode->i_uid, &root_inode->i_gid,
+                               &sbi->oz_pgrp, &sbi->type, &sbi->min_proto,
+                               &sbi->max_proto)) {
                printk("autofs: called with bogus options\n");
                goto fail_dput;
        }
@@ -397,11 +397,11 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
        pipe = fget(pipefd);
        
-       if ( !pipe ) {
+       if (!pipe) {
                printk("autofs: could not open pipe file descriptor\n");
                goto fail_dput;
        }
-       if ( !pipe->f_op || !pipe->f_op->write )
+       if (!pipe->f_op || !pipe->f_op->write)
                goto fail_fput;
        sbi->pipe = pipe;
        sbi->pipefd = pipefd;