+ scsi-core-and-sd-early-detection-of-medium-not-present.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     SCSI core and sd: early detection of medium not present

has been added to the -mm tree.  Its filename is

     scsi-core-and-sd-early-detection-of-medium-not-present.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: SCSI core and sd: early detection of medium not present
From: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>


This patch (as695) changes the scsi_test_unit_ready() routine in the SCSI core
to set a new flag when no medium is present.  The sd driver is changed to use
this new flag for reporting -ENOMEDIUM in from the sd_media_changed method.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxx>
Cc: Jens Axboe <axboe@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/scsi/scsi_lib.c    |    4 ++++
 drivers/scsi/sd.c          |    5 ++---
 include/scsi/scsi_device.h |    1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/scsi_lib.c~scsi-core-and-sd-early-detection-of-medium-not-present drivers/scsi/scsi_lib.c
--- devel/drivers/scsi/scsi_lib.c~scsi-core-and-sd-early-detection-of-medium-not-present	2006-06-06 16:10:55.000000000 -0700
+++ devel-akpm/drivers/scsi/scsi_lib.c	2006-06-06 16:10:55.000000000 -0700
@@ -2054,6 +2054,7 @@ scsi_test_unit_ready(struct scsi_device 
 	result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, &sshdr,
 				  timeout, retries);
 
+	sdev->medium_not_present = 0;
 	if ((driver_byte(result) & DRIVER_SENSE) && sdev->removable) {
 
 		if ((scsi_sense_valid(&sshdr)) &&
@@ -2061,6 +2062,9 @@ scsi_test_unit_ready(struct scsi_device 
 		     (sshdr.sense_key == NOT_READY))) {
 			sdev->changed = 1;
 			result = 0;
+
+			if (sshdr.asc == 0x3A)
+				sdev->medium_not_present = 1;
 		}
 	}
 	return result;
diff -puN drivers/scsi/sd.c~scsi-core-and-sd-early-detection-of-medium-not-present drivers/scsi/sd.c
--- devel/drivers/scsi/sd.c~scsi-core-and-sd-early-detection-of-medium-not-present	2006-06-06 16:10:55.000000000 -0700
+++ devel-akpm/drivers/scsi/sd.c	2006-06-06 16:10:55.000000000 -0700
@@ -744,9 +744,8 @@ static int sd_media_changed(struct gendi
 	 * and we will figure it out later once the drive is
 	 * available again.
 	 */
-	if (retval)
+	if (retval || sdp->medium_not_present)
 		 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
@@ -761,7 +760,7 @@ static int sd_media_changed(struct gendi
 
 not_present:
 	set_media_not_present(sdkp);
-	return 1;
+	return -ENOMEDIUM;
 }
 
 static int sd_sync_cache(struct scsi_device *sdp)
diff -puN include/scsi/scsi_device.h~scsi-core-and-sd-early-detection-of-medium-not-present include/scsi/scsi_device.h
--- devel/include/scsi/scsi_device.h~scsi-core-and-sd-early-detection-of-medium-not-present	2006-06-06 16:10:55.000000000 -0700
+++ devel-akpm/include/scsi/scsi_device.h	2006-06-06 16:10:55.000000000 -0700
@@ -92,6 +92,7 @@ struct scsi_device {
 	unsigned writeable:1;
 	unsigned removable:1;
 	unsigned changed:1;	/* Data invalid due to media change */
+	unsigned medium_not_present:1;	/* Set by scsi_test_unit_ready() */
 	unsigned busy:1;	/* Used to prevent races */
 	unsigned lockable:1;	/* Able to prevent media removal */
 	unsigned locked:1;      /* Media removal disabled */
_

Patches currently in -mm which might be from stern@xxxxxxxxxxxxxxxxxxx are

e100-disable-interrupts-at-boot.patch
allow-raw_notifier-callouts-to-unregister-themselves.patch
block-layer-early-detection-of-medium-not-present.patch
scsi-core-and-sd-early-detection-of-medium-not-present.patch
sd-early-detection-of-medium-not-present.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux