Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp923220rwb; Tue, 27 Sep 2022 06:23:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ldl5S9SNmOHiIt/Jgn4FnzSAmgfYMxFwjiX4HHXBlQWDLc8jvp5L6wqIPo9TptRCi4/+Z X-Received: by 2002:a17:90b:1b4c:b0:202:c1a3:25ce with SMTP id nv12-20020a17090b1b4c00b00202c1a325cemr4747297pjb.232.1664285030287; Tue, 27 Sep 2022 06:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664285030; cv=none; d=google.com; s=arc-20160816; b=KVwPDR3bvqGqq/pcdHqBVs6dI9KFy4UyjQAomKHO+oGms0UUgLOM+78eZz3nAVWRV/ TMlBWER3K4PAa305QzSY8BPHyitv0JPESdV4bAt/wPox+EGDU++0KxAMb7vIfXmFz5Y6 qQBRq4kQ1V6mXtD/rxIXbPDNzASuWqUJlEfgQzyUshNzkRzzBbQVgqJeFKccve4zt36e VhpKC9oHlvHOIXmb8/reCXJL5KFW9p3VcLGx7bbFdtdfno0/HX9HMUcYMKZ8sBhCBYD6 M9WfKZme1hwRys7RXXP5p2JNF/vuqch4eAHF7bD2PCcdKGS02r+Q2vWAsWGN3MIxmDqr IzBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=kyrk84LPNiRnKf1ct63EshWZKPkuf+TJyX7nxmtqlTQ=; b=b7hizFliAeZOkGWB/oGdY5C2gjIrgVKPhjMFa6AlaiYPHHCxtp2oB/eSUXQiGrwYbG 1ZTU9bcHgjqXk66PdvmwgSQucNB8gi0XHXWKmfaRn+qqv2dCrfU17QeWZvu+OXruf1AD WjvGI7mmW4A/0pYNu99inWDrGopW3O4X6cvzo6sj2Z1ad8puIewdO5HveKMsV7UqkC3n etroYHi+2xCDZIx/1g5zUSz6ug01m8QRnsuGFswPwN+THDr/Q4Hggj7vSwH4QidCuf6M Dj2whObeB6Lrx5qrSzeXjd8Dt2SLI2Wxduo1Osc4Uf9NJnhR48le1Mm6yZZQ45+dXhl2 9lrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="fl/6F/Cb"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a056a0016cd00b0053e757130c3si2311130pfc.378.2022.09.27.06.23.32; Tue, 27 Sep 2022 06:23:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@kernel.org header.s=k20201202 header.b="fl/6F/Cb"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232822AbiI0NX1 (ORCPT + 99 others); Tue, 27 Sep 2022 09:23:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232882AbiI0NWu (ORCPT ); Tue, 27 Sep 2022 09:22:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767151B2D13; Tue, 27 Sep 2022 06:18:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62FDEB81BE5; Tue, 27 Sep 2022 13:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06FECC43141; Tue, 27 Sep 2022 13:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664284726; bh=75r45GYNmdQ6TGZtVM1PaqeQt62nqyjqpVvH5ey6w3w=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fl/6F/CbEzRJTGc0S8S+u4io0/U1Y20LUrcV8EI3ai8sfiZq7a4r0+QeC02bKrgC4 7HLpeekjBIf7338lAJOzta/LOslAVVelG3jIV1Lvn6wCxaW7H+tOwrFkKYSVJIeAz8 /Dns3spD7Duj6yT0m9RoAt8Ok1gNZQmxjyeybUAIEzuijiFrg6vhwlJ5lZy6iCXJr7 XaUkai7saTAfwQ7h38pJ0iO5LTsAKKJO2EcfaHan35eEHdu3BlHxlrm+iLEsC8YZtA wYCyXxLU7CInTWkFKw/JgXdTP65K/aQBbe0kZCxmfO6ZROiBEORjT7PgdJKddfO079 J+SzYeeiBsV9Q== Message-ID: <6012013b1fd92e5dad7927d8133d5d5b3cd76e3f.camel@kernel.org> Subject: Re: [man-pages RFC PATCH v4] statx, inode: document the new STATX_INO_VERSION field From: Jeff Layton To: NeilBrown Cc: Trond Myklebust , "jack@suse.cz" , "zohar@linux.ibm.com" , "djwong@kernel.org" , "brauner@kernel.org" , "linux-xfs@vger.kernel.org" , "bfields@fieldses.org" , "linux-api@vger.kernel.org" , "david@fromorbit.com" , "fweimer@redhat.com" , "linux-kernel@vger.kernel.org" , "chuck.lever@oracle.com" , "linux-man@vger.kernel.org" , "linux-nfs@vger.kernel.org" , "linux-ext4@vger.kernel.org" , "tytso@mit.edu" , "viro@zeniv.linux.org.uk" , "xiubli@redhat.com" , "linux-fsdevel@vger.kernel.org" , "adilger.kernel@dilger.ca" , "lczerner@redhat.com" , "ceph-devel@vger.kernel.org" , "linux-btrfs@vger.kernel.org" Date: Tue, 27 Sep 2022 09:18:42 -0400 In-Reply-To: <166423223623.17572.7229091435446226718@noble.neil.brown.name> References: <24005713ad25370d64ab5bd0db0b2e4fcb902c1c.camel@kernel.org> , <20220918235344.GH3600936@dread.disaster.area> , <87fb43b117472c0a4c688c37a925ac51738c8826.camel@kernel.org> , <20220920001645.GN3600936@dread.disaster.area> , <5832424c328ea427b5c6ecdaa6dd53f3b99c20a0.camel@kernel.org> , <20220921000032.GR3600936@dread.disaster.area> , <93b6d9f7cf997245bb68409eeb195f9400e55cd0.camel@kernel.org> , <20220921214124.GS3600936@dread.disaster.area> , , <1ef261e3ff1fa7fcd0d75ed755931aacb8062de2.camel@kernel.org> , <20220923095653.5c63i2jgv52j3zqp@quack3> , <2d41c08e1fd96d55c794c3b4cd43a51a0494bfcf.camel@hammerspace.com> , <166423223623.17572.7229091435446226718@noble.neil.brown.name> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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-ext4@vger.kernel.org On Tue, 2022-09-27 at 08:43 +1000, NeilBrown wrote: > On Fri, 23 Sep 2022, Jeff Layton wrote: > >=20 > > Absolutely. That is the downside of this approach, but the priority her= e > > has always been to improve nfsd. If we don't get the ability to present > > this info via statx, then so be it. Later on, I suppose we can move tha= t > > handling into the kernel in some fashion if we decide it's worthwhile. > >=20 > > That said, not having this in statx makes it more difficult to test > > i_version behavior. Maybe we can add a generic ioctl for that in the > > interim? >=20 > I wonder if we are over-thinking this, trying too hard, making "perfect" > the enemy of "good". > While we agree that the current implementation of i_version is > imperfect, it isn't causing major data corruption all around the world. > I don't think there are even any known bug reports are there? > So while we do want to fix it as best we can, we don't need to make that > the first priority. >=20 > I think the first priority should be to document how we want it to work, > which is what this thread is really all about. The documentation can > note that some (all) filesystems do not provide perfect semantics across > unclean restarts, and can list any other anomalies that we are aware of. > And on that basis we can export the current i_version to user-space via > statx and start trying to write some test code. >=20 > We can then look at moving the i_version/ctime update from *before* the > write to *after* the write, and any other improvements that can be > achieved easily in common code. We can then update the man page to say > "since Linux 6.42, this list of anomalies is no longer present". >=20 > Then we can explore some options for handling unclean restart - in a > context where we can write tests and maybe even demonstrate a concrete > problem before we start trying to fix it. >=20 We can also argue that crash resilience isn't a hard requirement for all possible applications. We'll definitely need some sort of mitigation for nfsd so we can claim that it's MONOTONIC [1], but local applications may not care whether the value rolls backward after a crash, since they would have presumably crashed as well and may not be persisting values. IOW, I think I agree with Dave C. that crash resilience for regular files is best handled at the application level (with the first application being knfsd). RFC 7862 requires that the change_attr_type be homogeneous across the entire filesystem, so we don't have the option of deciding that on a per-inode basis. If we want to advertise it, we have ensure that all inode types conform. I think for nfsd, a crash counter tracked in userland by nfsdcld multiplied by some large number of reasonable version bumps in a jiffy would work well and allow us to go back to advertising the value as MONOTONIC.=A0That's a bit of a project though and may take a while. For presentation via statx, maybe we can create a STATX_ATTR_VERSION_MONOTONIC bit for stx_attributes for when the filesystem can provide that sort of guarantee. I may just add that internally for now anyway, since that would make for nicer layering. [1]: https://datatracker.ietf.org/doc/html/rfc7862#section-12.2.3 --=20 Jeff Layton