Skip to content

Commit 95201a4

Browse files
neilbrownAl Viro
authored andcommitted
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>
1 parent b130ed5 commit 95201a4

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

‎fs/cachefiles/namei.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
655655
aops = d_backing_inode(object->dentry)->i_mapping->a_ops;
656656
if (!aops->bmap)
657657
goto check_error;
658+
if (object->dentry->d_sb->s_blocksize > PAGE_SIZE)
659+
goto check_error;
658660

659661
object->backer = object->dentry;
660662
} else {

‎fs/cachefiles/rdwr.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
414414
ASSERT(inode->i_mapping->a_ops->readpages);
415415

416416
/* calculate the shift required to use bmap */
417-
if (inode->i_sb->s_blocksize > PAGE_SIZE)
418-
goto enobufs;
419-
420417
shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
421418

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

713710
/* calculate the shift required to use bmap */
714-
if (inode->i_sb->s_blocksize > PAGE_SIZE)
715-
goto all_enobufs;
716-
717711
shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
718712

719713
pagevec_init(&pagevec, 0);

0 commit comments

Comments
 (0)