diff mbox

[Regression] fstrim hangs on Hyper-V: caused by "block: improve handling of the magic discard payload"

Message ID CY1PR0301MB208942836E79F806B2CE2CCD8F790@CY1PR0301MB2089.namprd03.prod.outlook.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Valean (Cloudbase Solutions SRL) Jan. 12, 2017, 7:33 p.m. UTC
Hi Christoph,

Adding Nick and Alex to the thread.
We'll give it a try along with Dexuan and update you with the results.

Thank you!
Chris Valean

-----Original Message-----
From: Christoph Hellwig [mailto:hch@lst.de] 
Sent: Thursday, January 12, 2017 8:19 PM
To: Dexuan Cui <decui@microsoft.com>
Cc: linux-block@vger.kernel.org; KY Srinivasan <kys@microsoft.com>; Chris Valean (Cloudbase Solutions SRL) <v-chvale@microsoft.com>
Subject: Re: [Regression] fstrim hangs on Hyper-V: caused by "block: improve handling of the magic discard payload"

Next try:  (I've also dropped most of the Cc list)

--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index c35b6de..2f358f7 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1018,7 +1018,10 @@  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);
+	if (req->rq_flags & RQF_SPECIAL_PAYLOAD)
+		sdb->length = req->special_vec.bv_len;
+	else
+		sdb->length = blk_rq_bytes(req);
 	return BLKPREP_OK;
 }