Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp822450rwn; Thu, 8 Sep 2022 09:12:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4de4Hv2KIfHY8zg1SlaL0m7L80hvbm4codXRf+fPapKpVNiuM+iSmSytxN9y/mW4wOdtV0 X-Received: by 2002:a17:902:7295:b0:176:a0d8:77e3 with SMTP id d21-20020a170902729500b00176a0d877e3mr9387337pll.0.1662653560482; Thu, 08 Sep 2022 09:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662653560; cv=none; d=google.com; s=arc-20160816; b=Vlo3+uSYp+s3ApSpnZfqWym8oVrpFaHT9pF5HXBk9d+6Swc62KCrgTGPRRbLD+xTpw QJ0ovNJtoWpKaHcWhxplp+AgX6oEw+isUcU2p7+8W3w8xmUAF+4LXyRDFdW6ZbiOwUzf MgHrrFI9CV9CDKC6AKlJFEfPeXVRprlvShKj6Z45FBbYjzESKTKK0LyeZOyc9DeUD9Ss RCer1UsPESLYzyWPLYAR7s0W+J9WUr8mayLZaYT3TR+aTiD71E7xLPaf0Bc+b34RiBxj LDB6wtJMdLZa+8F4Mj/lTb9TX6pb23D0q+0nc7dsm825H4sPDMXo3QyEChI0b57oCTUb Gcmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:from:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date :dkim-signature:dkim-filter; bh=sPrAgdJX/q6EPBO2qqBP69N9j1vf1VR/MgW4Fcb+O80=; b=MIXg5DdUnUebFmHO25m8mj/2emWpKl9v2qW23b/2aryrL7LyYu1x5IzxEkdU+W5Kh1 2ZAryTyuip9d6/4PC+tMjru4/FfFCxQOel+h933z8ourNl8SVK/6khtxcVp1+pbF4lYv vwZGKAxXNR1OMAMLbZgXAh7T76xji7GQ+bI7CzI1wePXdY1Bt/QWthUJYNhzar3Jd0F2 PHoJqDoX2+YU9033Vi64+9mpyy4fYNenT56tLe2pu2rUDhVZC3ddG2SNuFK9b+o3S2Rx ESPNOHdoGg9k1wMEuVFnp4juK9pgivh1tS5xvsd5hJpVGw6u8pHcfqF4U4e/OUVhiuTb OvAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=AwpzjVlt; 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=fieldses.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mj13-20020a17090b368d00b0020255f17d67si1559899pjb.111.2022.09.08.09.12.26; Thu, 08 Sep 2022 09:12:40 -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=@fieldses.org header.s=default header.b=AwpzjVlt; 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=fieldses.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbiIHP4J (ORCPT + 99 others); Thu, 8 Sep 2022 11:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbiIHP4H (ORCPT ); Thu, 8 Sep 2022 11:56:07 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BDAA1A71; Thu, 8 Sep 2022 08:56:06 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id CBA903EEF; Thu, 8 Sep 2022 11:56:05 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org CBA903EEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1662652565; bh=sPrAgdJX/q6EPBO2qqBP69N9j1vf1VR/MgW4Fcb+O80=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=AwpzjVltzywkpEXr4PN6NWE/dgdI2qC/OnK7L7ljvcJw0wzREps62fnsAef0pxMUW 3S8LeaxRX1ewqRnanflKJAute+rTdKFqsYg7hrFy7Qg809hVIX3SHH4EifOU/BeuwO ib4rs3NaLsFlpOChNwZWQ5VTy4YDGFOaregMnz6M= Date: Thu, 8 Sep 2022 11:56:05 -0400 To: Jeff Layton Cc: Theodore Ts'o , Jan Kara , NeilBrown , adilger.kernel@dilger.ca, djwong@kernel.org, david@fromorbit.com, trondmy@hammerspace.com, viro@zeniv.linux.org.uk, zohar@linux.ibm.com, xiubli@redhat.com, chuck.lever@oracle.com, lczerner@redhat.com, brauner@kernel.org, fweimer@redhat.com, linux-man@vger.kernel.org, linux-api@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [man-pages RFC PATCH v4] statx, inode: document the new STATX_INO_VERSION field Message-ID: <20220908155605.GD8951@fieldses.org> References: <20220907111606.18831-1-jlayton@kernel.org> <166255065346.30452.6121947305075322036@noble.neil.brown.name> <79aaf122743a295ddab9525d9847ac767a3942aa.camel@kernel.org> <20220907125211.GB17729@fieldses.org> <771650a814ab1ff4dc5473d679936b747d9b6cf5.camel@kernel.org> <20220907135153.qvgibskeuz427abw@quack3> <166259786233.30452.5417306132987966849@noble.neil.brown.name> <20220908083326.3xsanzk7hy3ff4qs@quack3> <02928a8c5718590bea5739b13d6b6ebe66cac577.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02928a8c5718590bea5739b13d6b6ebe66cac577.camel@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Thu, Sep 08, 2022 at 11:44:33AM -0400, Jeff Layton wrote: > On Thu, 2022-09-08 at 11:21 -0400, Theodore Ts'o wrote: > > On Thu, Sep 08, 2022 at 10:33:26AM +0200, Jan Kara wrote: > > > It boils down to the fact that we don't want to call mark_inode_dirty() > > > from IOCB_NOWAIT path because for lots of filesystems that means journal > > > operation and there are high chances that may block. > > > > > > Presumably we could treat inode dirtying after i_version change similarly > > > to how we handle timestamp updates with lazytime mount option (i.e., not > > > dirty the inode immediately but only with a delay) but then the time window > > > for i_version inconsistencies due to a crash would be much larger. > > > > Perhaps this is a radical suggestion, but there seems to be a lot of > > the problems which are due to the concern "what if the file system > > crashes" (and so we need to worry about making sure that any > > increments to i_version MUST be persisted after it is incremented). > > > > Well, if we assume that unclean shutdowns are rare, then perhaps we > > shouldn't be optimizing for that case. So.... what if a file system > > had a counter which got incremented each time its journal is replayed > > representing an unclean shutdown. That shouldn't happen often, but if > > it does, there might be any number of i_version updates that may have > > gotten lost. So in that case, the NFS client should invalidate all of > > its caches. > > > > If the i_version field was large enough, we could just prefix the > > "unclean shutdown counter" with the existing i_version number when it > > is sent over the NFS protocol to the client. But if that field is too > > small, and if (as I understand things) NFS just needs to know when > > i_version is different, we could just simply hash the "unclean > > shtudown counter" with the inode's "i_version counter", and let that > > be the version which is sent from the NFS client to the server. > > > > If we could do that, then it doesn't become critical that every single > > i_version bump has to be persisted to disk, and we could treat it like > > a lazytime update; it's guaranteed to updated when we do an clean > > unmount of the file system (and when the file system is frozen), but > > on a crash, there is no guaranteee that all i_version bumps will be > > persisted, but we do have this "unclean shutdown" counter to deal with > > that case. > > > > Would this make life easier for folks? > > > > - Ted > > Thanks for chiming in, Ted. That's part of the problem, but we're > actually not too worried about that case: > > nfsd mixes the ctime in with i_version, so you'd have to crash+clock > jump backward by juuuust enough to allow you to get the i_version and > ctime into a state it was before the crash, but with different data. > We're assuming that that is difficult to achieve in practice. But a change in the clock could still cause our returned change attribute to go backwards (even without a crash). Not sure how to evaluate the risk, but it was enough that Trond hasn't been comfortable with nfsd advertising NFS4_CHANGE_TYPE_IS_MONOTONIC. Ted's idea would be sufficient to allow us to turn that flag on, which I think allows some client-side optimizations. > The issue with a reboot counter (or similar) is that on an unclean crash > the NFS client would end up invalidating every inode in the cache, as > all of the i_versions would change. That's probably excessive. But if we use the crash counter on write instead of read, we don't invalidate caches unnecessarily. And I think the monotonicity would still be close enough for our purposes? > The bigger issue (at the moment) is atomicity: when we fetch an > i_version, the natural inclination is to associate that with the state > of the inode at some point in time, so we need this to be updated > atomically with certain other attributes of the inode. That's the part > I'm trying to sort through at the moment. That may be, but I still suspect the crash counter would help. --b.