diff options
author | NeilBrown <neilb@suse.de> | 2015-11-04 10:20:34 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-11-11 02:08:17 -0500 |
commit | 95201a40604791bc4a2e8d066429be89fb82b46d (patch) | |
tree | ef88b895c4e6b8bef8efd28d9ea852cb63814dc7 | |
parent | b130ed5998e62879a66bad08931a2b5e832da95c (diff) |
cachefiles: perform test on s_blocksize when opening cache file.
cachefiles requires that s_blocksize in the cache is not greater than
PAGE_SIZE, and performs the check every time a block is accessed.
Move the test to the place where the file is "opened", where other
file-validity tests are performed.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/cachefiles/namei.c | 2 | ||||
-rw-r--r-- | fs/cachefiles/rdwr.c | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index fc1056f5c96a..c4b893453e0e 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -655,6 +655,8 @@ lookup_again: | |||
655 | aops = d_backing_inode(object->dentry)->i_mapping->a_ops; | 655 | aops = d_backing_inode(object->dentry)->i_mapping->a_ops; |
656 | if (!aops->bmap) | 656 | if (!aops->bmap) |
657 | goto check_error; | 657 | goto check_error; |
658 | if (object->dentry->d_sb->s_blocksize > PAGE_SIZE) | ||
659 | goto check_error; | ||
658 | 660 | ||
659 | object->backer = object->dentry; | 661 | object->backer = object->dentry; |
660 | } else { | 662 | } else { |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 3cbb0e834694..e76c2452ac40 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -414,9 +414,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
414 | ASSERT(inode->i_mapping->a_ops->readpages); | 414 | ASSERT(inode->i_mapping->a_ops->readpages); |
415 | 415 | ||
416 | /* calculate the shift required to use bmap */ | 416 | /* calculate the shift required to use bmap */ |
417 | if (inode->i_sb->s_blocksize > PAGE_SIZE) | ||
418 | goto enobufs; | ||
419 | |||
420 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; | 417 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; |
421 | 418 | ||
422 | op->op.flags &= FSCACHE_OP_KEEP_FLAGS; | 419 | op->op.flags &= FSCACHE_OP_KEEP_FLAGS; |
@@ -711,9 +708,6 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
711 | ASSERT(inode->i_mapping->a_ops->readpages); | 708 | ASSERT(inode->i_mapping->a_ops->readpages); |
712 | 709 | ||
713 | /* calculate the shift required to use bmap */ | 710 | /* calculate the shift required to use bmap */ |
714 | if (inode->i_sb->s_blocksize > PAGE_SIZE) | ||
715 | goto all_enobufs; | ||
716 | |||
717 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; | 711 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; |
718 | 712 | ||
719 | pagevec_init(&pagevec, 0); | 713 | pagevec_init(&pagevec, 0); |