From patchwork Tue Sep 6 16:33:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 113600 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BE3F1B6F6F for ; Wed, 7 Sep 2011 02:34:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013Ab1IFQeG (ORCPT ); Tue, 6 Sep 2011 12:34:06 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:43922 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752000Ab1IFQeD (ORCPT ); Tue, 6 Sep 2011 12:34:03 -0400 Received: by ywf7 with SMTP id 7so4132915ywf.19 for ; Tue, 06 Sep 2011 09:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=xqkSGz8L7CmbVhBBQ6mZEe6BCPQhgiYXOYnnKnl6EFE=; b=UvIHe6B75/TUlJCIzGqeBZwyFlD3Bd+ft6mfMGiZ9MB8rpmxo0jVKwot9fn2yaArie G3dEWiJeB/oM6b86S4lAu85yyx+fLB5DIeAS++Hjp3nfN0Dz5Zde5aE0XAZcFQ0ErpkD kIyiqEb6CEvyNWGVL0kntGoqSs7xOzC0M/eYY= Received: by 10.42.161.74 with SMTP id s10mr4980765icx.229.1315326843054; Tue, 06 Sep 2011 09:34:03 -0700 (PDT) Received: from mtj.dyndns.org ([121.167.223.83]) by mx.google.com with ESMTPS id r2sm1523729ibq.7.2011.09.06.09.33.59 (version=SSLv3 cipher=OTHER); Tue, 06 Sep 2011 09:34:01 -0700 (PDT) Date: Wed, 7 Sep 2011 01:33:55 +0900 From: Tejun Heo To: Bruce Stenning Cc: Mark Lord , "linux-kernel@vger.kernel.org" , "linux-ide@vger.kernel.org" , Jeff Garzik Subject: Re: sata_mv port lockup on hotplug (kernel 2.6.38.2) Message-ID: <20110906163355.GG18425@mtj.dyndns.org> References: <20110610140155.GJ15235@htj.dyndns.org> <4DF25526.9010800@teksavvy.com> <20110611121957.GA7980@mtj.dyndns.org> <4DF4F30B.70702@teksavvy.com> <20110613104856.GC16021@htj.dyndns.org> <20110902011305.GE2752@htj.dyndns.org> <20110906034544.GB18425@mtj.dyndns.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Hello, On Tue, Sep 06, 2011 at 01:19:44PM +0100, Bruce Stenning wrote: > ata4: EH complete > Waking error handler thread > scsi_eh_wakeup: succeeded > scsi_schedule_eh: succeeded > scsi_restart_operations: waking up host to restart > Error handler scsi_eh_3 sleeping I think the following should fix the problem. The code there is from the time when libata shared scsi_host->host_lock. libata no longer does that so, in the current state, host_eh_scheduled can be cleared with actual pending EH condition. You should be able to reproduce the problem more easily by adding delay (something like mdelay(5)) before host_eh_scheduled clearing without the following patch applied. Thanks. --- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index ed16fbe..e971784 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -771,6 +771,14 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) /* process port suspend request */ ata_eh_handle_port_suspend(ap); + /* + * Single iteration complete. Clear SCSI EH scheduled + * state and check whether another iteration is necessary. + */ + spin_lock_irqsave(host->host_lock, flags); + host->host_eh_scheduled = 0; + spin_unlock_irqrestore(host->host_lock, flags); + /* Exception might have happened after ->error_handler * recovered the port but before this point. Repeat * EH in such case. @@ -792,13 +800,6 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) ata_for_each_link(link, ap, HOST_FIRST) memset(&link->eh_info, 0, sizeof(link->eh_info)); - /* Clear host_eh_scheduled while holding ap->lock such - * that if exception occurs after this point but - * before EH completion, SCSI midlayer will - * re-initiate EH. - */ - host->host_eh_scheduled = 0; - spin_unlock_irqrestore(ap->lock, flags); ata_eh_release(ap); } else {