public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <jbottomley@parallels.com>
To: Steve Magnani <smagnani@iscandar.digidescorp.com>
Cc: Tejun Heo <tj@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Steven J. Magnani" <steve@digidescorp.com>
Subject: Re: [PATCH] sd: fix infinite kernel/udev loop on non-removable Medium Not Present
Date: Fri, 12 Apr 2013 20:53:27 +0000	[thread overview]
Message-ID: <1365800007.1934.67.camel@dabdike> (raw)
In-Reply-To: <1365799488-16088-1-git-send-email-smagnani@iscandar.digidescorp.com>

Could you resend this, cc'ing the linux-scsi@vger.kernel.org mailing
list?

Thanks,

James


On Fri, 2013-04-12 at 15:44 -0500, Steve Magnani wrote:
> 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;
>  	}
> 


      reply	other threads:[~2013-04-12 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 20:44 [PATCH] sd: fix infinite kernel/udev loop on non-removable Medium Not Present Steve Magnani
2013-04-12 20:53 ` James Bottomley [this message]

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=1365800007.1934.67.camel@dabdike \
    --to=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smagnani@iscandar.digidescorp.com \
    --cc=steve@digidescorp.com \
    --cc=tj@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