Re: [PATCH] scsi: zero per-cmd driver data for each MQ I/O

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

 



On Tue, 2017-05-16 at 17:31 +0000, Long Li wrote:
> > -----Original Message-----
> > From: Bart Van Assche [mailto:Bart.VanAssche@xxxxxxxxxxx]
> > Sent: Monday, May 15, 2017 5:01 PM
> > To: jejb@xxxxxxxxxxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx; linux-
> > kernel@xxxxxxxxxxxxxxx; Long Li <longli@xxxxxxxxxxxxx>;
> > martin.petersen@xxxxxxxxxx
> > Cc: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>; KY Srinivasan
> > <kys@xxxxxxxxxxxxx>
> > Subject: Re: [PATCH] scsi: zero per-cmd driver data for each MQ I/O
> > 
> > On Mon, 2017-05-15 at 23:32 +0000, Long Li wrote:
> > > Thanks for looking! Yes this is for chasing a bug.
> > > 
> > > With the patch, we also zero the private data used by lower layer
> > > driver, in addition to the private data in scsi_cmnd.
> > 
> > Hello Long,
> > 
> > What bug did you encounter, with which combination of ULP (sd?) and LLD SCSI
> > driver(s) and for which request type (REQ_OP_*)? You will have to mention
> > that information in the patch description anyway if you want your patch to get
> > accepted.
> > 
> > If the bug that you encountered only occurs with a single LLD, would it be
> > possible to implement a fix by modifying the LLD instead of the SCSI core?
> 
> The bug I encounter is that in hv_storvsc (a LLD), sometime we are getting stale data in the private driver data memory allocated by SCSI. As a LLD, we expect the memory allocated by SCSI to be zeroed. If not we may send unexpected commands to the device.
> 
> A little background on private data: In LLD's scsi_host_template, the driver may optionally ask SCSI to allocate its private driver memory for each command, by specifying cmd_size. This memory is allocated at the end of scsi_cmnd by SCSI. Later when SCSI queues a command, the LLD can use scsi_cmd_priv to get its private data.
> 
> hv_storvsc doesn't clear its private data before use. I'm not sure about other LLD drivers. Although it's possible to fix it in LLD not SCSI core, I think that is not the ideal place to do it. Whoever is allocating the SCSI command should also zero it.
> 
> There is a similar patch that fixed a similar issue for non-MQ case:
> commit ee5242360424b9b967454e9183767323d10cf985
> 
> I'm sorry I should have put more details in the patch. 

Hello Long,

Thank you for the feedback. I'm working on a patch series that merges the scsi-sq
and scsi-mq code paths for command initialization and that should fix the bug you
encountered.

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux