cachefiles: perform test on s_blocksize when opening cache file.
authorNeilBrown <neilb@suse.de>
Wed, 4 Nov 2015 15:20:34 +0000 (15:20 +0000)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Nov 2015 07:08:17 +0000 (02:08 -0500)
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>
fs/cachefiles/namei.c
fs/cachefiles/rdwr.c

index fc1056f5c96a3c750c3c5c9009048b234a7fd745..c4b893453e0eefda8475b3537e934f2bfc46d268 100644 (file)
@@ -655,6 +655,8 @@ lookup_again:
                        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 {
index 3cbb0e834694131d461c927fddb2340b72755415..e76c2452ac409f792f5080a163c51977e95d3bb8 100644 (file)
@@ -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;
@@ -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);