Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7433
b: refs/heads/master
c: 0494f6e
h: refs/heads/master
i:
  7431: 5338d05
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Sep 7, 2005
1 parent f2a9269 commit 0bccd09
Show file tree
Hide file tree
Showing 2 changed files with 13 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: 09dd17d3e5e43ea6d3f3a12829108c4ca13ff810
refs/heads/master: 0494f6ec5d3a015d53b57e37280b93c19446676a
23 changes: 12 additions & 11 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,21 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm
return -ENOENT;
}

static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
static struct fs_struct *get_fs_struct(struct task_struct *task)
{
struct fs_struct *fs;
int result = -ENOENT;
task_lock(proc_task(inode));
fs = proc_task(inode)->fs;
task_lock(task);
fs = task->fs;
if(fs)
atomic_inc(&fs->count);
task_unlock(proc_task(inode));
task_unlock(task);
return fs;
}

static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
{
struct fs_struct *fs = get_fs_struct(proc_task(inode));
int result = -ENOENT;
if (fs) {
read_lock(&fs->lock);
*mnt = mntget(fs->pwdmnt);
Expand All @@ -319,13 +325,8 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs

static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
{
struct fs_struct *fs;
struct fs_struct *fs = get_fs_struct(proc_task(inode));
int result = -ENOENT;
task_lock(proc_task(inode));
fs = proc_task(inode)->fs;
if(fs)
atomic_inc(&fs->count);
task_unlock(proc_task(inode));
if (fs) {
read_lock(&fs->lock);
*mnt = mntget(fs->rootmnt);
Expand Down

0 comments on commit 0bccd09

Please sign in to comment.