summaryrefslogtreecommitdiffstats
path: root/fs/ceph/addr.c
diff options
context:
space:
mode:
authorYan, Zheng2015-01-10 04:43:12 +0100
committerIlya Dryomov2015-02-19 11:31:39 +0100
commitfcc02d2a03fc629b82d1ca1006fbd06570385264 (patch)
treed41660d615642608748ebcd51a6140c96102ede0 /fs/ceph/addr.c
parentceph: avoid block operation when !TASK_RUNNING (ceph_mdsc_close_sessions) (diff)
downloadkernel-qcow2-linux-fcc02d2a03fc629b82d1ca1006fbd06570385264.tar.gz
kernel-qcow2-linux-fcc02d2a03fc629b82d1ca1006fbd06570385264.tar.xz
kernel-qcow2-linux-fcc02d2a03fc629b82d1ca1006fbd06570385264.zip
ceph: fix reading inline data when i_size > PAGE_SIZE
when inode has inline data but its size > PAGE_SIZE (it was truncated to larger size), previous direct read code return -EIO. This patch adds code to return zeros for data whose offset > PAGE_SIZE. Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/addr.c')
-rw-r--r--fs/ceph/addr.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index c81c0e004588..7d05e37874d4 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -196,17 +196,22 @@ static int readpage_nounlock(struct file *filp, struct page *page)
u64 len = PAGE_CACHE_SIZE;
if (off >= i_size_read(inode)) {
- zero_user_segment(page, err, PAGE_CACHE_SIZE);
+ zero_user_segment(page, 0, PAGE_CACHE_SIZE);
SetPageUptodate(page);
return 0;
}
- /*
- * Uptodate inline data should have been added into page cache
- * while getting Fcr caps.
- */
- if (ci->i_inline_version != CEPH_INLINE_NONE)
- return -EINVAL;
+ if (ci->i_inline_version != CEPH_INLINE_NONE) {
+ /*
+ * Uptodate inline data should have been added
+ * into page cache while getting Fcr caps.
+ */
+ if (off == 0)
+ return -EINVAL;
+ zero_user_segment(page, 0, PAGE_CACHE_SIZE);
+ SetPageUptodate(page);
+ return 0;
+ }
err = ceph_readpage_from_fscache(inode, page);
if (err == 0)