From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752661AbdLHH4l (ORCPT ); Fri, 8 Dec 2017 02:56:41 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:11920 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbdLHH4j (ORCPT ); Fri, 8 Dec 2017 02:56:39 -0500 Subject: Re: [PATCH] libsas: flush pending destruct work in sas_unregister_domain_devices() To: Cong Wang , John Garry References: <20171128002445.16594-1-xiyou.wangcong@gmail.com> <20171128082049.5smff3hvrkwrf77o@linux-x5ow.site> <922397da-7dd3-c24e-1d94-e4804a769331@huawei.com> <877cfb17-ba90-da91-a549-418bb6eb6391@huawei.com> CC: Johannes Thumshirn , LKML , Dan Williams , Praveen Murali , "James E.J. Bottomley" , "Martin K. Petersen" , "linux-scsi@vger.kernel.org" , chenxiang From: Jason Yan Message-ID: <5A2A454E.6050108@huawei.com> Date: Fri, 8 Dec 2017 15:54:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.96.203] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.5A2A45B3.0067,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 15b6d8301d30c8b3395d04a4244a13d7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/12/8 6:57, Cong Wang wrote: > On Thu, Dec 7, 2017 at 5:37 AM, John Garry wrote: >> On 28/11/2017 17:04, Cong Wang wrote: >>> >>> I don't understand, the only caller of sas_unregister_domain_devices() >>> is sas_deform_port(). >>> >> >> And sas_deform_port() may be called from another worker on the same queue, >> right? As in sas_phye_loss_of_signal()->sas_deform_port() > > Oh, good catch! I didn't notice this subtle call path. > > Do you have any better idea to fix this? We saw this on 4.9 too. > We have sent a patchset to fix this and to enhance libsas hotplug. Please refer to https://lkml.org/lkml/2017/9/6/142 And I'm going to send a new version soon. Jason >> >> The device destruct takes place in a separate worker from which >> sas_deform_port() is called, but the same queue. So we have this queued >> destruct happen after the port is fully deformed -> hence the WARN. >> >> I guess you only tested your patch on disks attached through an expander. > > I have very limited scsi hardware, so my testing is limited too. > > . >