From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753623AbbLVH5s (ORCPT ); Tue, 22 Dec 2015 02:57:48 -0500 Received: from mx2.suse.de ([195.135.220.15]:44069 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752337AbbLVH5q (ORCPT ); Tue, 22 Dec 2015 02:57:46 -0500 Subject: Re: [PATCH v3 59/77] ncr5380: Fix autosense bugs To: Finn Thain , "James E.J. Bottomley" , Michael Schmitz , linux-m68k@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, "Martin K. Petersen" References: <20151222011737.980475848@telegraphics.com.au> <20151222011754.046134198@telegraphics.com.au> From: Hannes Reinecke Message-ID: <56790278.1090301@suse.de> Date: Tue, 22 Dec 2015 08:57:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151222011754.046134198@telegraphics.com.au> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/2015 02:18 AM, Finn Thain wrote: > NCR5380_information_transfer() may re-queue a command for autosense, > after calling scsi_eh_prep_cmnd(). This creates several possibilities: > > 1. Reselection may intervene before the re-queued command gets processed. > If the reconnected command then undergoes autosense, this causes the > scsi_eh_save data from the previous command to be overwritten. > > 2. After NCR5380_information_transfer() calls scsi_eh_prep_cmnd(), > a new REQUEST SENSE command may arrive. This would be queued ahead > of any command already undergoing autosense, which means the > scsi_eh_save data might be restored to the wrong command. > > 3. After NCR5380_information_transfer() calls scsi_eh_prep_cmnd(), > eh_abort_handler() may abort the command. But the scsi_eh_save data is > not discarded, which means the scsi_eh_save data might be incorrectly > restored to the next REQUEST SENSE command issued. > > This patch adds a new autosense list so that commands that are re-queued > because of a CHECK CONDITION result can be kept apart from the REQUEST > SENSE commands that arrive via queuecommand. > > This patch also adds a function dedicated to dequeueing and preparing the > next command for processing. By refactoring the main loop in this way, > scsi_eh_save takes place when an autosense command is dequeued rather > than when re-queued. > > Signed-off-by: Finn Thain > > --- > drivers/scsi/NCR5380.c | 194 +++++++++++++++++++--------------- > drivers/scsi/NCR5380.h | 2 > drivers/scsi/atari_NCR5380.c | 239 ++++++++++++++++++++++++------------------- > 3 files changed, 249 insertions(+), 186 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)