public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"longli@microsoft.com" <longli@microsoft.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "sthemmin@microsoft.com" <sthemmin@microsoft.com>,
	"kys@microsoft.com" <kys@microsoft.com>
Subject: Re: [PATCH] scsi: zero per-cmd driver data for each MQ I/O
Date: Wed, 17 May 2017 23:05:18 +0000	[thread overview]
Message-ID: <1495062317.2679.1.camel@sandisk.com> (raw)
In-Reply-To: <MWHPR03MB3136DEB8FD09EDDF7CDB8BF5CEE60@MWHPR03MB3136.namprd03.prod.outlook.com>

On Tue, 2017-05-16 at 17:31 +0000, Long Li wrote:
> > -----Original Message-----
> > From: Bart Van Assche [mailto:Bart.VanAssche@sandisk.com]
> > Sent: Monday, May 15, 2017 5:01 PM
> > To: jejb@linux.vnet.ibm.com; linux-scsi@vger.kernel.org; linux-
> > kernel@vger.kernel.org; Long Li <longli@microsoft.com>;
> > martin.petersen@oracle.com
> > Cc: Stephen Hemminger <sthemmin@microsoft.com>; KY Srinivasan
> > <kys@microsoft.com>
> > 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.

  reply	other threads:[~2017-05-17 23:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 23:32 [PATCH] scsi: zero per-cmd driver data for each MQ I/O Long Li
2017-05-16  0:00 ` Bart Van Assche
2017-05-16 17:31   ` Long Li
2017-05-17 23:05     ` Bart Van Assche [this message]
2017-05-18  6:54       ` Christoph Hellwig
2017-05-18 13:29         ` KY Srinivasan
2017-05-18 15:52         ` Bart Van Assche
2017-05-18 16:47           ` Long Li
  -- strict thread matches above, loose matches on Subject: below --
2017-05-10 21:07 Long Li
2017-05-15 22:48 ` Long Li
2017-05-15 23:20   ` KY Srinivasan
2017-05-18  6:55 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495062317.2679.1.camel@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=martin.petersen@oracle.com \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox