linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Problem hotplugging USB flashdrive (race?)
Date: Wed, 07 Jan 2004 18:29:41 +0000	[thread overview]
Message-ID: <20040107102941.A27549@beaverton.ibm.com> (raw)
In-Reply-To: <marc-linux-hotplug-107132041630956@msgid-missing>

On Tue, Jan 06, 2004 at 12:47:12AM +0100, Olaf Hering wrote:
>  On Fri, Jan 02, Bertrik Sikken wrote:
> 
> > I don't see why doing something from usb.agent or scsi.agent is
> > obviously wrong. As far as I understand, plugging in the device
> > causes a USB hotplug event which triggers loading of the usb-storage
> > module. This in turn fires off a SCSI hotplug event which should
> > load the sd_mod module and create a block device. From then on,
> > its up to the user (me) to mount the device.

I can't find the email you're replying to (in my inbox or the archives,
anything dated Jan 02 from Bertrik).

> I see the same. The reason is probably in scsi_probe_and_add_lun(). It
> calls scsi_alloc_sdev() which seems to generate the event, and later it
> calls scsi_probe_lun() which seems to set the type.

scsi_add_lun() calls scsi_sysfs_add_sdev() for the scsi_device after it
has set the type, and there we have the race between the hotplug event
generated via the call to device_add() and the addition of the attributes
for multiple calls to attr_add().

The type is initialized to -1 in scsi_alloc_sdev, so at worst you might
see a -1 there, but that would be a bug.

Are you hitting the problem even after adding the sleep 1 hack?

-- Patrick Mansfield


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-01-07 18:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-13 12:58 Problem hotplugging USB flashdrive (race?) Bertrik Sikken
2003-12-15 22:01 ` Greg KH
2003-12-17 17:28 ` Bertrik Sikken
2003-12-17 17:47 ` Greg KH
2003-12-18  8:53 ` Oliver Neukum
2003-12-18 18:04 ` Matthew Dharm
2003-12-18 21:13 ` Greg KH
2004-01-02 13:26 ` Olaf Hering
2004-01-05 23:47 ` Olaf Hering
2004-01-07 18:29 ` Patrick Mansfield [this message]
2004-01-07 18:32 ` Olaf Hering
2004-01-07 20:01 ` Olaf Hering
2004-01-07 20:37 ` Olaf Hering
2004-02-01 22:48 ` Olaf Hering

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=20040107102941.A27549@beaverton.ibm.com \
    --to=patmans@us.ibm.com \
    --cc=linux-hotplug@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).