Skip to content

Commit 825b82f

Browse files
lxbszidryomov
authored andcommitted
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: Frank Hsiao <frankhsiao@qnap.com> Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Tested-by: Frank Hsiao <frankhsiao@qnap.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 1065da2 commit 825b82f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/ceph/file.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,14 +2129,16 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
21292129
int statret;
21302130
struct page *page = NULL;
21312131
loff_t i_size;
2132+
int mask = CEPH_STAT_CAP_SIZE;
21322133
if (retry_op == READ_INLINE) {
21332134
page = __page_cache_alloc(GFP_KERNEL);
21342135
if (!page)
21352136
return -ENOMEM;
2137+
2138+
mask = CEPH_STAT_CAP_INLINE_DATA;
21362139
}
21372140

2138-
statret = __ceph_do_getattr(inode, page,
2139-
CEPH_STAT_CAP_INLINE_DATA, !!page);
2141+
statret = __ceph_do_getattr(inode, page, mask, !!page);
21402142
if (statret < 0) {
21412143
if (page)
21422144
__free_page(page);
@@ -2177,7 +2179,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
21772179
/* hit EOF or hole? */
21782180
if (retry_op == CHECK_EOF && iocb->ki_pos < i_size &&
21792181
ret < len) {
2180-
doutc(cl, "hit hole, ppos %lld < size %lld, reading more\n",
2182+
doutc(cl, "may hit hole, ppos %lld < size %lld, reading more\n",
21812183
iocb->ki_pos, i_size);
21822184

21832185
read += ret;

0 commit comments

Comments
 (0)