scsi: use blk_rq_payload_bytes
authorChristoph Hellwig <[email protected]>
Fri, 13 Jan 2017 11:29:11 +0000 (12:29 +0100)
committerJens Axboe <[email protected]>
Fri, 13 Jan 2017 22:17:04 +0000 (15:17 -0700)
Without that we'll pass a wrong payload size in cmd->sdb, which
can lead to hangs with drivers that need the total transfer size.

Signed-off-by: Christoph Hellwig <[email protected]>
Reported-by: Chris Valean <[email protected]>
Reported-by: Dexuan Cui <[email protected]>
Fixes: f9d03f96 ("block: improve handling of the magic discard payload")
Reviewed-by: Hannes Reinecke <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
drivers/scsi/scsi_lib.c

index c35b6de4ca643297d1908341421c865c2cb93e84..ad4ff8fcd4ddccd744954869ad4663e5e4dccfb3 100644 (file)
@@ -1018,7 +1018,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
        count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
        BUG_ON(count > sdb->table.nents);
        sdb->table.nents = count;
-       sdb->length = blk_rq_bytes(req);
+       sdb->length = blk_rq_payload_bytes(req);
        return BLKPREP_OK;
 }