Commit 825b82f6 authored by Xiubo Li's avatar Xiubo Li Committed by Ilya Dryomov

ceph: set correct cap mask for getattr request for read

In case of hitting the file EOF, ceph_read_iter() needs to retrieve the
file size from MDS, and Fr caps aren't neccessary.

[ idryomov: fold into existing retry_op == READ_INLINE branch ]
Reported-by: default avatarFrank Hsiao <frankhsiao@qnap.com>
Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Tested-by: default avatarFrank Hsiao <frankhsiao@qnap.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 1065da21
...@@ -2129,14 +2129,16 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) ...@@ -2129,14 +2129,16 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
int statret; int statret;
struct page *page = NULL; struct page *page = NULL;
loff_t i_size; loff_t i_size;
int mask = CEPH_STAT_CAP_SIZE;
if (retry_op == READ_INLINE) { if (retry_op == READ_INLINE) {
page = __page_cache_alloc(GFP_KERNEL); page = __page_cache_alloc(GFP_KERNEL);
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
mask = CEPH_STAT_CAP_INLINE_DATA;
} }
statret = __ceph_do_getattr(inode, page, statret = __ceph_do_getattr(inode, page, mask, !!page);
CEPH_STAT_CAP_INLINE_DATA, !!page);
if (statret < 0) { if (statret < 0) {
if (page) if (page)
__free_page(page); __free_page(page);
...@@ -2177,7 +2179,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) ...@@ -2177,7 +2179,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
/* hit EOF or hole? */ /* hit EOF or hole? */
if (retry_op == CHECK_EOF && iocb->ki_pos < i_size && if (retry_op == CHECK_EOF && iocb->ki_pos < i_size &&
ret < len) { ret < len) {
doutc(cl, "hit hole, ppos %lld < size %lld, reading more\n", doutc(cl, "may hit hole, ppos %lld < size %lld, reading more\n",
iocb->ki_pos, i_size); iocb->ki_pos, i_size);
read += ret; read += ret;
......
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