Skip to content

Commit b79e4a0

Browse files
lxbszidryomov
authored andcommitted
libceph: remove MAX_EXTENTS check for sparse reads
There is no any limit for the extent array size and it's possible that when reading with a large size contents the total number of extents will exceed 4096. Then the messager will fail by reseting the connection and keeps resending the inflight IOs infinitely. [ idryomov: adjust error message ] Link: https://tracker.ceph.com/issues/62081 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent f48e034 commit b79e4a0

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

net/ceph/osd_client.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5850,8 +5850,6 @@ static inline void convert_extent_map(struct ceph_sparse_read *sr)
58505850
}
58515851
#endif
58525852

5853-
#define MAX_EXTENTS 4096
5854-
58555853
static int osd_sparse_read(struct ceph_connection *con,
58565854
struct ceph_msg_data_cursor *cursor,
58575855
char **pbuf)
@@ -5882,23 +5880,16 @@ static int osd_sparse_read(struct ceph_connection *con,
58825880

58835881
if (count > 0) {
58845882
if (!sr->sr_extent || count > sr->sr_ext_len) {
5885-
/*
5886-
* Apply a hard cap to the number of extents.
5887-
* If we have more, assume something is wrong.
5888-
*/
5889-
if (count > MAX_EXTENTS) {
5890-
dout("%s: OSD returned 0x%x extents in a single reply!\n",
5891-
__func__, count);
5892-
return -EREMOTEIO;
5893-
}
5894-
58955883
/* no extent array provided, or too short */
58965884
kfree(sr->sr_extent);
58975885
sr->sr_extent = kmalloc_array(count,
58985886
sizeof(*sr->sr_extent),
58995887
GFP_NOIO);
5900-
if (!sr->sr_extent)
5888+
if (!sr->sr_extent) {
5889+
pr_err("%s: failed to allocate %u extents\n",
5890+
__func__, count);
59015891
return -ENOMEM;
5892+
}
59025893
sr->sr_ext_len = count;
59035894
}
59045895
ret = count * sizeof(*sr->sr_extent);

0 commit comments

Comments
 (0)