Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226743
b: refs/heads/master
c: b3e19d9
h: refs/heads/master
i:
  226741: 172025d
  226739: 3489538
  226735: 8bb7421
v: v3
  • Loading branch information
Nick Piggin committed Jan 7, 2011
1 parent 178c651 commit 827f11a
Show file tree
Hide file tree
Showing 14 changed files with 284 additions and 99 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: c6653a838b1b2738561aff0b8c0f62a9b714bdd9
refs/heads/master: b3e19d924b6eaf2ca7d22cba99a517c5171007b6
2 changes: 1 addition & 1 deletion trunk/arch/ia64/kernel/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ pfm_exit_smpl_buffer(pfm_buffer_fmt_t *fmt)
* any operations on the root directory. However, we need a non-trivial
* d_name - pfm: will go nicely and kill the special-casing in procfs.
*/
static struct vfsmount *pfmfs_mnt;
static struct vfsmount *pfmfs_mnt __read_mostly;

static int __init
init_pfm_fs(void)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ static int __init init_mtdchar(void)
static void __exit cleanup_mtdchar(void)
{
unregister_mtd_user(&mtdchar_notifier);
mntput(mtd_inode_mnt);
mntput_long(mtd_inode_mnt);
unregister_filesystem(&mtd_inodefs_type);
__unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/anon_inodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int __init anon_inode_init(void)
return 0;

err_mntput:
mntput(anon_inode_mnt);
mntput_long(anon_inode_mnt);
err_unregister_filesystem:
unregister_filesystem(&anon_inode_fs_type);
err_exit:
Expand Down
26 changes: 16 additions & 10 deletions trunk/fs/fs_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ void set_fs_root(struct fs_struct *fs, struct path *path)
write_seqcount_begin(&fs->seq);
old_root = fs->root;
fs->root = *path;
path_get(path);
path_get_long(path);
write_seqcount_end(&fs->seq);
spin_unlock(&fs->lock);
if (old_root.dentry)
path_put(&old_root);
path_put_long(&old_root);
}

/*
Expand All @@ -36,12 +36,12 @@ void set_fs_pwd(struct fs_struct *fs, struct path *path)
write_seqcount_begin(&fs->seq);
old_pwd = fs->pwd;
fs->pwd = *path;
path_get(path);
path_get_long(path);
write_seqcount_end(&fs->seq);
spin_unlock(&fs->lock);

if (old_pwd.dentry)
path_put(&old_pwd);
path_put_long(&old_pwd);
}

void chroot_fs_refs(struct path *old_root, struct path *new_root)
Expand All @@ -59,13 +59,13 @@ void chroot_fs_refs(struct path *old_root, struct path *new_root)
write_seqcount_begin(&fs->seq);
if (fs->root.dentry == old_root->dentry
&& fs->root.mnt == old_root->mnt) {
path_get(new_root);
path_get_long(new_root);
fs->root = *new_root;
count++;
}
if (fs->pwd.dentry == old_root->dentry
&& fs->pwd.mnt == old_root->mnt) {
path_get(new_root);
path_get_long(new_root);
fs->pwd = *new_root;
count++;
}
Expand All @@ -76,13 +76,13 @@ void chroot_fs_refs(struct path *old_root, struct path *new_root)
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
while (count--)
path_put(old_root);
path_put_long(old_root);
}

void free_fs_struct(struct fs_struct *fs)
{
path_put(&fs->root);
path_put(&fs->pwd);
path_put_long(&fs->root);
path_put_long(&fs->pwd);
kmem_cache_free(fs_cachep, fs);
}

Expand Down Expand Up @@ -115,7 +115,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
spin_lock_init(&fs->lock);
seqcount_init(&fs->seq);
fs->umask = old->umask;
get_fs_root_and_pwd(old, &fs->root, &fs->pwd);

spin_lock(&old->lock);
fs->root = old->root;
path_get_long(&fs->root);
fs->pwd = old->pwd;
path_get_long(&fs->pwd);
spin_unlock(&old->lock);
}
return fs;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extern int copy_mount_string(const void __user *, char **);

extern void free_vfsmnt(struct vfsmount *);
extern struct vfsmount *alloc_vfsmnt(const char *);
extern unsigned int mnt_get_count(struct vfsmount *mnt);
extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
struct vfsmount *);
Expand Down
24 changes: 24 additions & 0 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ void path_get(struct path *path)
}
EXPORT_SYMBOL(path_get);

/**
* path_get_long - get a long reference to a path
* @path: path to get the reference to
*
* Given a path increment the reference count to the dentry and the vfsmount.
*/
void path_get_long(struct path *path)
{
mntget_long(path->mnt);
dget(path->dentry);
}

/**
* path_put - put a reference to a path
* @path: path to put the reference to
Expand All @@ -380,6 +392,18 @@ void path_put(struct path *path)
}
EXPORT_SYMBOL(path_put);

/**
* path_put_long - put a long reference to a path
* @path: path to put the reference to
*
* Given a path decrement the reference count to the dentry and the vfsmount.
*/
void path_put_long(struct path *path)
{
dput(path->dentry);
mntput_long(path->mnt);
}

/**
* nameidata_drop_rcu - drop this nameidata out of rcu-walk
* @nd: nameidata pathwalk data to drop
Expand Down
Loading

0 comments on commit 827f11a

Please sign in to comment.