On Mon, 16 May 2005, Patrick Mansfield wrote: > Save and restore the scmd->result, so that timed out commands do not > return the result of the TEST UNIT READY or the start/stop commands. Code > is already in place to save and restore the result for the request sense > case. > > The previous version of this patch erroneously removed the "if" check, > instead add a comment as to why the "if" is needed. I can confirm that this patch does help; the correct status is now returned to the sg user. However there are still a few things that should be fixed up: First, this doesn't erase the sense data after error recovery. I tried it with two different scenarios, one where the command returned a phase error and one where the command timed out. In both cases the sg user got back a buffer with valid sense data, from the TUR commands issued by the error handler. This could be highly misleading. Second, as Patrick has noted, this doesn't prevent the error handler from issuing those TURs in the first place. If some sort of Unit Attention came up, the sg user wouldn't be able to handle it correctly because the error handler would have swallowed it. Of course, once this is fixed the first problem will no longer be an issue (no TUR, hence no unsolicited sense data). Alan Stern - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html