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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Christoph Hellwig [mailto:hch@xxxxxx]
> Sent: Friday, January 13, 2017 02:19
> To: Dexuan Cui <decui@xxxxxxxxxxxxx>
> Cc: linux-block@xxxxxxxxxxxxxxx; KY Srinivasan <kys@xxxxxxxxxxxxx>; Chris
> Valean (Cloudbase Solutions SRL) <v-chvale@xxxxxxxxxxxxx>
> 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)
> 
> 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;
>  }

Hi Christoph,
The patch works like a charm!
fstrim can work now.
Chris may help to do more test.

FWIW:
If (req->rq_flags & RQF_SPECIAL_PAYLOAD) is true,
req->special_vec.bv_len is always 24 in my test.

Thanks really a lot for your quick patch! :-)

Can the patch make it into v4.10? 
IMO It's a really important fix.

Thanks,
-- Dexuan

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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux