[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <576A3440.9090803@huawei.com>
Date: Wed, 22 Jun 2016 14:46:24 +0800
From: dingxiang <dingxiang@...wei.com>
To: Tejun Heo <tj@...nel.org>, Dan Williams <dan.j.williams@...el.com>
CC: "Martin K. Petersen" <martin.petersen@...cle.com>,
<jejb@...ux.vnet.ibm.com>, Wei Fang <fangwei1@...wei.com>,
<miaoxie@...wei.com>, <wangyijing@...wei.com>,
<zhangaihua1@...wei.com>, <zhaohongjiang@...wei.com>,
<houtao1@...wei.com>, linux-scsi <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V2 resend] libata:fix kernel panic when hotplug
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
>> <martin.petersen@...cle.com> wrote:
>>>>>>>> "Tejun" == Tejun Heo <tj@...nel.org> 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~
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);
/* new device discovered, configure xfermode */
Powered by blists - more mailing lists