public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
To: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: Elric Fu <elricfu1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Martin K. Petersen"
	<martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	James Bottomley
	<JBottomley-MU7nAjRaF3makBO8gow8eQ@public.gmane.org>,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Sarah Sharp
	<sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
	Alex He <alex.he-5C7GfCeVMHo@public.gmane.org>,
	Andiry Xu <andiry.xu-5C7GfCeVMHo@public.gmane.org>,
	Greg KH
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Linux USB Mailing List
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Alan Stern
	<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Subject: Re: An oops will occur while SCSI core is being used in 3.4-rc1
Date: Tue, 10 Apr 2012 11:45:12 -0500	[thread overview]
Message-ID: <4F846398.5030609@cs.wisc.edu> (raw)
In-Reply-To: <4F8461E3.3050808-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

On 04/10/2012 11:37 AM, Mike Christie wrote:
> On 04/10/2012 03:16 AM, Bart Van Assche wrote:
>> On 04/10/12 01:22, Elric Fu wrote:
>>
>>> After debugging the code, I found the issue happened while the driver ran to
>>> line 782 in scsi_send_eh_cmnd().
>>>
>>>  778 static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
>>>  779                              int cmnd_size, int timeout, unsigned
>>> sense_bytes)
>>>  780 {
>>>  781         struct scsi_device *sdev = scmd->device;
>>>  782         struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
>>>  783         struct Scsi_Host *shost = sdev->host;
>>>  784         DECLARE_COMPLETION_ONSTACK(done);
>>>  785         unsigned long timeleft;
>>>  786         struct scsi_eh_save ses;
>>>  787         int rtn;
>>>
>>> I know the code is submitted by you. I don't familiar with the scsi core.
>>> It seems like the conversion process from scsi command to scsi driver
>>> encounter a NULL pointer. Any idea?
>>
>>
>> I have observed crashes at the same point while testing device removal
>> with the ib_srp driver. As far as I can see that code was added through
>> commit 18a4d0a22ed6c54b67af7718c305cd010f09ddf8 (February 9, 2012). The
>> approach of that patch looks questionable to me: what guarantees that
>> the struct scsi_driver will be available at the time the SCSI error
>> handler needs it ?
> 
> If a scsi scan IO timesout then the driver will not be set yet. It is ok
> to use scsi_cmd_to_driver in scsi_finish_cmd because of the req block pc
> check (scsi scan IO set that flag and so do not hit that path).

I meant to say that all REQ_TYPE_BLOCK_PC will have a NULL driver, so at
the very least there should be a check in scsi_send_eh_cmnd for NULL
sdrv or for the IO being a REQ_TYPE_BLOCK_PC like is done in
scsi_finish_command.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-04-10 16:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10  1:22 An oops will occur while SCSI core is being used in 3.4-rc1 Elric Fu
2012-04-10  8:16 ` Bart Van Assche
2012-04-10 16:37   ` Mike Christie
     [not found]     ` <4F8461E3.3050808-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2012-04-10 16:45       ` Mike Christie [this message]
2012-04-10 16:51         ` Mike Christie
2012-04-11 16:10           ` Martin K. Petersen
2012-04-11 16:40             ` Bart Van Assche
     [not found]               ` <4F85B3E8.7040704-HInyCGIudOg@public.gmane.org>
2012-04-11 20:01                 ` Bart Van Assche
     [not found]                   ` <4F85E312.6070205-HInyCGIudOg@public.gmane.org>
2012-04-12  0:48                     ` Martin K. Petersen
2012-04-18  7:53             ` James Bottomley
2012-04-13  0:30   ` Rustad, Mark D

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=4F846398.5030609@cs.wisc.edu \
    --to=michaelc-hcno3ddehluvc3sceru5cw@public.gmane.org \
    --cc=JBottomley-MU7nAjRaF3makBO8gow8eQ@public.gmane.org \
    --cc=alex.he-5C7GfCeVMHo@public.gmane.org \
    --cc=andiry.xu-5C7GfCeVMHo@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=bvanassche-HInyCGIudOg@public.gmane.org \
    --cc=elricfu1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    /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