public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND^2] sd: fix infinite kernel/udev loop on non-removable Medium Not Present
@ 2013-04-26 16:39 Steven J. Magnani
  2013-04-26 17:10 ` Greg KH
  2013-04-26 17:30 ` James Bottomley
  0 siblings, 2 replies; 4+ messages in thread
From: Steven J. Magnani @ 2013-04-26 16:39 UTC (permalink / raw)
  To: James E.J. Bottomley
  Cc: Tejun Heo, linux-kernel, linux-scsi, stable, Steven J. Magnani

Commit eface65c336eff420d70beb0fb6787a732e05ffb (2.6.38) altered
set_media_not_present() in a way that prevents the sd driver from
remembering that a non-removable device has reported "Medium Not Present".
This condition can occur on hotplug of a (i.e.) USB Mass Storage device
whose medium is offline due to an unrecoverable controller error,
but which is otherwise capable of SCSI communication (to download new 
microcode, etc.).

Under these conditions, the changed code results in an infinite loop
between the kernel and udevd. When udevd attempts to open the device
in response to a change notification, a SCSI "Medium Not Present" error
occurs which causes the kernel to signal another change. The cycle
repeats until the device is unplugged, resulting in udevd consuming ever-
increasing amounts of CPU and virtual memory.

Resolve this by remembering "media not present" whether the device has
declared itself "removable" or not.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
---
--- a/drivers/scsi/sd.c	2013-04-12 14:16:12.252531097 -0500
+++ b/drivers/scsi/sd.c	2013-04-12 14:21:55.197216521 -0500
@@ -1298,10 +1298,8 @@ out:
 
 static void set_media_not_present(struct scsi_disk *sdkp)
 {
-	if (sdkp->media_present)
+	if (sdkp->media_present) {
 		sdkp->device->changed = 1;
-
-	if (sdkp->device->removable) {
 		sdkp->media_present = 0;
 		sdkp->capacity = 0;
 	}


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

end of thread, other threads:[~2013-04-29 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 16:39 [PATCH RESEND^2] sd: fix infinite kernel/udev loop on non-removable Medium Not Present Steven J. Magnani
2013-04-26 17:10 ` Greg KH
2013-04-26 17:30 ` James Bottomley
2013-04-29 20:45   ` Steven J. Magnani

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