From: dingxiang <dingxiang@huawei.com>
To: Tejun Heo <tj@kernel.org>, Dan Williams <dan.j.williams@intel.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
jejb@linux.vnet.ibm.com, Wei Fang <fangwei1@huawei.com>,
miaoxie@huawei.com, wangyijing@huawei.com,
zhangaihua1@huawei.com, zhaohongjiang@huawei.com,
houtao1@huawei.com, linux-scsi <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 resend] libata:fix kernel panic when hotplug
Date: Wed, 22 Jun 2016 14:46:24 +0800 [thread overview]
Message-ID: <576A3440.9090803@huawei.com> (raw)
In-Reply-To: <20160621154700.GH3262@mtj.duckdns.org>
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@oracle.com> wrote:
>>>>>>>> "Tejun" == Tejun Heo <tj@kernel.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 */
WARNING: multiple messages have this Message-ID (diff)
From: dingxiang <dingxiang@huawei.com>
To: Tejun Heo <tj@kernel.org>, Dan Williams <dan.j.williams@intel.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
<jejb@linux.vnet.ibm.com>, Wei Fang <fangwei1@huawei.com>,
<miaoxie@huawei.com>, <wangyijing@huawei.com>,
<zhangaihua1@huawei.com>, <zhaohongjiang@huawei.com>,
<houtao1@huawei.com>, linux-scsi <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 resend] libata:fix kernel panic when hotplug
Date: Wed, 22 Jun 2016 14:46:24 +0800 [thread overview]
Message-ID: <576A3440.9090803@huawei.com> (raw)
In-Reply-To: <20160621154700.GH3262@mtj.duckdns.org>
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@oracle.com> wrote:
>>>>>>>> "Tejun" == Tejun Heo <tj@kernel.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 */
next prev parent reply other threads:[~2016-06-22 6:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 4:45 [PATCH V2 resend] libata:fix kernel panic when hotplug DingXiang
2016-06-16 4:45 ` DingXiang
2016-06-16 20:20 ` Tejun Heo
2016-06-21 1:22 ` Martin K. Petersen
2016-06-21 1:46 ` Dan Williams
2016-06-21 15:47 ` Tejun Heo
2016-06-22 6:46 ` dingxiang [this message]
2016-06-22 6:46 ` dingxiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=576A3440.9090803@huawei.com \
--to=dingxiang@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=fangwei1@huawei.com \
--cc=houtao1@huawei.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=miaoxie@huawei.com \
--cc=tj@kernel.org \
--cc=wangyijing@huawei.com \
--cc=zhangaihua1@huawei.com \
--cc=zhaohongjiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.