Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp384929pxt; Wed, 4 Aug 2021 13:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxltcZypjiOzZUqfGSPDRFJPhk4pAPICyJU3ks1hL0XYnW7OB0R6ytN7CJzBOGjTte/B/Ds X-Received: by 2002:a92:dac6:: with SMTP id o6mr1197476ilq.31.1628110357822; Wed, 04 Aug 2021 13:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628110357; cv=none; d=google.com; s=arc-20160816; b=sS0Vihqrm9Vc4yKLcvF5qfkMXUFwLGXkZR6SCrMByzXW4NvPtDGe2sAwHwZqr2qgw+ wdP7oHQ/ukhoRRX+isnefJtvITzaMLwsZVHeTwrh4/gtXCkW6hQR6jDGh2cywIaJ7TAs C9sIYlApA4yjmnFOf1gwYJAY6j2OK1J9INPVrKG1CvmptQ2UupDyY87IGkX7JGDSUxw/ uY038FTEAb7pqoIrf0/BnsG5Cj14r1EUUjbkfNs9CTEGXCVu7/JPlO6TNe7Wski7kGsH gQnGIO3+DncXt4Q5+evJuGtfExKjVHLJ3lKxw0wgxTgLxJcmUjZa/PFE181YSHWDe+O2 woBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QEBLsbKgSrjJ/YTMpuvuE6JQd+M98HJUIad4eASsJvU=; b=hwhdm47fUKbmBeCBj/3ZLmcxnGkiTkr4RvWvHKWEBvLUPZO6WGRGW/4rd9ABAHe/K9 7714zcZRYBwu+2eMldCO+Rz/ijzNbVKEuhPQK9x7oXXRKZbVNPqsXumicFwLiTQzKUC7 L+EpiKyoGw1ZIe6aLBcez401651v+SrenD8qjwraj55ljs5/fx+x4YM5KtPaPS/8/edt WNxNSEX+Bt79FhE6tNj8jSNCLplwaYe4Meb0dUW2CEpH7dDGrLkzifiJ/QPVEnBT15lY VgT6Ke1uxu5xUtgW2Hj551msGaTromrXN/MP796uuIXi/FgVAIV/KdG8OBnSLTU2LMxn T4Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D9BT3riZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si4258689ilu.63.2021.08.04.13.52.25; Wed, 04 Aug 2021 13:52:37 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=D9BT3riZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240304AbhHDSeK (ORCPT + 99 others); Wed, 4 Aug 2021 14:34:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21868 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240294AbhHDSeJ (ORCPT ); Wed, 4 Aug 2021 14:34:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628102036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QEBLsbKgSrjJ/YTMpuvuE6JQd+M98HJUIad4eASsJvU=; b=D9BT3riZhSyP6TvrV4rJXkQp7RbxVrs7DKiYoAM4IL/wLNazIpGe8Zne9XJ+TCnjlkluIY 8ZRB+siHXyr02azxrbB+snX+S8jyrqmmToxtRhSDmgW+EoF66dWgKp6i2fdQOSJtSyzIkP gCrHS8xrtq1QkiilLqsrTXSgKMY7uZU= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-517-g8dlXhODONiFW71eYGFTPA-1; Wed, 04 Aug 2021 14:33:55 -0400 X-MC-Unique: g8dlXhODONiFW71eYGFTPA-1 Received: by mail-ed1-f70.google.com with SMTP id c1-20020aa7df010000b02903bb5c6f746eso1881708edy.10 for ; Wed, 04 Aug 2021 11:33:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QEBLsbKgSrjJ/YTMpuvuE6JQd+M98HJUIad4eASsJvU=; b=W5m0/5KDzmcVX8YTsv/tywO+3jIx7IqZuEBqj8GhXGuxpJuQgAQsw+cDmv67RpChsf 3MOFT6wFAbINJKF+hwZc0olJHZ0l/KF/lVcukHaP1GPSrcHbrwDhZkFJI7KuVU8aoCTV OMd6rigwlDL6TVrRXw78jahsb1Hiz8IqOQzwYmZuGvSjMikBehraLufzXz6qQC8A2WaN zjt6PEctn6OeET4Ibdfwcc0Sc4VcfkzSgxGLr7dm37Gxk6/PhSKjTStau23Z9BQKVkVp zyj+w22ZsTJbXUq3CUN3X1mMpGqHQ0POcYIEHV4HpIqhN3AIKiCcDb/wJWOrPIs6KsoV sE/A== X-Gm-Message-State: AOAM532CLzteAsrcxlEjsNsmExCoNfo5Su9AthgXXCNNksOX4IS1LEAx Dnjce+L9nLqQqxki9bkURYpVw6wwZVlZ+2rLSxDxPbv0MFrsTHCiq7GWZAi9/bQDtBMS8StCuC8 rGxFjCsvAftwQE5MlpyrL+YJty7CEpvCazT6n X-Received: by 2002:a05:6402:1a35:: with SMTP id be21mr1293723edb.332.1628102032856; Wed, 04 Aug 2021 11:33:52 -0700 (PDT) X-Received: by 2002:a05:6402:1a35:: with SMTP id be21mr1293705edb.332.1628102032644; Wed, 04 Aug 2021 11:33:52 -0700 (PDT) MIME-Version: 1.0 References: <20210803203051.GA3043@fieldses.org> <3feb71ab232b26df6d63111ee8226f6bb7e8dc36.camel@hammerspace.com> <20210803213642.GA4042@fieldses.org> <61dc5d9363a42ed1a875f68a57c912c1745424d3.camel@hammerspace.com> In-Reply-To: <61dc5d9363a42ed1a875f68a57c912c1745424d3.camel@hammerspace.com> From: Matt Benjamin Date: Wed, 4 Aug 2021 14:33:43 -0400 Message-ID: Subject: Re: cto changes for v4 atomic open To: Trond Myklebust Cc: "bfields@fieldses.org" , "plambri@redhat.com" , "linux-nfs@vger.kernel.org" , "bcodding@redhat.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org That was not intended as a troll, and I don't see why you would assume that. Of course, what you're saying is correct, multiple writers are not effectively synchronized by close-to-open, and I wasn't implying they should be. Another 3rd (...) writer operating on the file is still relevant to the consumers, regardless of whether they can achieve a uniform view of the data. Matt On Tue, Aug 3, 2021 at 10:11 PM Trond Myklebust wrote: > > > > On Tue, 2021-08-03 at 21:51 -0400, Matt Benjamin wrote: > > (who have performed an open) > > > > On Tue, Aug 3, 2021 at 9:43 PM Matt Benjamin > > wrote: > > > > > > I think it is how close-to-open has been traditionally understood. > > > I > > > do not believe that close-to-open in any way implies a single > > > writer, > > > rather it sets the consistency expectation for all readers. > > > > > OK. I'll bite, despite the obvious troll-bait... > > > close-to-open implies a single writer because it is impossible to > guarantee ordering semantics in RPC. You could, in theory, do so by > serialising on the client, but none of us do that because we care about > performance. > > If you don't serialise between clients, then it is trivial (and I'm > seriously tired of people who whine about this) to reproduce reads to > file areas that have not been fully synced to the server, despite > having data on the client that is writing. i.e. the reader sees holes > that never existed on the client that wrote the data. > The reason is that the writes got re-ordered en route to the server, > and so reads to the areas that have not yet been filled are showing up > as holes. > > So, no, the close-to-open semantics definitely apply to both readers > and writers. > > > > Matt > > > > > > On Tue, Aug 3, 2021 at 5:36 PM bfields@fieldses.org > > > wrote: > > > > > > > > On Tue, Aug 03, 2021 at 09:07:11PM +0000, Trond Myklebust wrote: > > > > > On Tue, 2021-08-03 at 16:30 -0400, J. Bruce Fields wrote: > > > > > > On Fri, Jul 30, 2021 at 02:48:41PM +0000, Trond Myklebust > > > > > > wrote: > > > > > > > On Fri, 2021-07-30 at 09:25 -0400, Benjamin Coddington > > > > > > > wrote: > > > > > > > > I have some folks unhappy about behavior changes after: > > > > > > > > 479219218fbe > > > > > > > > NFS: > > > > > > > > Optimise away the close-to-open GETATTR when we have > > > > > > > > NFSv4 OPEN > > > > > > > > > > > > > > > > Before this change, a client holding a RO open would > > > > > > > > invalidate > > > > > > > > the > > > > > > > > pagecache when doing a second RW open. > > > > > > > > > > > > > > > > Now the client doesn't invalidate the pagecache, though > > > > > > > > technically > > > > > > > > it could > > > > > > > > because we see a changeattr update on the RW OPEN > > > > > > > > response. > > > > > > > > > > > > > > > > I feel this is a grey area in CTO if we're already > > > > > > > > holding an > > > > > > > > open. > > > > > > > > Do we > > > > > > > > know how the client ought to behave in this case? Should > > > > > > > > the > > > > > > > > client's open > > > > > > > > upgrade to RW invalidate the pagecache? > > > > > > > > > > > > > > > > > > > > > > It's not a "grey area in close-to-open" at all. It is very > > > > > > > cut and > > > > > > > dried. > > > > > > > > > > > > > > If you need to invalidate your page cache while the file is > > > > > > > open, > > > > > > > then > > > > > > > by definition you are in a situation where there is a write > > > > > > > by > > > > > > > another > > > > > > > client going on while you are reading. You're clearly not > > > > > > > doing > > > > > > > close- > > > > > > > to-open. > > > > > > > > > > > > Documentation is really unclear about this case. Every > > > > > > definition of > > > > > > close-to-open that I've seen says that it requires a cache > > > > > > consistency > > > > > > check on every application open. I've never seen one that > > > > > > says "on > > > > > > every open that doesn't overlap with an already-existing open > > > > > > on that > > > > > > client". > > > > > > > > > > > > They *usually* also preface that by saying that this is > > > > > > motivated by > > > > > > the > > > > > > use case where opens don't overlap. But it's never made > > > > > > clear that > > > > > > that's part of the definition. > > > > > > > > > > > > > > > > I'm not following your logic. > > > > > > > > It's just a question of what every source I can find says close- > > > > to-open > > > > means. E.g., NFS Illustrated, p. 248, "Close-to-open consistency > > > > provides a guarantee of cache consistency at the level of file > > > > opens and > > > > closes. When a file is closed by an application, the client > > > > flushes any > > > > cached changs to the server. When a file is opened, the client > > > > ignores > > > > any cache time remaining (if the file data are cached) and makes > > > > an > > > > explicit GETATTR call to the server to check the file > > > > modification > > > > time." > > > > > > > > > The close-to-open model assumes that the file is only being > > > > > modified by > > > > > one client at a time and it assumes that file contents may be > > > > > cached > > > > > while an application is holding it open. > > > > > The point checks exist in order to detect if the file is being > > > > > changed > > > > > when the file is not open. > > > > > > > > > > Linux does not have a per-application cache. It has a page > > > > > cache that > > > > > is shared among all applications. It is impossible for two > > > > > applications > > > > > to open the same file using buffered I/O, and yet see different > > > > > contents. > > > > > > > > Right, so based on the descriptions like the one above, I would > > > > have > > > > expected both applications to see new data at that point. > > > > > > > > Maybe that's not practical to implement. It'd be nice at least > > > > if that > > > > was explicit in the documentation. > > > > > > > > --b. > > > > > > > > > > > > > -- > > > > > > Matt Benjamin > > > Red Hat, Inc. > > > 315 West Huron Street, Suite 140A > > > Ann Arbor, Michigan 48103 > > > > > > http://www.redhat.com/en/technologies/storage > > > > > > tel. 734-821-5101 > > > fax. 734-769-8938 > > > cel. 734-216-5309 > > > > > > > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > > -- Matt Benjamin Red Hat, Inc. 315 West Huron Street, Suite 140A Ann Arbor, Michigan 48103 http://www.redhat.com/en/technologies/storage tel. 734-821-5101 fax. 734-769-8938 cel. 734-216-5309