@@ -5920,6 +5920,12 @@ static int osd_sparse_read(struct ceph_connection *con,
fallthrough;
case CEPH_SPARSE_READ_DATA:
if (sr->sr_index >= count) {
+ if (sr->sr_datalen && count) {
+ pr_warn_ratelimited("%s: datalen and extents mismath, %d left\n",
+ __func__, sr->sr_datalen);
+ return -EREMOTEIO;
+ }
+
sr->sr_state = CEPH_SPARSE_READ_HDR;
goto next_op;
}
@@ -5927,6 +5933,8 @@ static int osd_sparse_read(struct ceph_connection *con,
eoff = sr->sr_extent[sr->sr_index].off;
elen = sr->sr_extent[sr->sr_index].len;
+ sr->sr_datalen -= elen;
+
dout("[%d] ext %d off 0x%llx len 0x%llx\n",
o->o_osd, sr->sr_index, eoff, elen);