Re: [regression] CD-DA delay needed after insertion

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Boaz Harrosh
Date: Sunday, June 15, 2008 - 5:46 am

Geert Uytterhoeven wrote:

James hi.

It looks like the same problem as before. Any BLOCK_PC command will 
eat the UNIT_ATTENTION notification. Which is what I was afraid of. 
I was thinking of something like below.

Totally untested, never even booted. It is just to demonstrate the concept.
Please tell me if it is at all desirable and I'll spend some time to see
if it runs, and test it.

Boaz
---
From 8cd166b76100a2830f0f973df866f5509398f6cc Mon Sep 17 00:00:00 2001
From: Boaz Harrosh <bharrosh@panasas.com>
Date: Tue, 10 Jun 2008 20:09:43 +0300
Subject: [PATCH] scsi: Proccess UNIT_ATTENTION on any type command

Let scsi_check_sense() report UNIT_ATTENTION media
changes for any type of command. Currently only FS
commands are reported.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 drivers/scsi/scsi_error.c |    4 ++++
 drivers/scsi/scsi_lib.c   |    3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 006a959..7039d11 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -370,6 +370,10 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 		if (scmd->device->allow_restart &&
 		    (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
 			return FAILED;
+
+		/* Detected disc change.*/
+		if (scmd->device->removable)
+			scmd->device->changed = 1;
 		return SUCCESS;
 
 		/* these three are not supported */
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 033c58a..efd3e09 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -903,11 +903,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 	if (sense_valid && !sense_deferred) {
 		switch (sshdr.sense_key) {
 		case UNIT_ATTENTION:
-			if (cmd->device->removable) {
+			if (cmd->device->changed) {
 				/* Detected disc change.  Set a bit
 				 * and quietly refuse further access.
 				 */
-				cmd->device->changed = 1;
 				scsi_end_request(cmd, -EIO, this_count, 1);
 				return;
 			} else {
-- 
1.5.6.rc1.5.gadf6


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[regression] CD-DA delay needed after insertion, Geert Uytterhoeven, (Fri Jun 13, 4:57 am)
Re: [regression] CD-DA delay needed after insertion, Boaz Harrosh, (Sun Jun 15, 5:46 am)
Re: [regression] CD-DA delay needed after insertion, James Bottomley, (Sun Jun 15, 7:33 am)
Re: [regression] CD-DA delay needed after insertion, James Bottomley, (Sun Jun 15, 7:39 am)
Re: [regression] CD-DA delay needed after insertion, Geert Uytterhoeven, (Mon Jun 16, 8:05 am)
Re: [regression] CD-DA delay needed after insertion, James Bottomley, (Mon Jun 16, 1:30 pm)
Re: [regression] CD-DA delay needed after insertion, Geert Uytterhoeven, (Tue Jun 17, 6:31 am)
Re: [regression] CD-DA delay needed after insertion, Chuck Ebbert, (Tue Jun 17, 3:56 pm)
Re: [regression] CD-DA delay needed after insertion, James Bottomley, (Tue Jun 17, 3:59 pm)
Re: [regression] CD-DA delay needed after insertion, James Bottomley, (Wed Jun 18, 1:40 pm)
Re: [regression] CD-DA delay needed after insertion, Geert Uytterhoeven, (Thu Jun 19, 2:34 am)
Re: [regression] CD-DA delay needed after insertion, James Bottomley, (Fri Jun 27, 3:27 pm)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Mon Jun 30, 2:25 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Wed Jul 30, 6:06 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Wed Sep 17, 8:05 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Tue Sep 30, 5:33 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Tue Sep 30, 6:37 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Tue Sep 30, 7:51 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Tue Sep 30, 8:21 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Monty Montgomery, (Tue Sep 30, 10:32 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Monty Montgomery, (Tue Sep 30, 11:10 am)
Re: [regression] CD-DA delay needed after insertion (http: ..., Geert Uytterhoeven, (Wed Oct 1, 12:51 am)