vfs: add helpers to get root and pwd

Add three helpers that retrieve a refcounted copy of the root and cwd
from the supplied fs_struct.

 get_fs_root()
 get_fs_pwd()
 get_fs_root_and_pwd()

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Miklos Szeredi
2010-08-10 11:41:36 +02:00
committed by Al Viro
parent 542ce7a9bc
commit f7ad3c6be9
8 changed files with 49 additions and 62 deletions

View File

@@ -2213,10 +2213,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
goto out1;
}
read_lock(&current->fs->lock);
root = current->fs->root;
path_get(&current->fs->root);
read_unlock(&current->fs->lock);
get_fs_root(current->fs, &root);
down_write(&namespace_sem);
mutex_lock(&old.dentry->d_inode->i_mutex);
error = -EINVAL;