Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10278336rwl; Sun, 1 Jan 2023 22:50:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXuf8Yp2Vo55nsYLy9ubWOl6wEcggW8p7RQ7D3xG/VfkpDAoCj1JXMvyV82To5m2cJIpXF+Q X-Received: by 2002:a62:79c9:0:b0:581:3e4e:a08f with SMTP id u192-20020a6279c9000000b005813e4ea08fmr27939828pfc.11.1672642232129; Sun, 01 Jan 2023 22:50:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672642232; cv=none; d=google.com; s=arc-20160816; b=u38WYMWAkwT7K9K0EBMKbRF3FYtLzSZd5Pc/BZ3WbYe1wiAwlm6hefwMORHNoBtAXe nqa/kaQx3AEe67SRjBDuURAbeO9pDvp7Sc32v+Nl1fSKnklOwVO9lIS4neZ7RVeWGeNQ lkyEKPmsD9NSCVw1f+mvdOHUCbo5m1QXakimbv1kSg4kfY3vrfdPJwcb45K257nMuv4R e2jzRzEMWSZEkrXEL17N9+y4vGtYXg2uyi4ag63BSXzdXJyz8LCkSNZqW+VewNuzW0mC 1+8WNFfTEoPawXdCdyOEsRcQhmsbqHRPZgDxSCGHFruhoN8x2utEh8DIT/mo0izAnMg7 ElKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=2K/vdmP3tdzLm99zVd7TyRf64wKLxBJvBdRtnMOSevg=; b=BlEFS6+DothTdPBdxo8O9f+pAGPVYfR+3EVaH0F5Mr7HUUjl3nqj7QlDBdo+9JzIVo QO6YHLGEjGfGiiFxGylsjshHjvCdthTAkKIT8/VhvLoGxGRxCdRYTISfbKYrZViaLDc5 s2i+iat4+N9psnJ+RuMUEo5dD9qLYedHYL175bHYv90QNQNhjxSbpW89ssRgnFVMJ7wm O1E0BJLBP/us4aV/tWbvOs1QW3skUVLUIMj/SZbX4aCAFTQfOAMIb0wB6U0nnfYqRsCg igMh9V/YXhGkrdNTVH/muEd8xpH6FNAoSDWU1zuH1o+Ykub5Ecicnmvoa0of6wQnyp+n TwWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm1 header.b=L7WLSs5Z; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=WMOKJ14S; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a056a00249600b005752602f950si30871886pfv.208.2023.01.01.22.50.18; Sun, 01 Jan 2023 22:50:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@themaw.net header.s=fm1 header.b=L7WLSs5Z; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=WMOKJ14S; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229453AbjABGl4 (ORCPT + 99 others); Mon, 2 Jan 2023 01:41:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbjABGlz (ORCPT ); Mon, 2 Jan 2023 01:41:55 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADAAD79 for ; Sun, 1 Jan 2023 22:41:53 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E70345C0124; Mon, 2 Jan 2023 01:41:52 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 02 Jan 2023 01:41:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1672641712; x= 1672728112; bh=2K/vdmP3tdzLm99zVd7TyRf64wKLxBJvBdRtnMOSevg=; b=L 7WLSs5ZM7G8LrUWENS72dWC87ZVdKMK8Dyz2vvAYX1WYWs+ef7H3dX4FkDz0Vh5M q3iq2ZopUf9YAZLA+JvvxWEKtBDIC2Klx8WE7XHVA5pdnGxil6onPMS8YZTqxMdK h1viLvE7vn6Y4XE2uy+C7/UbDCzZ4PPF8cpqOqg+4qPd5nS65KmywvAJz1xdRvlN kGcl85xSHO+zU+lBI22PNQh6pL+47YTkPycrk/KMX4G1/dEFUvaBJheT4PsNtwp7 iAK9CWRzzv8jrQ6ziyazDmsBdozch1AqSoCbngAejk3Bpg7GuCCqfYPNTB9e2IBN /7BgAychozM1g1UkjU2Jw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1672641712; x= 1672728112; bh=2K/vdmP3tdzLm99zVd7TyRf64wKLxBJvBdRtnMOSevg=; b=W MOKJ14Sj00FY0u62ztqH8d90MrdQNOem1yZNGAgKlb9IwZc1LHQ/50aW3hlHULDS +Yg7sq2lrQ1rg33GeXI4AtB9l9BHRQbfRmGauwTs0gu+1gSGi7JpxXLWpdMI0cSz a8vQXtO3ym9vAlOTP1rMGXNrCynXD8k54oeJTIJ06cjFPMmZ3SBuDejY+OAXP/CU UdfdOtt72dKlJ3/mhhe8QKMM8fChBh71L3HBjaq/B5JsuUU24ic4ZarudSzlJjb4 Ck0z4nFc7G94cYt8X4ccKV2POZXOGMnrfKCJT+Nwi6TyWZ/1uy7CvMgX8EZIPGoz a4HB5+qPVMwD5KwtnnRMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjedugdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucggtffrrghtthgvrhhnpe euhfeuieeijeeuveekgfeitdethefguddtleffhfelfeelhfduuedvfefhgefhheenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnse hthhgvmhgrfidrnhgvth X-ME-Proxy: Feedback-ID: i31e841b0:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Jan 2023 01:41:49 -0500 (EST) Message-ID: Date: Mon, 2 Jan 2023 14:41:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] nfsd: fix handling of readdir in v4root vs. mount upcall timeout Content-Language: en-US To: Jeff Layton , Chuck Lever III Cc: Linux NFS Mailing List , Steve Dickson , JianHong Yin , Richard Weinberger References: <20221213180826.216690-1-jlayton@kernel.org> <0918676C-124C-417F-B8DE-DA1946EE91CC@oracle.com> <988799bd54c391259cfeff002660a4002adb96d2.camel@kernel.org> <81f891ef-b498-24b0-12e3-4ddda8062dc0@themaw.net> <0d6deecbe0dff95ebbe061914ddb00ca04d1f3c1.camel@kernel.org> <4fbce57518a3870e82411b31e026ffdd8ea1c98d.camel@kernel.org> From: Ian Kent In-Reply-To: <4fbce57518a3870e82411b31e026ffdd8ea1c98d.camel@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE 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-nfs@vger.kernel.org On 2/1/23 05:16, Jeff Layton wrote: > On Wed, 2022-12-14 at 13:37 +0800, Ian Kent wrote: >> On 14/12/22 08:39, Jeff Layton wrote: >>> On Wed, 2022-12-14 at 07:14 +0800, Ian Kent wrote: >>>> On 14/12/22 04:02, Jeff Layton wrote: >>>>> On Tue, 2022-12-13 at 19:00 +0000, Chuck Lever III wrote: >>>>>>> On Dec 13, 2022, at 1:08 PM, Jeff Layton wrote: >>>>>>> >>>>>>> If v4 READDIR operation hits a mountpoint and gets back an error, >>>>>>> then it will include that entry in the reply and set RDATTR_ERROR for it >>>>>>> to the error. >>>>>>> >>>>>>> That's fine for "normal" exported filesystems, but on the v4root, we >>>>>>> need to be more careful to only expose the existence of dentries that >>>>>>> lead to exports. >>>>>>> >>>>>>> If the mountd upcall times out while checking to see whether a >>>>>>> mountpoint on the v4root is exported, then we have no recourse other >>>>>>> than to fail the whole operation. >>>>>> Thank you for chasing this down! >>>>>> >>>>>> Failing the whole READDIR when mountd times out might be a bad idea. >>>>>> If the mountd upcall times out every time, the client can't make >>>>>> any progress and will continue to emit the failing READDIR request. >>>>>> >>>>>> Would it be better to skip the unresolvable entry instead and let >>>>>> the READDIR succeed without that entry? >>>>>> >>>>> Mounting doesn't usually require working READDIR. In that situation, a >>>>> readdir() might hang (until the client kills), but a lookup of other >>>>> dentries that aren't perpetually stalled should be ok in this situation. >>>>> >>>>> If mountd is that hosed then I think it's unlikely that any progress >>>>> will be possible anyway. >>>> The READDIR shouldn't trigger a mount yes, but if it's a valid automount >>>> >>>> point (basically a valid dentry in this case I think) it should be listed. >>>> >>>> It certainly shouldn't hold up the READDIR, passing into it is when a >>>> >>>> mount should occur. >>>> >>>> >>>> That's usually the behavior we want for automounts, we don't want mount >>>> >>>> storms on directories full of automount points. >>>> >>> We only want to display it if it's a valid _exported_ mountpoint. >>> >>> The idea here is to only reveal the parts of the namespace that are >>> exported in the nfsv4 pseudoroot. The "normal" contents are not shown -- >>> only exported mountpoints and ancestor directories of those mountpoints. >>> >>> We don't want mountd triggering automounts, in general. If the >>> underlying filesystem was exported, then it should also already be >>> mounted, since nfsd doesn't currently trigger automounts in >>> follow_down(). >> Umm ... must they already be mounted? >> >> >> Can't it be a valid mount point either not yet mounted or timed out >> >> and umounted. In that case shouldn't it be listed, I know that's >> >> not the that good an outcome because its stat info will change when >> >> it gets walked into but it's usually the only sane choice. >> > Yes, it does need to already be mounted. > > The proposed kernel patches from Richard only trigger an automount if > the parent mount is exported with -o crossmnt. I think this is necessary > to avoid nfs client activity triggering automounts of filesystems that > are not exported. I'll be interested to see how this goes. Over the years I've had a lot of difficulty with automount unwanted mounting ... Still nfsd exports are a bit like invisible dentry trees to the local system aren't they ... so this situation is very different to what I've worked on ... Ian > >>> There is also a separate patchset by Richard Weinberger to allow nfsd to >>> trigger automounts if the parent filesystem is exported with -o >>> crossmnt. That should be ok with this patch, since the automount will be >>> triggered before the upcall to mountd. That should ensure that it's >>> already mounted by the time we get to upcalling for its export.