Commit 95201a40 authored by NeilBrown's avatar NeilBrown Committed by Al Viro

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: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent b130ed59
...@@ -655,6 +655,8 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent, ...@@ -655,6 +655,8 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
aops = d_backing_inode(object->dentry)->i_mapping->a_ops; aops = d_backing_inode(object->dentry)->i_mapping->a_ops;
if (!aops->bmap) if (!aops->bmap)
goto check_error; goto check_error;
if (object->dentry->d_sb->s_blocksize > PAGE_SIZE)
goto check_error;
object->backer = object->dentry; object->backer = object->dentry;
} else { } else {
......
...@@ -414,9 +414,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, ...@@ -414,9 +414,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
ASSERT(inode->i_mapping->a_ops->readpages); ASSERT(inode->i_mapping->a_ops->readpages);
/* calculate the shift required to use bmap */ /* calculate the shift required to use bmap */
if (inode->i_sb->s_blocksize > PAGE_SIZE)
goto enobufs;
shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
op->op.flags &= FSCACHE_OP_KEEP_FLAGS; op->op.flags &= FSCACHE_OP_KEEP_FLAGS;
...@@ -711,9 +708,6 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, ...@@ -711,9 +708,6 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op,
ASSERT(inode->i_mapping->a_ops->readpages); ASSERT(inode->i_mapping->a_ops->readpages);
/* calculate the shift required to use bmap */ /* calculate the shift required to use bmap */
if (inode->i_sb->s_blocksize > PAGE_SIZE)
goto all_enobufs;
shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
pagevec_init(&pagevec, 0); pagevec_init(&pagevec, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment