public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.1: media change check fails for busy unplugged device
@ 2004-01-18 18:41 Andrey Borzenkov
  2004-01-19 23:36 ` Mike Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Borzenkov @ 2004-01-18 18:41 UTC (permalink / raw)
  To: linux-kernel, linux-scsi

If we unplug busy device (consider mounted USB stick) media change check 
always returns true (no media change happened). It happens because

- device state is set to SDEV_DEL and scsi_prep_fn silently kills any request 
including TEST_UNIT_READY sent by sd_media_changed without propagating any 
information back to caller

- sdev->online still remains TRUE

so nothing ever tells sd_media_changed that device is gone.

this effectively prevents supermount from noticing that it needs remount 
subfs.

What is the right place to catch those deleted device? For now I add this as 
part of supermount patch, but it looks too ugly (and in the wrong place):

--- linux-2.6.1/drivers/scsi/sd.c       29 Dec 2003 17:20:12 -0000
+++ linux-2.6.1/drivers/scsi/sd.c       18 Jan 2004 18:20:54 -0000
@@ -620,6 +622,16 @@ static int sd_media_changed(struct gendi
                 goto not_present;

        /*
+        * FIXME HACK
+        * busy device that is unplugged is SDEV_DEL but online and ioctl
+        * does not return any error. Oh well, it is likely layering
+        * violation but for now it enables media checks for supermount
+        */
+
+       if (sdp->sdev_state == SDEV_DEL)
+               goto not_present;
+
+       /*
         * For removable scsi disk we have to recognise the presence
         * of a disk in the drive. This is kept in the struct scsi_disk
         * struct and tested at open !  Daniel Roche (dan@lectra.fr)
 
TIA

-andrey


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

end of thread, other threads:[~2004-01-31 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-18 18:41 2.6.1: media change check fails for busy unplugged device Andrey Borzenkov
2004-01-19 23:36 ` Mike Anderson
2004-01-26 19:16   ` Andrey Borzenkov
2004-01-29  9:30     ` Mike Anderson
2004-01-31 13:53       ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox