From patchwork Wed Jun 22 06:46:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DingXiang X-Patchwork-Id: 9191951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B28C0601C0 for ; Wed, 22 Jun 2016 06:48:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A079127FBB for ; Wed, 22 Jun 2016 06:48:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95366283ED; Wed, 22 Jun 2016 06:48:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2026127FBB for ; Wed, 22 Jun 2016 06:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751667AbcFVGs3 (ORCPT ); Wed, 22 Jun 2016 02:48:29 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:1303 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751524AbcFVGs1 (ORCPT ); Wed, 22 Jun 2016 02:48:27 -0400 Received: from 172.24.1.60 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.60]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DJE08409; Wed, 22 Jun 2016 14:47:42 +0800 (CST) Received: from [127.0.0.1] (10.177.234.90) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Wed, 22 Jun 2016 14:47:31 +0800 Subject: Re: [PATCH V2 resend] libata:fix kernel panic when hotplug To: Tejun Heo , Dan Williams References: <1466052340-25520-1-git-send-email-dingxiang@huawei.com> <20160616202045.GF3262@mtj.duckdns.org> <20160621154700.GH3262@mtj.duckdns.org> CC: "Martin K. Petersen" , , Wei Fang , , , , , , linux-scsi , "linux-kernel@vger.kernel.org" From: dingxiang Message-ID: <576A3440.9090803@huawei.com> Date: Wed, 22 Jun 2016 14:46:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160621154700.GH3262@mtj.duckdns.org> X-Originating-IP: [10.177.234.90] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.576A3490.002E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9701121ac856eac32f9336508610dc16 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi,All > Hello, > > On Mon, Jun 20, 2016 at 06:46:55PM -0700, Dan Williams wrote: >> On Mon, Jun 20, 2016 at 6:22 PM, Martin K. Petersen >> wrote: >>>>>>>> "Tejun" == Tejun Heo writes: >>>>> In fact,we don't need libata to deal with hotplug in sas environment. >>>>> So we can't run ata hotplug task when ata port is sas host. >>> Tejun> Martin, can you please confirm whether the above is true. If so, >>> Tejun> I'll route the patch through libata w/ stable cc'd. >>> >>> Not exactly a libsas expert. James? Dan? >> While it is true that libsas itself handles adding / removing devices >> we have historically avoided this conflict because >> ATA_PFLAG_SCSI_HOTPLUG is never set for libsas ata_ports. So the bug >> / behavior change is that ATA_PFLAG_SCSI_HOTPLUG gets set in the >> first place. Ignoring it is a band-aid / not the real fix afaics. > I see. I'll hold off for now then. Ding Xiang, can you find out > where that flag is getting set? > > Thanks! There are two places will set flag ATA_PFLAG_SCSI_HOTPLUG in libata-eh.c. I think both places should be protected. Here is the suggestion. Thanks~ /* new device discovered, configure xfermode */ --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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 61dc7a9..2bee041 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -1385,7 +1385,8 @@ void ata_eh_detach_dev(struct ata_device *dev) if (ata_scsi_offline_dev(dev)) { dev->flags |= ATA_DFLAG_DETACHED; - ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; + if (!(ap->pflags & ATA_FLAG_SAS_HOST)) + ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; } /* clear per-dev EH info */ @@ -3299,7 +3300,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, } spin_lock_irqsave(ap->lock, flags); - ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; + if (!(ap->pflags & ATA_FLAG_SAS_HOST)) + ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; spin_unlock_irqrestore(ap->lock, flags);