summary refs log tree commit diff
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2006-11-14 09:55:41 -0500
committerJeff Garzik <jeff@garzik.org>2006-11-14 09:55:41 -0500
commit253b92ecbd3d2e9f5a79fc7632c89ac74bff16c4 (patch)
tree8153c5044d97f5a46ee57329a9895256ab161500 /drivers/ata/libata-scsi.c
parent3f9dd27a22ff79b6b6c4eccd19e4063bff0ddc7e (diff)
downloadlinux-253b92ecbd3d2e9f5a79fc7632c89ac74bff16c4.tar.gz
libata: fix double-completion on error
A curious thing happens, however, when ata_qc_new_init fails to get
an ata_queued_cmd:

First, ata_qc_new_init handles the failure like this:
    cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
    done(cmd);

Then, we return to ata_scsi_translate and do this:
    err_mem:
        cmd->result = (DID_ERROR << 16);
        done(cmd);

It appears to me that first we set a status code indicating that we're
ok but the device queue is full and finish the command,  but then
we blow away that status code and replace it with an error flag and
finish the command a second time!  That does not seem to be desirable
behavior since we merely want the I/O to wait until a command slot
frees up, not send errors up the block layer.

In the err_mem case, we should simply exit out of ata_scsi_translate
instead.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7af2a4ba4990..5c1fc467fc7f 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1612,9 +1612,9 @@ early_finish:
 
 err_did:
 	ata_qc_free(qc);
-err_mem:
 	cmd->result = (DID_ERROR << 16);
 	done(cmd);
+err_mem:
 	DPRINTK("EXIT - internal\n");
 	return 0;