Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1497103pxb; Thu, 28 Jan 2021 19:32:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRnwgteLxY+Fwy2DXGFiJ5Y0jwOpsTW9M1athLR/J7jKg770rL4J+oOI6YuTaS87o0mN1X X-Received: by 2002:a50:b5c5:: with SMTP id a63mr2938345ede.227.1611891159622; Thu, 28 Jan 2021 19:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611891159; cv=none; d=google.com; s=arc-20160816; b=ns29Ksl/Og5eBtUEXYT5Gc50FLG2RS1yTL8wdhh0bYzS/speQo5QUOzHyNBN/9L8+Q LWQ1goVQdRUDjWMS7PU+ZRxY3jCdztoBb8Wo9gBKGEh8s7bXyKNwm3pt3oKNhUzzY3XU W4eFpVODfp1dIkB4Xlx/bQWeexUSmdwyzgPk2IFLnGY7nCcRv4jms19jWYLb59fSKrz4 +ki2RDUQVmSwLfxeME9LBbcGuRNFpCy7911p047sE5AGvtW5g+jarlRSPNHKr5B6nx73 dM2lIAwa9Ohaw1bXsIHiGyx6Yso6ndpj6bz3yfVChjXloL2ga3IjBLyvsbGUIDvrnAGl ix2w== 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; bh=7JvZqZgmo4qIPwsjj069cmI/74kxVP4SSY95ky0J7hY=; b=jjy4/VtLUi7kWRVDCK8h2f9HHvETSsDQu7BvRiIlS1egRgWxxqZ/Bzyn5E6R2bQOl5 5b6h+jlx2xsUsNPmH1I4rYTYFL4B3EvK4pBe4BlZsYShEv/b/2JQl6AtpwbjW/GPZl+I Bz1HAQua/s85Cx1lcMySLaVellNj7S35CQzDiPiLZWiGcsxVoevD+vpRx9vD8wOJQfiG PzTQqa5CK9slRaUHGEdAFFKrlRdGBtBQaHBWiDyyTQeWP/7WMzTGP12MRTfQki+MQcYy cXyZW1uO03HRE6K58Am2vFKXmYIVr/uL/3ALAsYHTfEngC4cwwe9wTGL+9IOoQKtoXik ZVJw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j12si3734676ejt.34.2021.01.28.19.32.14; Thu, 28 Jan 2021 19:32:39 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbhA2Daz (ORCPT + 99 others); Thu, 28 Jan 2021 22:30:55 -0500 Received: from mail-wr1-f52.google.com ([209.85.221.52]:45501 "EHLO mail-wr1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbhA2Day (ORCPT ); Thu, 28 Jan 2021 22:30:54 -0500 Received: by mail-wr1-f52.google.com with SMTP id m13so7430442wro.12 for ; Thu, 28 Jan 2021 19:30:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7JvZqZgmo4qIPwsjj069cmI/74kxVP4SSY95ky0J7hY=; b=nIEy/lYxmdw85hqEYJhYKENkZSsHHK1m7LB89xG2TEw2BWmS6TtDQDoBxn80aFgyds sHjXUKrBpNnzQ9nHbgMiG89q4hy8MS5QC+0DB8/pD4Ndj6Va/ekw3SF+aAed7HVHUoQc VB0aouijii+28kmHTKDRWGHR5p+ii5riEukRgyMcAF0Qe0W6v4bFh427IRBtrVJnsqDE 7ScsyV7hu4TuWI6YJYVAOD7dMQ/8ggfUzZmPh8l/qMbLLh6q/jxtPQ0cAA3naEvTwzog OPYy+Y2GPgUqNeIG0U0ad9+6+oFAP/qbks/HHEdetdaqVeoOF5RyMlw9ui1U8aorlvxc nOhQ== X-Gm-Message-State: AOAM5324x6FuJh/qqP9WTMPgIBDPXxfQSkTwI5odU+D7wa4Ng6nq2doT 2+Ty0As+/ZSMmYb5IOby/2I= X-Received: by 2002:a5d:5283:: with SMTP id c3mr2038048wrv.319.1611891011977; Thu, 28 Jan 2021 19:30:11 -0800 (PST) Received: from ?IPv6:2601:647:4802:9070:3d48:4849:d506:e578? ([2601:647:4802:9070:3d48:4849:d506:e578]) by smtp.gmail.com with ESMTPSA id u14sm7730793wml.19.2021.01.28.19.30.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Jan 2021 19:30:11 -0800 (PST) Subject: Re: [PATCH v2] nvme-multipath: Early exit if no path is available To: Chao Leng , Daniel Wagner Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Jens Axboe , Hannes Reinecke , Keith Busch , Christoph Hellwig References: <20210127103033.15318-1-dwagner@suse.de> <20210128075837.u5u56t23fq5gu6ou@beryllium.lan> <69575290-200e-b4a1-4269-c71e4c2cc37b@huawei.com> <20210128094004.erwnszjqcxlsi2kd@beryllium.lan> <675d3cf7-1ae8-adc5-b6d0-359fe10f6b23@grimberg.me> <59cd053e-46cb-0235-141f-4ce919c93f48@huawei.com> From: Sagi Grimberg Message-ID: Date: Thu, 28 Jan 2021 19:30:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <59cd053e-46cb-0235-141f-4ce919c93f48@huawei.com> 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 >>>> You can't see exactly where it dies but I followed the assembly to >>>> nvme_round_robin_path(). Maybe it's not the initial nvme_next_ns(head, >>>> old) which returns NULL but nvme_next_ns() is returning NULL eventually >>>> (list_next_or_null_rcu()). >>> So there is other bug cause nvme_next_ns abormal. >>> I review the code about head->list and head->current_path, I find 2 bugs >>> may cause the bug: >>> First, I already send the patch. see: >>> https://lore.kernel.org/linux-nvme/20210128033351.22116-1-lengchao@huawei.com/ >>> >>> Second, in nvme_ns_remove, list_del_rcu is before >>> nvme_mpath_clear_current_path. This may cause "old" is deleted from the >>> "head", but still use "old". I'm not sure there's any other >>> consideration here, I will check it and try to fix it. >> >> The reason why we first remove from head->list and only then clear >> current_path is because the other way around there is no way >> to guarantee that that the ns won't be assigned as current_path >> again (because it is in head->list). > ok, I see. >> >> nvme_ns_remove fences continue of deletion of the ns by synchronizing >> the srcu such that for sure the current_path clearance is visible. > The list will be like this: > head->next = ns1; > ns1->next = head; > old->next = ns1; > This may cause infinite loop in nvme_round_robin_path. > for (ns = nvme_next_ns(head, old); >     ns != old; >     ns = nvme_next_ns(head, ns)) > The ns will always be ns1, and then infinite loop. Who is being removed? I'm not following