Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA81C606A322 for ; Thu, 3 Dec 2026 11:50:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=xOCRABDO; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=EJAQLTAn DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=1lyvozlDilxNqDm0uaBFQ645xFUD1aR/uN41BU4JNUY=; b=xOCRABDOGwOkiw QxuZ4Gm6R0TpAfn0zQJFZtTcmG9WsvmoM0GgdtcPwXK7P5SgqZ2j0TuKJeDoGs0RtL8aXYik1ncEn T1BLtNQfDuAclsG6P1lcRRdjzM4+KvQCoo+DE6Lu2Yi0IPXimWm3c5uuVY8mdqx1Sqf7JtjEulj+z GEjKYCr3U3Mw93RMnlUNEzN3k2o2i+y/Y5dpnO4SS6D3SUAeso5Rjs1ehfEhaLFIzFANALld6BZtv dNY0cSeVSFpSNjxBUEuoVdyJ1YgXC02khgJ6IbqpArHtDhsUydLjP9r75GADL/lY4vgJQ0bUG6by0 dQUJnUk8ZUb/mJBnGxhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ5Kk-0000000ERFI-0Qas; Thu, 03 Dec 2026 11:50:42 +0000 Received: from out30-119.freemail.mail.aliyun.com ([115.124.30.119]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ5Kf-0000000ERD8-2JR6 for linux-nvme@lists.infradead.org; Thu, 03 Dec 2026 11:50:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796298627; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=1lyvozlDilxNqDm0uaBFQ645xFUD1aR/uN41BU4JNUY=; b=EJAQLTAnJVzDN7gokjkNSbsAggG5vsID4HLCW1QHCnTOtlSFIV3eB44qjKP65Pj9BjlXHxsgbHymxlsavXHwYeTkGZpq6fVpjTiOmn8Sm6d7OWxgfPBh1M85mK37FqQcWroGATHoimwmSK59JXo25CRNP31mzCyxysnrK8rmVkY= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0XGECZ95_1796298625; Received: from 30.178.68.70(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0XGECZ95_1796298625 cluster:ay36) by smtp.aliyun-inc.com; Thu, 03 Dec 2026 19:50:26 +0800 Message-ID: Date: Thu, 3 Dec 2026 19:50:24 +0800 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] nvme-multipath: serialize ana_log_buf lifecycle with ana_lock To: Nilay Shroff , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Daniel Wagner , Hannes Reinecke Cc: linux-nvme@lists.infradead.org References: <20261202085124.1252825-1-kanie@linux.alibaba.com> <3d7fe94a-7b7c-4f0f-b336-d702922e9fbc@linux.ibm.com> From: Guixin Liu In-Reply-To: <3d7fe94a-7b7c-4f0f-b336-d702922e9fbc@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_035038_217643_50EEF1BA X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: -17.6 (-----------------) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 在 2026/12/2 23:24, Nilay Shroff 写道: > On 12/2/26 2:21 PM, Guixin Liu wrote: >>   void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid) >>   { >> -    if (nvme_ctrl_use_ana(ns->ctrl)) { >> -        struct nvme_ana_group_desc desc = { >> -            .grpid = anagrpid, >> -            .state = 0, >> -        }; >> +    struct nvme_ana_group_desc desc = { >> +        .grpid = anagrpid, >> +        .state = 0, >> +    }; >> +    bool use_ana; >>   -        mutex_lock(&ns->ctrl->ana_lock); >> +    mutex_lock(&ns->ctrl->ana_lock); >> +    use_ana = nvme_ctrl_use_ana(ns->ctrl); > > I think the existing lockless nvme_ctrl_use_ana() check is intentional. > It is essentially a feature-selection test: for a controller that does > not support ANA, ana_log_buf is never initialized, whereas for an > ANA-capable controller, it is initialized before namespace scanning > begins. > > In any case, even if nvme_mpath_uninit() runs concurrently with > nvme_mpath_add_disk() and the latter proceeds to nvme_parse_ana_log(), > the nvme_mpath_add_disk() rechecks ctrl->ana_log_buf, so we should be > safe. You are right, I will drop this in v5. > > Ideally, nvme_parse_ana_log() should return an error code that > distinguishes between ctrl->ana_log_buf being NULL and other errors. > This would then allow nvme_mpath_add_disk() to make the appropriate > decision based on the actual failure. That makes sense, changed in v5, thanks. Best Regards, Guixin Liu > > So IMO, moving nvme_ctrl_use_ana() under ctrl->ana_lock may > not br optimal. > > Thanks, > --Nilay