aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/base.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 520978e49e92..73b1e94171b7 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -297,15 +297,21 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm
297 return -ENOENT; 297 return -ENOENT;
298} 298}
299 299
300static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 300static struct fs_struct *get_fs_struct(struct task_struct *task)
301{ 301{
302 struct fs_struct *fs; 302 struct fs_struct *fs;
303 int result = -ENOENT; 303 task_lock(task);
304 task_lock(proc_task(inode)); 304 fs = task->fs;
305 fs = proc_task(inode)->fs;
306 if(fs) 305 if(fs)
307 atomic_inc(&fs->count); 306 atomic_inc(&fs->count);
308 task_unlock(proc_task(inode)); 307 task_unlock(task);
308 return fs;
309}
310
311static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
312{
313 struct fs_struct *fs = get_fs_struct(proc_task(inode));
314 int result = -ENOENT;
309 if (fs) { 315 if (fs) {
310 read_lock(&fs->lock); 316 read_lock(&fs->lock);
311 *mnt = mntget(fs->pwdmnt); 317 *mnt = mntget(fs->pwdmnt);
@@ -319,13 +325,8 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs
319 325
320static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 326static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
321{ 327{
322 struct fs_struct *fs; 328 struct fs_struct *fs = get_fs_struct(proc_task(inode));
323 int result = -ENOENT; 329 int result = -ENOENT;
324 task_lock(proc_task(inode));
325 fs = proc_task(inode)->fs;
326 if(fs)
327 atomic_inc(&fs->count);
328 task_unlock(proc_task(inode));
329 if (fs) { 330 if (fs) {
330 read_lock(&fs->lock); 331 read_lock(&fs->lock);
331 *mnt = mntget(fs->rootmnt); 332 *mnt = mntget(fs->rootmnt);