Red Hat Bugzilla – Bug 300871
Busy status on tape write results in incorrect residual returned to tape driver
Last modified: 2008-05-21 10:55:50 EDT
Description of problem:
A scsi i/o request to a tape drive can receive a "stale" residual when an
immediate mode rewind request is in progress. The i/o request receives a BUSY
response from the tape drive. The low-level driver sets the residual field of
the scsi request to the request length and returns
(DID_OK << 16) | scsi_status
in the result field. The result field contains "8" which breaks down as
status_byte(result) == 4, i.e. BUSY.
scsi_softirq_done() calls scsi_decide_disposition() which returns
ADD_TO_MLQUEUE. scsi_softirq_done() then calls scsi_queue_insert() which, on
the way to resubmitting the request to the driver, calls scsi_init_cmd_errh().
The following patch modifies scsi_init_cmd_errh() to zero the residual before
the command is (re)submitted. This results in the correct residual being
returned when the command finally completes.
The patch was posted to linux-scsi mailing list on September 17, 2007, and
applies to 2.6.23-rc6-git7. It should apply (+/-) to rhel5-latest.
--- linux-2.6.23-rc6-git7.orig/drivers/scsi/scsi_lib.c 2007-09-17
+++ linux-2.6.23-rc6-git7/drivers/scsi/scsi_lib.c 2007-09-17
@@ -443,6 +443,7 @@ EXPORT_SYMBOL_GPL(scsi_execute_async);
static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
cmd->serial_number = 0;
+ cmd->resid = 0;
memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);
if (cmd->cmd_len == 0)
cmd->cmd_len = COMMAND_SIZE(cmd->cmnd);
Version-Release number of selected component (if applicable):
During tape write when immediate mode rewind request is in progress.
Steps to Reproduce:
See description above.
Incorrect residual value returned.
Residual value 0 returned.
A diff to the RHEL5.1 kernel source will be posted here once the patch has been
confirmed to be upstream.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
Created attachment 207371 [details]
Diff against 2.6.18-47.el5 kernel source.
Changed status per instructions from Don Zickus.
You can download this test kernel from http://people.redhat.com/dzickus/el5
Fix verified at SGI.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.