Skip to content

Commit ed6565e

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: handle partial completions for special payload requests
SCSI devices can return short writes on Write Same just like for normal writes, so we need to handle this case for our special payload requests as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com> Tested-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent f36ea50 commit ed6565e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

block/blk-core.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,8 +2644,6 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
26442644
return false;
26452645
}
26462646

2647-
WARN_ON_ONCE(req->rq_flags & RQF_SPECIAL_PAYLOAD);
2648-
26492647
req->__data_len -= total_bytes;
26502648

26512649
/* update sector only for requests with clear definition of sector */
@@ -2658,17 +2656,19 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
26582656
req->cmd_flags |= req->bio->bi_opf & REQ_FAILFAST_MASK;
26592657
}
26602658

2661-
/*
2662-
* If total number of sectors is less than the first segment
2663-
* size, something has gone terribly wrong.
2664-
*/
2665-
if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
2666-
blk_dump_rq_flags(req, "request botched");
2667-
req->__data_len = blk_rq_cur_bytes(req);
2668-
}
2659+
if (!(req->rq_flags & RQF_SPECIAL_PAYLOAD)) {
2660+
/*
2661+
* If total number of sectors is less than the first segment
2662+
* size, something has gone terribly wrong.
2663+
*/
2664+
if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
2665+
blk_dump_rq_flags(req, "request botched");
2666+
req->__data_len = blk_rq_cur_bytes(req);
2667+
}
26692668

2670-
/* recalculate the number of segments */
2671-
blk_recalc_rq_segments(req);
2669+
/* recalculate the number of segments */
2670+
blk_recalc_rq_segments(req);
2671+
}
26722672

26732673
return true;
26742674
}

0 commit comments

Comments
 (0)