Skip to content

Commit

Permalink
cachefiles: perform test on s_blocksize when opening cache file.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
neilbrown authored and Al Viro committed Nov 11, 2015
1 parent b130ed5 commit 95201a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions fs/cachefiles/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
aops = d_backing_inode(object->dentry)->i_mapping->a_ops;
if (!aops->bmap)
goto check_error;
if (object->dentry->d_sb->s_blocksize > PAGE_SIZE)
goto check_error;

object->backer = object->dentry;
} else {
Expand Down
6 changes: 0 additions & 6 deletions fs/cachefiles/rdwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
ASSERT(inode->i_mapping->a_ops->readpages);

/* 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;

op->op.flags &= FSCACHE_OP_KEEP_FLAGS;
Expand Down Expand Up @@ -711,9 +708,6 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op,
ASSERT(inode->i_mapping->a_ops->readpages);

/* 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;

pagevec_init(&pagevec, 0);
Expand Down

0 comments on commit 95201a4

Please sign in to comment.