Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2642741pxb; Mon, 6 Sep 2021 01:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCWgo8hChLI6sxjkVj6a5ceRUd0YYIdQlcCpeiI7KgojonTTiAn9ZkMhvqNQBng4oK/xou X-Received: by 2002:a02:c80b:: with SMTP id p11mr9941791jao.122.1630918330684; Mon, 06 Sep 2021 01:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630918330; cv=none; d=google.com; s=arc-20160816; b=Ba/WWF19ASZQCWBRxRkVW6yxXXWcyFuRPz3y8FK6H85LmDrIrN6HinakkVeGGdY/dC iltWUd71SKpY73fKOrF891PGJZJPtWQBQeKGopJadj4z3QLqHa9D6cy4CqMNik64nn46 trG9Z8Fq45FKS98OoyoWRHGRK7uNQ50w7YZPQmZS3xrvRJrJV9KntSdCiQ0823KwloIy iBXnnExg26p1HqakK1MkvFQm5GIknbqJRieFMJa+5bUgD7MjeSVN0IyB6XZQKhuTTHZ9 MepiJGwOKpU3WFKogpjNOLiMfYISrlrWbPs1WZXuSKpJvc1TRbUU71LMi9NpOKfdQvFW Rgqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=Xepuq2g1UzpFTzC0FV5yi43ZLpLb8aMqI7nbH2laTl8=; b=sEQNnR10Jc9HUHVRLHtwnTWr7foWqhowSwYNmbvskiYtmOkjpDWJKYuz3tujT2KM5G n65Ncoz2KajVXtLuiK0yvBEGxHtAAnSgAnUz3Y6OHa+/LeKn7LArBZv/ZnDXi3adUH4d lXcdW2w49/Nm44+Ry28oz8+KzBWUXDurcMFkjyoApqter/Ibdz+KLWf6IeTtUWFWuNoJ CctYv69MT15YP0boFLZIMEYpEK3Durc25LoGk6plJwjtxkb6t42TMH4NWMiACd8SGQSi fo5PF/Uc2P7q1Xgb5fxaUJ5ve3MZWk2mSqyQiL8ReJ6xBjJWLY4OiYOm1w00gJAqLxi1 y+Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=enIQailC; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 132si7195895jaf.20.2021.09.06.01.51.59; Mon, 06 Sep 2021 01:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=enIQailC; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241060AbhIFIlM (ORCPT + 99 others); Mon, 6 Sep 2021 04:41:12 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:34988 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbhIFIlL (ORCPT ); Mon, 6 Sep 2021 04:41:11 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9F9F2220FB; Mon, 6 Sep 2021 08:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1630917606; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xepuq2g1UzpFTzC0FV5yi43ZLpLb8aMqI7nbH2laTl8=; b=enIQailCj0QG3GmZKHJQ/HdvNX+3DVhiYocJMKVxVVrW4wCw0yUhEluAEBZCYToEalVE9u 8y5tr6BKNQn1dolhvVjPE/kVMcZDquknnPmWSqwjlMM3wOmFTldLyiIDX79ZddBj0qlOiY kCOvsRWtpkzxN4VIOIAraIWj0HMqnv0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1630917606; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xepuq2g1UzpFTzC0FV5yi43ZLpLb8aMqI7nbH2laTl8=; b=xarIDKwLIHfLikmp7p97wQPLMuG55G1Eqt1tNGzIk/RW6STFT3eabuFmtKE25RDjDEGAdc MvsEUQ1VlhGFzqBg== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 7A14113299; Mon, 6 Sep 2021 08:40:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id RFIaHObTNWEycQAAGKfGzw (envelope-from ); Mon, 06 Sep 2021 08:40:06 +0000 Subject: Re: [PATCH v2] nvme: avoid race in shutdown namespace removal To: Christoph Hellwig , Daniel Wagner Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch References: <20210902092002.67614-1-dwagner@suse.de> From: Hannes Reinecke Message-ID: Date: Mon, 6 Sep 2021 10:40:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/6/21 10:01 AM, Christoph Hellwig wrote: > On Thu, Sep 02, 2021 at 11:20:02AM +0200, Daniel Wagner wrote: >> When we remove the siblings entry, we update ns->head->list, hence we >> can't separate the removal and test for being empty. They have to be >> in the same critical section to avoid a race. >> >> To avoid breaking the refcounting imbalance again, add a list empty >> check to nvme_find_ns_head. > > Hannes, can you look over this and run your tests on it? > I'm at it. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer