Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176595
b: refs/heads/master
c: 4f8427d
h: refs/heads/master
i:
  176593: d9317ba
  176591: ec933c0
v: v3
  • Loading branch information
Ian Kent authored and Linus Torvalds committed Dec 16, 2009
1 parent 48a563d commit 018c837
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ea9a886b0e8630e12cff515955e7f0f5be32cb1
refs/heads/master: 4f8427d1903148f9753eb35c5f51a8a865457329
2 changes: 2 additions & 0 deletions trunk/fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ struct autofs_info {
struct completion expire_complete;

struct list_head active;
int active_count;

struct list_head expiring;

struct autofs_sb_info *sbi;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
ino->dentry = NULL;
ino->size = 0;
INIT_LIST_HEAD(&ino->active);
ino->active_count = 0;
INIT_LIST_HEAD(&ino->expiring);
atomic_set(&ino->count, 0);
}
Expand Down
46 changes: 35 additions & 11 deletions trunk/fs/autofs4/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,38 @@ const struct inode_operations autofs4_dir_inode_operations = {
.rmdir = autofs4_dir_rmdir,
};

static void autofs4_add_active(struct dentry *dentry)
{
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct autofs_info *ino = autofs4_dentry_ino(dentry);
if (ino) {
spin_lock(&sbi->lookup_lock);
if (!ino->active_count) {
if (list_empty(&ino->active))
list_add(&ino->active, &sbi->active_list);
}
ino->active_count++;
spin_unlock(&sbi->lookup_lock);
}
return;
}

static void autofs4_del_active(struct dentry *dentry)
{
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct autofs_info *ino = autofs4_dentry_ino(dentry);
if (ino) {
spin_lock(&sbi->lookup_lock);
ino->active_count--;
if (!ino->active_count) {
if (!list_empty(&ino->active))
list_del_init(&ino->active);
}
spin_unlock(&sbi->lookup_lock);
}
return;
}

static int autofs4_dir_open(struct inode *inode, struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
Expand Down Expand Up @@ -513,9 +545,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
dentry->d_fsdata = ino;
ino->dentry = dentry;

spin_lock(&sbi->lookup_lock);
list_add(&ino->active, &sbi->active_list);
spin_unlock(&sbi->lookup_lock);
autofs4_add_active(dentry);

d_instantiate(dentry, NULL);
}
Expand Down Expand Up @@ -624,10 +654,7 @@ static int autofs4_dir_symlink(struct inode *dir,
if (!ino)
return -ENOMEM;

spin_lock(&sbi->lookup_lock);
if (!list_empty(&ino->active))
list_del_init(&ino->active);
spin_unlock(&sbi->lookup_lock);
autofs4_del_active(dentry);

ino->size = strlen(symname);
cp = kmalloc(ino->size + 1, GFP_KERNEL);
Expand Down Expand Up @@ -775,10 +802,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if (!ino)
return -ENOMEM;

spin_lock(&sbi->lookup_lock);
if (!list_empty(&ino->active))
list_del_init(&ino->active);
spin_unlock(&sbi->lookup_lock);
autofs4_del_active(dentry);

inode = autofs4_get_inode(dir->i_sb, ino);
if (!inode) {
Expand Down

0 comments on commit 018c837

Please sign in to comment.