summaryrefslogtreecommitdiffstats
path: root/fs/autofs
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-04-28 01:09:25 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-04-28 01:09:25 +0000
commitb9ba7aeb165cffecdffb60aec8c3fa8d590d9ca9 (patch)
tree42d07b0c7246ae2536a702e7c5de9e2732341116 /fs/autofs
parent7406b0a326f2d70ade2671c37d1beef62249db97 (diff)
Merge with 2.3.99-pre6.
Diffstat (limited to 'fs/autofs')
-rw-r--r--fs/autofs/autofs_i.h5
-rw-r--r--fs/autofs/dirhash.c24
-rw-r--r--fs/autofs/inode.c74
-rw-r--r--fs/autofs/root.c8
4 files changed, 14 insertions, 97 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index 51305918b..cfd74c9d5 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -56,13 +56,12 @@ struct autofs_dir_ent {
struct autofs_dir_ent **back;
/* The following entries are for the expiry system */
unsigned long last_usage;
- struct autofs_dir_ent *exp_next;
- struct autofs_dir_ent *exp_prev;
+ struct list_head exp;
};
struct autofs_dirhash {
struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
- struct autofs_dir_ent expiry_head;
+ struct list_head expiry_head;
};
struct autofs_wait_queue {
diff --git a/fs/autofs/dirhash.c b/fs/autofs/dirhash.c
index b5626e5bb..6dc3e4f60 100644
--- a/fs/autofs/dirhash.c
+++ b/fs/autofs/dirhash.c
@@ -17,17 +17,13 @@
static void autofs_init_usage(struct autofs_dirhash *dh,
struct autofs_dir_ent *ent)
{
- ent->exp_next = &dh->expiry_head;
- ent->exp_prev = dh->expiry_head.exp_prev;
- dh->expiry_head.exp_prev->exp_next = ent;
- dh->expiry_head.exp_prev = ent;
+ list_add_tail(&ent->exp, &dh->expiry_head);
ent->last_usage = jiffies;
}
static void autofs_delete_usage(struct autofs_dir_ent *ent)
{
- ent->exp_prev->exp_next = ent->exp_next;
- ent->exp_next->exp_prev = ent->exp_prev;
+ list_del(&ent->exp);
}
void autofs_update_usage(struct autofs_dirhash *dh,
@@ -45,12 +41,13 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
struct dentry *dentry;
unsigned long timeout = sbi->exp_timeout;
- ent = dh->expiry_head.exp_next;
-
- if ( ent == &(dh->expiry_head) || sbi->catatonic )
- return NULL; /* No entries */
-
- while ( jiffies - ent->last_usage >= timeout ) {
+ while (1) {
+ if ( list_empty(&dh->expiry_head) || sbi->catatonic )
+ return NULL; /* No entries */
+ /* We keep the list sorted by last_usage and want old stuff */
+ ent = list_entry(dh->expiry_head.next, struct autofs_dir_ent, exp);
+ if (jiffies - ent->last_usage < timeout)
+ break;
/* Move to end of list in case expiry isn't desirable */
autofs_update_usage(dh, ent);
@@ -94,8 +91,7 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
void autofs_initialize_hash(struct autofs_dirhash *dh) {
memset(&dh->h, 0, AUTOFS_HASH_SIZE*sizeof(struct autofs_dir_ent *));
- dh->expiry_head.exp_next = dh->expiry_head.exp_prev =
- &dh->expiry_head;
+ INIT_LIST_HEAD(&dh->expiry_head);
}
struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *dh, struct qstr *name)
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 2c2e7d32d..ae157d1ac 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -19,19 +19,6 @@
#define __NO_VERSION__
#include <linux/module.h>
-/*
- * Dummy functions - do we ever actually want to do
- * something here?
- */
-static void autofs_put_inode(struct inode *inode)
-{
-}
-
-static void autofs_delete_inode(struct inode *inode)
-{
- inode->i_size = 0;
-}
-
static void autofs_put_super(struct super_block *sb)
{
struct autofs_sb_info *sbi = autofs_sbi(sb);
@@ -53,13 +40,9 @@ static void autofs_put_super(struct super_block *sb)
static int autofs_statfs(struct super_block *sb, struct statfs *buf);
static void autofs_read_inode(struct inode *inode);
-static void autofs_write_inode(struct inode *inode);
static struct super_operations autofs_sops = {
read_inode: autofs_read_inode,
- write_inode: autofs_write_inode,
- put_inode: autofs_put_inode,
- delete_inode: autofs_delete_inode,
put_super: autofs_put_super,
statfs: autofs_statfs,
};
@@ -137,10 +120,6 @@ struct super_block *autofs_read_super(struct super_block *s, void *data,
struct autofs_sb_info *sbi;
int minproto, maxproto;
- /* Super block already completed? */
- if (s->s_root)
- goto out_unlock;
-
sbi = (struct autofs_sb_info *) kmalloc(sizeof(struct autofs_sb_info), GFP_KERNEL);
if ( !sbi )
goto fail_unlock;
@@ -159,25 +138,15 @@ struct super_block *autofs_read_super(struct super_block *s, void *data,
s->s_blocksize_bits = 10;
s->s_magic = AUTOFS_SUPER_MAGIC;
s->s_op = &autofs_sops;
- s->s_root = NULL;
- /*
- * Get the root inode and dentry, but defer checking for errors.
- */
root_inode = iget(s, AUTOFS_ROOT_INO);
root = d_alloc_root(root_inode);
pipe = NULL;
- /*
- * Check whether somebody else completed the super block.
- */
- if (s->s_root)
- goto out_dput;
-
if (!root)
goto fail_iput;
- /* Can this call block? */
+ /* 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,&maxproto) ) {
printk("autofs: called with bogus options\n");
goto fail_dput;
@@ -192,11 +161,6 @@ struct super_block *autofs_read_super(struct super_block *s, void *data,
DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp));
pipe = fget(pipefd);
- /*
- * Check whether somebody else completed the super block.
- */
- if (s->s_root)
- goto out_fput;
if ( !pipe ) {
printk("autofs: could not open pipe file descriptor\n");
@@ -212,43 +176,14 @@ struct super_block *autofs_read_super(struct super_block *s, void *data,
s->s_root = root;
return s;
- /*
- * Success ... somebody else completed the super block for us.
- */
-out_unlock:
- goto out_dec;
-out_fput:
- if (pipe)
- fput(pipe);
-out_dput:
- if (root)
- dput(root);
- else
- iput(root_inode);
-out_dec:
- return s;
-
- /*
- * Failure ... clear the s_dev slot and clean up.
- */
fail_fput:
printk("autofs: pipe file descriptor does not contain proper ops\n");
- /*
- * fput() can block, so we clear the super block first.
- */
fput(pipe);
- /* fall through */
fail_dput:
- /*
- * dput() can block, so we clear the super block first.
- */
dput(root);
goto fail_free;
fail_iput:
printk("autofs: get root dentry failed\n");
- /*
- * iput() can block, so we clear the super block first.
- */
iput(root_inode);
fail_free:
kfree(sbi);
@@ -260,9 +195,6 @@ static int autofs_statfs(struct super_block *sb, struct statfs *buf)
{
buf->f_type = AUTOFS_SUPER_MAGIC;
buf->f_bsize = 1024;
- buf->f_bfree = 0;
- buf->f_bavail = 0;
- buf->f_ffree = 0;
buf->f_namelen = NAME_MAX;
return 0;
}
@@ -314,7 +246,3 @@ static void autofs_read_inode(struct inode *inode)
inode->i_nlink = 1;
}
}
-
-static void autofs_write_inode(struct inode *inode)
-{
-}
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 06e2e86ea..baa8cd6bf 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -186,7 +186,7 @@ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentr
autofs_say(dentry->d_name.name,dentry->d_name.len);
if (dentry->d_name.len > NAME_MAX)
- return ERR_PTR(-ENOENT);/* File name too long to exist */
+ return ERR_PTR(-ENAMETOOLONG);/* File name too long to exist */
sbi = autofs_sbi(dir->i_sb);
@@ -248,9 +248,6 @@ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const c
if ( !autofs_oz_mode(sbi) )
return -EACCES;
- if ( dentry->d_name.len > NAME_MAX )
- return -ENAMETOOLONG;
-
if ( autofs_hash_lookup(dh, &dentry->d_name) )
return -EEXIST;
@@ -375,9 +372,6 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if ( !autofs_oz_mode(sbi) )
return -EACCES;
- if ( dentry->d_name.len > NAME_MAX )
- return -ENAMETOOLONG;
-
ent = autofs_hash_lookup(dh, &dentry->d_name);
if ( ent )
return -EEXIST;