Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1629204pxb; Fri, 20 Nov 2020 14:45:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyxrndYX3YNqPES0CLu1StTjHUK1xRNwNX7te8pf0clX5vjd7cNwg6SQzQXY5Hp6B96zh8 X-Received: by 2002:a17:907:3d8b:: with SMTP id he11mr2912585ejc.207.1605912305722; Fri, 20 Nov 2020 14:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605912305; cv=none; d=google.com; s=arc-20160816; b=VXjRj6WoKLdjRgrNvEzabRSELp//t6V47C+NVu3UFKAGgdolp6P8PJilClOUBdJp+H VYu+7Eq2FcfW/ICcgRLV+sZBw1EAzCNvSMlipW+Yll1M0d+UQaSNflmNaZ/P1fha0seB UGE6uepcZgI7GoKXvHcSFvjtJRJjSD6Cfc9+5/7rGpB4h7YjKdStYDSD19ikK2sONqu4 0ugyXYw3yDXUJi0jjLUZY7NYHtjiadXw+WDecohBr0RyRM+tt0R1w9c+0iUd/2Dw+HLu XXXeSYzHLUM+y+PRcoyahqeZyiEBPq7UmEsLiQR0EObBqdDT6E1Ja0QRUxCvVrhO4dcF Hqjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=iahjJpmb2a36itD0CZCcwaZpdndHSna/vFK2IWBbsfw=; b=xF0AMOQWe+AGSpL7yZma3wM9H7H+o6RjfbMC1ejMbNrRi1LYsJspQs6YxiusR+AuhD d0iOEStivNkmEzd3GM+/a3RV0B8EY8VU4hlVEsarE592yrzegqVx3isffUIKJJbzzcFw aY3ZAWTRnLwuwYjm+dr72Yq6tan8C7x7gGDkOEI5+vxvykwCVw0Kl0MP0DjxujkCZiqo ps3lknQLobiqsyJd6+o4eoU+yjAr3CvEi22f+GncJ8vv3R2yBueInRc0mYscS0lQK4V/ Q7hRGzweijwh1KRPl7dUDu5wWcM+xzedS58kzjdh8PfWNaQX7zEvtqPLxPaUuH+denzT +BQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=iaWJ1kSw; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 p19si2473144ejw.28.2020.11.20.14.44.42; Fri, 20 Nov 2020 14:45:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=iaWJ1kSw; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728730AbgKTWoj (ORCPT + 99 others); Fri, 20 Nov 2020 17:44:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728698AbgKTWoj (ORCPT ); Fri, 20 Nov 2020 17:44:39 -0500 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E23EEC0613CF for ; Fri, 20 Nov 2020 14:44:38 -0800 (PST) Received: by fieldses.org (Postfix, from userid 2815) id 44A836E9D; Fri, 20 Nov 2020 17:44:38 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 44A836E9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1605912278; bh=iahjJpmb2a36itD0CZCcwaZpdndHSna/vFK2IWBbsfw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iaWJ1kSw/lP0zRUiO2skY2hvsXh6ZaOBzCpPCeTkI0eaKPqWEDRv+ddCosr15N4MF GEiCgPCTOn40PGte7q54BBsVWoW5zKv1g+7FKcjvqO7xiuF/tWk62PJjVtJ3e53M1j G25lxBgBIFGmaevV+ZMVZnwUIu6wtiKnjCD+/qUE= Date: Fri, 20 Nov 2020 17:44:38 -0500 From: "J. Bruce Fields" To: Jeff Layton Cc: "J. Bruce Fields" , Daire Byrne , Trond Myklebust , linux-cachefs , linux-nfs Subject: Re: [PATCH 2/4] nfsd: pre/post attr is using wrong change attribute Message-ID: <20201120224438.GC7705@fieldses.org> References: <20201117031601.GB10526@fieldses.org> <1605583086-19869-1-git-send-email-bfields@redhat.com> <1605583086-19869-2-git-send-email-bfields@redhat.com> <20201117152636.GC4556@fieldses.org> <725499c144317aac1a03f0334a22005588dbdefc.camel@kernel.org> <20201120223831.GB7705@fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201120223831.GB7705@fieldses.org> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Nov 20, 2020 at 05:38:31PM -0500, J. Bruce Fields wrote: > On Tue, Nov 17, 2020 at 10:34:57AM -0500, Jeff Layton wrote: > > On Tue, 2020-11-17 at 10:26 -0500, J. Bruce Fields wrote: > > > On Tue, Nov 17, 2020 at 07:34:49AM -0500, Jeff Layton wrote: > > > > I don't think I described what I was thinking well. Let me try again... > > > > > > > > There should be no need to change the code in iversion.h -- I think we > > > > can do this in a way that's confined to just nfsd/export code. > > > > > > > > What I would suggest is to have nfsd4_change_attribute call the > > > > fetch_iversion op if it exists, instead of checking IS_I_VERSION and > > > > doing the stuff in that block. If fetch_iversion is NULL, then just use > > > > the ctime. > > > > > > > > Then, you just need to make sure that the filesystems' export_ops have > > > > an appropriate fetch_iversion vector. xfs, ext4 and btrfs can just call > > > > inode_query_iversion, and NFS and Ceph can call inode_peek_iversion_raw. > > > > The rest of the filesystems can leave fetch_iversion as NULL (since we > > > > don't want to use it on them). > > > > > > Thanks for your patience, that makes sense, I'll try it. > > > > > > > There is one gotcha in here though... ext4 needs to also handle the case > > where SB_I_VERSION is not set. The simple fix might be to just have > > different export ops for ext4 based on whether it was mounted with -o > > iversion or not, but maybe there is some better way to do it? > > I was thinking ext4's export op could check for I_VERSION on its own and > vary behavior based on that. > > I'll follow up with new patches in a moment. > > I think the first one's all that's needed to fix the problem Daire > identified. I'm a little less sure of the rest. > > Lightly tested, just by running them through my usual regression tests > (which don't re-export) and then running connectathon on a 4.2 re-export > of a 4.2 mount. > > The latter triggered a crash preceded by a KASAN use-after free warning. > Looks like it might be a problem with blocking lock notifications, > probably not related to these patches. Another nit I ran across: Some NFSv4 directory-modifying operations return pre- and post- change attributes together with an "atomic" flag that's supposed to indicate whether the change attributes were read atomically with the operation. It looks like we're setting the atomic flag under the assumptions that local vfs locks are sufficient to guarantee atomicity, which isn't right when we're exporting a distributed filesystem. In the case we're reexporting NFS I guess ideal would be to use the pre- and post- attributes that the original server returned and also save having to do extra getattr calls. Not sure how we'd do that, though--more export operations? Maybe for now we could just figure out when to turn off the atomic bit. --b.