Re: Boot failure with block/for-next

From: Tejun Heo
Date: Thu Dec 23 2010 - 05:10:12 EST


Hello, James.

On Wed, Dec 22, 2010 at 10:31:13PM -0600, James Bottomley wrote:
> Actually, surprisingly, bisection confirms it's this patch:
>
> Author: Tejun Heo <tj@xxxxxxxxxx>
> Date: Wed Dec 8 20:57:42 2010 +0100
>
> sd: implement sd_check_events()
>
> I can't quite see how yet.

Does the following patch fix the problem? Thanks.

Subject: sd: don't clear media presence unless it's removable

set_media_not_present() can be called for a non-removable device if it
raises UA for whatever reason; however, block layer calls into
sd_check_events() only if the device is removable. As the function is
responsible for setting media presence, sd continues to think that
media is missing on the non-removable device making it inaccessible.

This patch makes set_media_not_present() clear media presence iff the
device is removable.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
---
drivers/scsi/sd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: work/drivers/scsi/sd.c
===================================================================
--- work.orig/drivers/scsi/sd.c
+++ work/drivers/scsi/sd.c
@@ -993,8 +993,11 @@ static void set_media_not_present(struct
{
if (sdkp->media_present)
sdkp->device->changed = 1;
- sdkp->media_present = 0;
- sdkp->capacity = 0;
+
+ if (sdkp->device->removable) {
+ sdkp->media_present = 0;
+ sdkp->capacity = 0;
+ }
}

static int media_not_present(struct scsi_disk *sdkp,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/