USB forceful removal

Greg KH greg at kroah.com
Tue Jul 8 14:55:22 EDT 2014


On Wed, Jul 09, 2014 at 12:13:28AM +0530, AYAN KUMAR HALDER wrote:
> Hi All,
> 
> When a usb mass-storage is attached for the first time, it gets a
> device (/dev/sda).
> 
> When it is mounted and the device is manually removed and then when it
> is attached again, it gets a different name ie /dev/sdb.

Really?  Not on my system, what kernel are you using?

> This is because earlier the mass-storage device was removed (manually)
> when it was mounted, so scsi_disk_release() did not get called as the
> device (sda) had a reference count > 1.

It should have...

> So, if my understanding is correct, I would like to know if the above
> mentioned behaviour is a bug or a limitation of the kernel?

What is wrong with the device node showing back up as /dev/sdb?  You
shouldn't be relying on a device node name for doing anything "real"
anyway, that's what /dev/disk/ is there for, the persistent links are
designed for you to mount with.

thanks,

greg k-h



More information about the Kernelnewbies mailing list