linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question on hot plug removal and addition of a USB disk
@ 2011-09-14 20:35 Sampathkumar, Kishore
  2011-09-15  4:26 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Sampathkumar, Kishore @ 2011-09-14 20:35 UTC (permalink / raw)
  To: linux-hotplug

I sent the below query to linux-scsi. Thought it would be better to check on the linux-hotplug mailing list.
Can you please provide the details of the expected behavior, and where in the code should I look for details?

Thanks and Regards,
- Kishore

-----Original Message-----
From: Sampathkumar, Kishore 
Sent: Wednesday, September 14, 2011 7:47 PM
To: 'linux-scsi@vger.kernel.org'
Subject: question on hot plug removal and addition of a USB disk

Scenario: I have a file system on a USB SCSI disk /dev/sdb mounted on /mnt.
I perform Action 1 below, and after some time, perform Action 2 below.

Action 1: removal (unplug) of a USB disk

At the time of removal of the USB disk, since the file system was mounted, is the reference to kobject corresponding (now orphaned) sdb still maintained in the kernel, although /dev/sdb is gone due to disk removal?

Is it that the old scsi_disk (sdb) still persists, but, the underlying scsi_dev is removed? Where should I start to trace the hotplug removal of the USB disk? What are the specific processing steps involved in the kernel to handle this (in terms of main routines handling this)?

Action 2: (hot) plug addition of the same USB SCSI disk

On plugging in the same USB SCSI disk, does the sd layer in scsi subsystem grab the first available 'free' sdX device (say sdp), given that sdb is still being referenced by the mounted file system?

Again, in terms of code, does this correspond to:
-	a new scsi_dev being allocated
-	a corresponding scsi_disk for sdp being allocated by the sd layer in scsi subsystem as part of 'probe' for the added SCSI device

Does the hot plugging work the same way for SAS disks attached behind a FC switch?

Thanks,
-	Kishore

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question on hot plug removal and addition of a USB disk
  2011-09-14 20:35 question on hot plug removal and addition of a USB disk Sampathkumar, Kishore
@ 2011-09-15  4:26 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2011-09-15  4:26 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Sep 15, 2011 at 01:53:43AM +0530, Sampathkumar, Kishore wrote:
> I sent the below query to linux-scsi. Thought it would be better to check on the linux-hotplug mailing list.
> Can you please provide the details of the expected behavior, and where in the code should I look for details?

The code for all of this is in the scsi layer today, have you not looked
there already?

If so, and you have specific questions about specific portions of the
code, please ask them.  But to ask for developers to provide a full
walk-through of existing, working, and readable code, is a bit of a
stretch as I'm sure you can imagine.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-15  4:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 20:35 question on hot plug removal and addition of a USB disk Sampathkumar, Kishore
2011-09-15  4:26 ` Greg KH

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).