Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2616163rdb; Mon, 4 Dec 2023 02:41:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgZQ9dA5gMMu5dkRg2vLKBwxIXeTxxy6dlWFMoGBH1oIJpI7tHgUTQxsGqi6vMBgvHwApk X-Received: by 2002:a17:902:a503:b0:1d0:6ffd:6109 with SMTP id s3-20020a170902a50300b001d06ffd6109mr3462143plq.43.1701686511676; Mon, 04 Dec 2023 02:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701686511; cv=none; d=google.com; s=arc-20160816; b=PgGwLsLr0m+ltCHnxmzZGoI1BftzemiA0y41UJIalMFSvFJlQh7ATsP8ToOt54D8OK xd72OObiQdkwi+JRxYXujLDsoNxLRa+f3fPsoIuc+oyiL0S/0g26qiLUz/odYxZmMNOs 4V1ngORZrXfXLeH4HOxIgFCgrh02v/AOMLmbl5tUhHkeSDV9gTat6T/UXFxcNi5td1Ev jRaXg78sHUkqOgO3wgVrLVRqGNcUzgBCsrmeMYJMLkXUkHc+NUhNPaaJ/p+Rh5Ahbj1O rGnJ8rTucIaJKQ4gvLFHZEr8326tzFD1dhOWq0w1jAv3pc7UHLIVG1VKaXqM/j0cEWhr 67ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=8VPDwl0vy+BhYy6g17v5zjugi2q1o+523xZfGYoBFyU=; fh=nSCzKvsa90bG3HeShqHGs8t52x6XNgtEbzxJD3ldu4k=; b=B6HkQ8Q9vGPmJ2xJwsGxtA5z0yIQZIilQNybGKRLWZYNm+EZde7wrmQLIXZoh+2xYm HYmjoK7mdyW1vo1yR8h/vzdWyanvd3liq9BAuDo+gnOToil/X9Yk9gVxl071lH8EF/Mu gytQYd35Vrq3pdnXMb+Tdjft9OiLAqmoHLgCvdUHFBhXfq8yIFbU7FyyMxz9swZe+9bz oLRMnsxK/HrCj+L6vSGN2Hvv4AMZ3cnnX4u6NbkV0AOTLNOPZVMZhwmilPte/lqnKzxk naiTKVG1gqOk3tr1x1U8XFLEPJdCyxV9+VgYhoL1sGGGSHhxQuuH39QGxfog3NmrJ3tr jWPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p24-20020a170902b09800b001d005beb114si7491806plr.193.2023.12.04.02.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 02:41:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4F85F80A056C; Mon, 4 Dec 2023 02:41:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232986AbjLDKlg (ORCPT + 99 others); Mon, 4 Dec 2023 05:41:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjLDKlf (ORCPT ); Mon, 4 Dec 2023 05:41:35 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B46E4E6 for ; Mon, 4 Dec 2023 02:41:41 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 481AC1F8A8; Mon, 4 Dec 2023 10:41:40 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 363D8139E2; Mon, 4 Dec 2023 10:41:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id Iv7CC+SsbWUhRQAAn2gu4w (envelope-from ); Mon, 04 Dec 2023 10:41:40 +0000 Date: Mon, 4 Dec 2023 11:41:39 +0100 From: Daniel Wagner To: Christoph Hellwig Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch , Sagi Grimberg , Hannes Reinecke Subject: Re: [RFC v2 2/3] nvme: move ns id info to struct nvme_ns_head Message-ID: <27uglzkgku6qeaaodmyb3sudajrkibjiapsg4hjuxy57hohauv@hnpb5zbedyrv> References: <20231201092735.28592-1-dwagner@suse.de> <20231201092735.28592-3-dwagner@suse.de> <20231204075134.GB29377@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231204075134.GB29377@lst.de> X-Spamd-Bar: +++++++++ Authentication-Results: smtp-out2.suse.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=suse.de (policy=none); spf=softfail (smtp-out2.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of dwagner@suse.de) smtp.mailfrom=dwagner@suse.de X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [9.94 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; R_SPF_SOFTFAIL(4.60)[~all:c]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[]; NEURAL_SPAM_LONG(2.65)[0.757]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(2.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[suse.de : No valid SPF, No valid DKIM,none] X-Spam-Score: 9.94 X-Rspamd-Queue-Id: 481AC1F8A8 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 02:41:50 -0800 (PST) On Mon, Dec 04, 2023 at 08:51:34AM +0100, Christoph Hellwig wrote: > > +static void nvme_set_ref_tag(struct nvme_ns_head *head, struct nvme_command *cmnd, > > .. and here. I'm going to stop now, please also fix up all other > places. Sure, I'll update the patch accordingly. > > void nvme_failover_req(struct request *req) > > { > > - struct nvme_ns *ns = req->q->queuedata; > > + struct nvme_ns_head *head = req->q->queuedata; > > + struct nvme_ctrl *ctrl = nvme_req(req)->ctrl; > > + struct nvme_ns *ns; > > u16 status = nvme_req(req)->status & 0x7ff; > > unsigned long flags; > > struct bio *bio; > > > > - nvme_mpath_clear_current_path(ns); > > + nvme_mpath_clear_current_path(head); > > > > /* > > * If we got back an ANA error, we know the controller is alive but not > > * ready to serve this namespace. Kick of a re-read of the ANA > > * information page, and just try any other available path for now. > > */ > > - if (nvme_is_ana_error(status) && ns->ctrl->ana_log_buf) { > > + if (nvme_is_ana_error(status) && ctrl->ana_log_buf) { > > + ns = nvme_find_get_ns(ctrl, head->ns_id); > > This looks unrelated. The problem I try to address here is, that we need the ns pointer to access the ns->flags for ANA state. Given that nvme_mpath_clear_current_path really wants the ns pointer as well, we need something like this at the beginning of this function. As I said, I didn't find any other way to get get from the head pointer to the ns pointer and this function is the only place where this is actually necessary to do (avoiding the list scan in nvme_find_get_ns). > > > -bool nvme_mpath_clear_current_path(struct nvme_ns *ns) > > +bool nvme_mpath_clear_current_path(struct nvme_ns_head *head) > > { > > - struct nvme_ns_head *head = ns->head; > > bool changed = false; > > int node; > > > > @@ -181,7 +183,7 @@ bool nvme_mpath_clear_current_path(struct nvme_ns *ns) > > goto out; > > > > for_each_node(node) { > > - if (ns == rcu_access_pointer(head->current_path[node])) { > > + if (head == rcu_access_pointer(head->current_path[node])->head) { > > and this can't work. We need to check the actual ns for the path > selection, as that's kindof the point. Okay, makes sense. I'll drop this. Thanks, Daniel