Message ID | 20221101013124.2615274-1-yukuai1@huaweicloud.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [5.10/5.15,v2] scsi: sd: Revert "scsi: sd: Remove a local variable" | expand |
On Tue, Nov 01, 2022 at 09:31:24AM +0800, Yu Kuai wrote: > From: Yu Kuai <yukuai3@huawei.com> > > This reverts commit 84f7a9de0602704bbec774a6c7f7c8c4994bee9c. > > Because it introduces a problem that rq->__data_len is set to the wrong > value. Now queued up, thanks. greg k-h
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index de6640ad1943..1e887c11e83d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1072,6 +1072,7 @@ static blk_status_t sd_setup_write_same_cmnd(struct scsi_cmnd *cmd) struct bio *bio = rq->bio; u64 lba = sectors_to_logical(sdp, blk_rq_pos(rq)); u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); + unsigned int nr_bytes = blk_rq_bytes(rq); blk_status_t ret; if (sdkp->device->no_write_same) @@ -1108,7 +1109,7 @@ static blk_status_t sd_setup_write_same_cmnd(struct scsi_cmnd *cmd) */ rq->__data_len = sdp->sector_size; ret = scsi_alloc_sgtables(cmd); - rq->__data_len = blk_rq_bytes(rq); + rq->__data_len = nr_bytes; return ret; }