diff options
author | David Howells <dhowells@redhat.com> | 2015-01-29 07:02:36 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-22 11:38:41 -0500 |
commit | ce40fa78ef8f0e813392903c96de65b947298d16 (patch) | |
tree | 0b4a5db5feafed3cadaab68bd77d0c7e6b049ef1 /fs | |
parent | e36cb0b89ce20b4f8786a57e8a6bc8476f577650 (diff) |
Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
Fix up the following scripted S_ISDIR/S_ISREG/S_ISLNK conversions (or lack
thereof) in cachefiles:
(1) Cachefiles mostly wants to use d_can_lookup() rather than d_is_dir() as
it doesn't want to deal with automounts in its cache.
(2) Coccinelle didn't find S_IS* expressions in ASSERT() statements in
cachefiles.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cachefiles/daemon.c | 4 | ||||
-rw-r--r-- | fs/cachefiles/interface.c | 4 | ||||
-rw-r--r-- | fs/cachefiles/namei.c | 8 | ||||
-rw-r--r-- | fs/cachefiles/rdwr.c | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index d92840209863..f601def05bdf 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c | |||
@@ -574,7 +574,7 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
574 | /* extract the directory dentry from the cwd */ | 574 | /* extract the directory dentry from the cwd */ |
575 | get_fs_pwd(current->fs, &path); | 575 | get_fs_pwd(current->fs, &path); |
576 | 576 | ||
577 | if (!d_is_dir(path.dentry)) | 577 | if (!d_can_lookup(path.dentry)) |
578 | goto notdir; | 578 | goto notdir; |
579 | 579 | ||
580 | cachefiles_begin_secure(cache, &saved_cred); | 580 | cachefiles_begin_secure(cache, &saved_cred); |
@@ -646,7 +646,7 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
646 | /* extract the directory dentry from the cwd */ | 646 | /* extract the directory dentry from the cwd */ |
647 | get_fs_pwd(current->fs, &path); | 647 | get_fs_pwd(current->fs, &path); |
648 | 648 | ||
649 | if (!d_is_dir(path.dentry)) | 649 | if (!d_can_lookup(path.dentry)) |
650 | goto notdir; | 650 | goto notdir; |
651 | 651 | ||
652 | cachefiles_begin_secure(cache, &saved_cred); | 652 | cachefiles_begin_secure(cache, &saved_cred); |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 1c7293c3a93a..232426214fdd 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
@@ -437,7 +437,7 @@ static int cachefiles_attr_changed(struct fscache_object *_object) | |||
437 | if (!object->backer) | 437 | if (!object->backer) |
438 | return -ENOBUFS; | 438 | return -ENOBUFS; |
439 | 439 | ||
440 | ASSERT(S_ISREG(object->backer->d_inode->i_mode)); | 440 | ASSERT(d_is_reg(object->backer)); |
441 | 441 | ||
442 | fscache_set_store_limit(&object->fscache, ni_size); | 442 | fscache_set_store_limit(&object->fscache, ni_size); |
443 | 443 | ||
@@ -501,7 +501,7 @@ static void cachefiles_invalidate_object(struct fscache_operation *op) | |||
501 | op->object->debug_id, (unsigned long long)ni_size); | 501 | op->object->debug_id, (unsigned long long)ni_size); |
502 | 502 | ||
503 | if (object->backer) { | 503 | if (object->backer) { |
504 | ASSERT(S_ISREG(object->backer->d_inode->i_mode)); | 504 | ASSERT(d_is_reg(object->backer)); |
505 | 505 | ||
506 | fscache_set_store_limit(&object->fscache, ni_size); | 506 | fscache_set_store_limit(&object->fscache, ni_size); |
507 | 507 | ||
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index d750e8cc0ab6..1e51714eb33e 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -323,7 +323,7 @@ try_again: | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | if (!d_is_dir(cache->graveyard)) { | 326 | if (!d_can_lookup(cache->graveyard)) { |
327 | unlock_rename(cache->graveyard, dir); | 327 | unlock_rename(cache->graveyard, dir); |
328 | cachefiles_io_error(cache, "Graveyard no longer a directory"); | 328 | cachefiles_io_error(cache, "Graveyard no longer a directory"); |
329 | return -EIO; | 329 | return -EIO; |
@@ -539,7 +539,7 @@ lookup_again: | |||
539 | _debug("mkdir -> %p{%p{ino=%lu}}", | 539 | _debug("mkdir -> %p{%p{ino=%lu}}", |
540 | next, next->d_inode, next->d_inode->i_ino); | 540 | next, next->d_inode, next->d_inode->i_ino); |
541 | 541 | ||
542 | } else if (!d_is_dir(next)) { | 542 | } else if (!d_can_lookup(next)) { |
543 | pr_err("inode %lu is not a directory\n", | 543 | pr_err("inode %lu is not a directory\n", |
544 | next->d_inode->i_ino); | 544 | next->d_inode->i_ino); |
545 | ret = -ENOBUFS; | 545 | ret = -ENOBUFS; |
@@ -568,7 +568,7 @@ lookup_again: | |||
568 | _debug("create -> %p{%p{ino=%lu}}", | 568 | _debug("create -> %p{%p{ino=%lu}}", |
569 | next, next->d_inode, next->d_inode->i_ino); | 569 | next, next->d_inode, next->d_inode->i_ino); |
570 | 570 | ||
571 | } else if (!d_is_dir(next) && | 571 | } else if (!d_can_lookup(next) && |
572 | !d_is_reg(next) | 572 | !d_is_reg(next) |
573 | ) { | 573 | ) { |
574 | pr_err("inode %lu is not a file or directory\n", | 574 | pr_err("inode %lu is not a file or directory\n", |
@@ -763,7 +763,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
763 | /* we need to make sure the subdir is a directory */ | 763 | /* we need to make sure the subdir is a directory */ |
764 | ASSERT(subdir->d_inode); | 764 | ASSERT(subdir->d_inode); |
765 | 765 | ||
766 | if (!d_is_dir(subdir)) { | 766 | if (!d_can_lookup(subdir)) { |
767 | pr_err("%s is not a directory\n", dirname); | 767 | pr_err("%s is not a directory\n", dirname); |
768 | ret = -EIO; | 768 | ret = -EIO; |
769 | goto check_error; | 769 | goto check_error; |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 616db0e77b44..c6cd8d7a4eef 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -900,7 +900,7 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) | |||
900 | return -ENOBUFS; | 900 | return -ENOBUFS; |
901 | } | 901 | } |
902 | 902 | ||
903 | ASSERT(S_ISREG(object->backer->d_inode->i_mode)); | 903 | ASSERT(d_is_reg(object->backer)); |
904 | 904 | ||
905 | cache = container_of(object->fscache.cache, | 905 | cache = container_of(object->fscache.cache, |
906 | struct cachefiles_cache, cache); | 906 | struct cachefiles_cache, cache); |