diff options
Diffstat (limited to 'fs/cachefiles/daemon.c')
-rw-r--r-- | fs/cachefiles/daemon.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 24eb0d37241a..72d4d0042826 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c | |||
@@ -553,7 +553,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args) | |||
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; | 555 | struct fs_struct *fs; |
556 | struct dentry *dir; | 556 | struct path path; |
557 | const struct cred *saved_cred; | 557 | const struct cred *saved_cred; |
558 | int ret; | 558 | int ret; |
559 | 559 | ||
@@ -575,22 +575,23 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
575 | /* extract the directory dentry from the cwd */ | 575 | /* extract the directory dentry from the cwd */ |
576 | fs = current->fs; | 576 | fs = current->fs; |
577 | read_lock(&fs->lock); | 577 | read_lock(&fs->lock); |
578 | dir = dget(fs->pwd.dentry); | 578 | path = fs->pwd; |
579 | path_get(&path); | ||
579 | read_unlock(&fs->lock); | 580 | read_unlock(&fs->lock); |
580 | 581 | ||
581 | if (!S_ISDIR(dir->d_inode->i_mode)) | 582 | if (!S_ISDIR(path.dentry->d_inode->i_mode)) |
582 | goto notdir; | 583 | goto notdir; |
583 | 584 | ||
584 | cachefiles_begin_secure(cache, &saved_cred); | 585 | cachefiles_begin_secure(cache, &saved_cred); |
585 | ret = cachefiles_cull(cache, dir, args); | 586 | ret = cachefiles_cull(cache, path.dentry, args); |
586 | cachefiles_end_secure(cache, saved_cred); | 587 | cachefiles_end_secure(cache, saved_cred); |
587 | 588 | ||
588 | dput(dir); | 589 | path_put(&path); |
589 | _leave(" = %d", ret); | 590 | _leave(" = %d", ret); |
590 | return ret; | 591 | return ret; |
591 | 592 | ||
592 | notdir: | 593 | notdir: |
593 | dput(dir); | 594 | path_put(&path); |
594 | kerror("cull command requires dirfd to be a directory"); | 595 | kerror("cull command requires dirfd to be a directory"); |
595 | return -ENOTDIR; | 596 | return -ENOTDIR; |
596 | 597 | ||
@@ -629,7 +630,7 @@ inval: | |||
629 | static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | 630 | static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) |
630 | { | 631 | { |
631 | struct fs_struct *fs; | 632 | struct fs_struct *fs; |
632 | struct dentry *dir; | 633 | struct path path; |
633 | const struct cred *saved_cred; | 634 | const struct cred *saved_cred; |
634 | int ret; | 635 | int ret; |
635 | 636 | ||
@@ -651,22 +652,23 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
651 | /* extract the directory dentry from the cwd */ | 652 | /* extract the directory dentry from the cwd */ |
652 | fs = current->fs; | 653 | fs = current->fs; |
653 | read_lock(&fs->lock); | 654 | read_lock(&fs->lock); |
654 | dir = dget(fs->pwd.dentry); | 655 | path = fs->pwd; |
656 | path_get(&path); | ||
655 | read_unlock(&fs->lock); | 657 | read_unlock(&fs->lock); |
656 | 658 | ||
657 | if (!S_ISDIR(dir->d_inode->i_mode)) | 659 | if (!S_ISDIR(path.dentry->d_inode->i_mode)) |
658 | goto notdir; | 660 | goto notdir; |
659 | 661 | ||
660 | cachefiles_begin_secure(cache, &saved_cred); | 662 | cachefiles_begin_secure(cache, &saved_cred); |
661 | ret = cachefiles_check_in_use(cache, dir, args); | 663 | ret = cachefiles_check_in_use(cache, path.dentry, args); |
662 | cachefiles_end_secure(cache, saved_cred); | 664 | cachefiles_end_secure(cache, saved_cred); |
663 | 665 | ||
664 | dput(dir); | 666 | path_put(&path); |
665 | //_leave(" = %d", ret); | 667 | //_leave(" = %d", ret); |
666 | return ret; | 668 | return ret; |
667 | 669 | ||
668 | notdir: | 670 | notdir: |
669 | dput(dir); | 671 | path_put(&path); |
670 | kerror("inuse command requires dirfd to be a directory"); | 672 | kerror("inuse command requires dirfd to be a directory"); |
671 | return -ENOTDIR; | 673 | return -ENOTDIR; |
672 | 674 | ||