From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163277AbdEXJi0 (ORCPT ); Wed, 24 May 2017 05:38:26 -0400 Received: from verein.lst.de ([213.95.11.211]:59227 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163251AbdEXJh6 (ORCPT ); Wed, 24 May 2017 05:37:58 -0400 Date: Wed, 24 May 2017 11:37:55 +0200 From: Christoph Hellwig To: Rakesh Pandit Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Subject: Re: [PATCH 1/2] nvme: fix multiple ctrl removal scheduling Message-ID: <20170524093755.GA17483@lst.de> References: <20170523221545.GA23946@dhcp-216.srv.tuxera.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170523221545.GA23946@dhcp-216.srv.tuxera.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 24, 2017 at 01:15:47AM +0300, Rakesh Pandit wrote: > Commit c5f6ce97c1210 tries to address multiple resets but fails as > work_busy doesn't involve any synchronization and can fail. This is > reproducible easily as can be seen by WARNING below which is triggered > with line: > > WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING) > > Allowing multiple resets can result in multiple controller removal as > well if different conditions inside nvme_reset_work fail and which > might deadlock on device_release_driver. > > This patch addresses the problem by using state of controller to > decide whether reset should be queued or not as state change is > synchronizated using controller spinlock. But we don't hold the lock over the check and the decision. I suspect what we need to do is to actually change to the resetting state before queueing up the reset work. Can you give that a spin?