From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.9]:51415 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1169191AbcKANn4 (ORCPT ); Tue, 1 Nov 2016 09:43:56 -0400 Date: Tue, 1 Nov 2016 06:43:52 -0700 From: Christoph Hellwig To: Sagi Grimberg Cc: linux-nvme@lists.infradead.org, Jens Axboe , Jay Freyensee , Solganik Alexander , Christoph Hellwig , "# v4 . 8+" Subject: Re: [PATCH] nvmet: Fix possible infinite loop triggered on hot namespace removal Message-ID: <20161101134352.GA5096@infradead.org> References: <1477819337-31190-1-git-send-email-sagi@grimberg.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1477819337-31190-1-git-send-email-sagi@grimberg.me> Sender: stable-owner@vger.kernel.org List-ID: > void nvmet_ns_disable(struct nvmet_ns *ns) > @@ -324,13 +324,10 @@ void nvmet_ns_disable(struct nvmet_ns *ns) > struct nvmet_subsys *subsys = ns->subsys; > struct nvmet_ctrl *ctrl; > > - mutex_lock(&subsys->lock); > - if (list_empty(&ns->dev_link)) { > - mutex_unlock(&subsys->lock); > + if (!test_and_clear_bit(NVMET_NS_ENABLED, &ns->flags)) > return; > - } > - list_del_init(&ns->dev_link); > - mutex_unlock(&subsys->lock); > + > + list_del_rcu(&ns->dev_link); We'll still need the lock here, don't we?