diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2010-08-10 05:41:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-11 00:28:20 -0400 |
commit | f7ad3c6be90809b53b7f0ae9d4eaa45ce2564a79 (patch) | |
tree | dc9b09188bab35320200f318b5e7b52f24dc43ad /fs/cachefiles | |
parent | 542ce7a9bc6b3838832ae0f4f8de30c667af8ff3 (diff) |
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>
Diffstat (limited to 'fs/cachefiles')
-rw-r--r-- | fs/cachefiles/daemon.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 72d4d004282..727caedcdd9 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c | |||
@@ -552,7 +552,6 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args) | |||
552 | */ | 552 | */ |
553 | static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | 553 | static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) |
554 | { | 554 | { |
555 | struct fs_struct *fs; | ||
556 | struct path path; | 555 | struct path path; |
557 | const struct cred *saved_cred; | 556 | const struct cred *saved_cred; |
558 | int ret; | 557 | int ret; |
@@ -573,11 +572,7 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
573 | } | 572 | } |
574 | 573 | ||
575 | /* extract the directory dentry from the cwd */ | 574 | /* extract the directory dentry from the cwd */ |
576 | fs = current->fs; | 575 | get_fs_pwd(current->fs, &path); |
577 | read_lock(&fs->lock); | ||
578 | path = fs->pwd; | ||
579 | path_get(&path); | ||
580 | read_unlock(&fs->lock); | ||
581 | 576 | ||
582 | if (!S_ISDIR(path.dentry->d_inode->i_mode)) | 577 | if (!S_ISDIR(path.dentry->d_inode->i_mode)) |
583 | goto notdir; | 578 | goto notdir; |
@@ -629,7 +624,6 @@ inval: | |||
629 | */ | 624 | */ |
630 | static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | 625 | static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) |
631 | { | 626 | { |
632 | struct fs_struct *fs; | ||
633 | struct path path; | 627 | struct path path; |
634 | const struct cred *saved_cred; | 628 | const struct cred *saved_cred; |
635 | int ret; | 629 | int ret; |
@@ -650,11 +644,7 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
650 | } | 644 | } |
651 | 645 | ||
652 | /* extract the directory dentry from the cwd */ | 646 | /* extract the directory dentry from the cwd */ |
653 | fs = current->fs; | 647 | get_fs_pwd(current->fs, &path); |
654 | read_lock(&fs->lock); | ||
655 | path = fs->pwd; | ||
656 | path_get(&path); | ||
657 | read_unlock(&fs->lock); | ||
658 | 648 | ||
659 | if (!S_ISDIR(path.dentry->d_inode->i_mode)) | 649 | if (!S_ISDIR(path.dentry->d_inode->i_mode)) |
660 | goto notdir; | 650 | goto notdir; |