Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp588295rdg; Tue, 10 Oct 2023 22:16:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGu8rXOkC/mkcDLufXlG8OPuraZcDc23yFFAOVAWz3be1gxfRKZesJUSJ63MIt9SeJ97J7U X-Received: by 2002:a05:6e02:152f:b0:357:43ec:c00e with SMTP id i15-20020a056e02152f00b0035743ecc00emr3696692ilu.14.1697001389891; Tue, 10 Oct 2023 22:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697001389; cv=none; d=google.com; s=arc-20160816; b=r2rJ/3lkrEt462NNO3trQOh1iGSMABBDrBcMoyABRxXK1Ai6ZGcYQMIjIjUwV+3CnB Y7XKevl9ruHPNhuD8RmkVzKmX+z+Y6qMLG5AR/G1EyD9Eja8n7V2mFvHdhqYAfAMIhIK IHxDfnWHromkTcm4iCMmZ5BlbBpjUgmHvRPbve+PUcal2tWySPrXGesjDY+kdQgBTaXc VGK+9AxS/YhUAEquBOeDke8wdmdgIP+zJceXEMPMC/Rw9gx5SsLp0aEcrXyDMdLZIJiV 0YkM4kzELnlHM+UP/jiipUfVm7Q9ZnLERSRldgER/bAmdJyMXJRetIUwk/tXZlhD7ybm FluA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=Cp8y+48CpcA8VGo+HHNY1HR+kEbRsXE0VzkyNJUs+yI=; fh=a34eu72gbxH/s+HaSzGGNYvG7vjnazyS57/a3xcYRNU=; b=lAP2ZbBUKBmdkspPxQzo5TXz2TIr7h5Zt32hObE1gRk/jZx66PiqJunISVTrBXlIUT nhMj7pszol5av3cJs+6IVYrgJpX1oyX55Tr/WvgFdAaTY2FNcgzwDA/VdVBA8x7Uaahk R/m33alrMJ2hCRbgU/lAxbXZifdUUe/QMc2qwWoFOJ7qpBwuhFv3aSpSPzGJfK2hGjNU lGHYQ0gGs5klHTo0HnVjW5NL3BnlbkoMDEiImrhVBD1pREd/9Tq7TwPza+qdtH/klZBE U36YHuHtfvKfh4DDH5g7wvOKOr7HejCAbn+I3B8ijTZa+A7Re99SPoBT5Y2F8zWzNe8c LReQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=rbVDH1Ud; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z14-20020a63190e000000b0057828b85afdsi13184217pgl.795.2023.10.10.22.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 22:16:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=rbVDH1Ud; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (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 lipwig.vger.email (Postfix) with ESMTP id 87DD0806E3E7; Tue, 10 Oct 2023 22:16:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbjJKFQZ (ORCPT + 99 others); Wed, 11 Oct 2023 01:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjJKFQY (ORCPT ); Wed, 11 Oct 2023 01:16:24 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2069E for ; Tue, 10 Oct 2023 22:16:21 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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-out2.suse.de (Postfix) with ESMTPS id 598B31F8D9; Wed, 11 Oct 2023 05:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697001380; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cp8y+48CpcA8VGo+HHNY1HR+kEbRsXE0VzkyNJUs+yI=; b=rbVDH1UdqveAwJ1XvCftRc8J0vZ1pz67ssOTIqxw7gp9tzwVpsVs4ApRebX3By0uvb5Yq3 TBEMpQbN7To5sVUOsHK4iZbkhW/rbNYcAvlrkO6d8yi9Asco6GVqGOWOvLmiFVOGWQuCwJ EhM8nF9aejo/4Jvb3sqTcr3dpNCIymY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697001380; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cp8y+48CpcA8VGo+HHNY1HR+kEbRsXE0VzkyNJUs+yI=; b=YDu01gQ6HrR6znwkyb5eB9BMWSk12L0p4U2FftZTaOuV3IQJznigJR7DN61Co0p1wEXhEE AhP9dcLwfJuBobDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1814313586; Wed, 11 Oct 2023 05:16:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0y8yL6IvJmWGQgAAMHmgww (envelope-from ); Wed, 11 Oct 2023 05:16:18 +0000 From: NeilBrown To: Steve Dickson Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH 3/3 RFC] export: nfsd_fh - always an answer to a well-formed question. Date: Wed, 11 Oct 2023 15:58:02 +1100 Message-ID: <20231011051131.24667-4-neilb@suse.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231011051131.24667-1-neilb@suse.de> References: <20231011051131.24667-1-neilb@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 10 Oct 2023 22:16:27 -0700 (PDT) X-Spam-Level: ** When the kernel asks mountd for some information it is important that mountd reply as the kernel will not ask again. When we don't have a useful reply we want the kernel to see this as a transient failure. This not currently (v6.6) any way to communicate a transient failure. The best we can do is give a negative answer which is already expired. This will at least allow the kernel to ask again. The kernel needs to be enhanced to not treat an entry that is already expired as ever reliable. Signed-off-by: NeilBrown --- support/export/cache.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/support/export/cache.c b/support/export/cache.c index 5307f6c8d872..74cacea9f0cc 100644 --- a/support/export/cache.c +++ b/support/export/cache.c @@ -894,7 +894,7 @@ static void nfsd_fh(int f) * quiet rather than returning stale yet */ if (dev_missing) - goto out; + goto out_delay; } else if (found->e_mountpoint && !is_mountpoint(found->e_mountpoint[0]? found->e_mountpoint: @@ -904,8 +904,7 @@ static void nfsd_fh(int f) xlog(L_WARNING, "%s not exported as %d not a mountpoint", found->e_path, found->e_mountpoint); */ - /* FIXME we need to make sure we re-visit this later */ - goto out; + goto out_delay; } bp = buf; blen = sizeof(buf); @@ -934,6 +933,26 @@ out: nfs_freeaddrinfo(ai); free(dom); xlog(D_CALL, "nfsd_fh: found %p path %s", found, found ? found->e_path : NULL); + return; + +out_delay: + /* We don't have a definitely answer to give the kernel - maybe we will later. + * This could be because an export marked "mountpoint" isn't a mountpoint, or + * because a mountpoint fails with a strange error like ETIMEDOUT as is possible + * with an NFS mount marked "softerr" which is being re-exported. + * If we tell the kernel nothing, it will never ask again, so we have + * to give some answer. A negative answer that has already expired + * is the best we can do. + */ + bp = buf; blen = sizeof(buf); + qword_add(&bp, &blen, dom); + qword_addint(&bp, &blen, fsidtype); + qword_addhex(&bp, &blen, fsid, fsidlen); + qword_addint(&bp, &blen, time(NULL) - 1); + qword_addeol(&bp, &blen); + if (blen <= 0 || cache_write(f, buf, bp - buf) != bp - buf) + xlog(L_ERROR, "nfsd_fh: error writing reply"); + xlog(D_AUTH, "unknown access to %s", *dom == '$' ? dom+1 : dom); } #ifdef HAVE_JUNCTION_SUPPORT -- 2.42.0