Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp710903rwb; Fri, 23 Sep 2022 03:07:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Cv9z/RgdqlswwDFoMVJ2JIkNrXEFbHjETB7ZoX0a1OfNEPTuNvPBKX3boxhb7pK1V5P3e X-Received: by 2002:a17:90a:8906:b0:202:d763:72ab with SMTP id u6-20020a17090a890600b00202d76372abmr8596466pjn.56.1663927646654; Fri, 23 Sep 2022 03:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663927646; cv=none; d=google.com; s=arc-20160816; b=RPRhmBR5xTUtqmTsRRi6n6cljGCNO0/LcgTS4k+Bva5U8dqyL0BL1B/yY8iTih6ceb IFJlliJRF49/v6rziKYZwJ1QpRjMaRbPmajVWbsuVgPuJNwQjATZoj5pO3D12byHlq7P rKfaM5iYF5UscrbjyDEZMoL+WTb/oqXyZA5yid0Ej7yJsnxW0mGgYa4CvDNZjWdRbBWe rfoIVixNuCNMTi07U7bJ0vIybFqFtMWIldTsTp24mpCsZVanKAuANGBi5NgH6RGFQffa QR6T7tOyrnzsaDkeIePUWwyn2SoHVutqldxQe+rBXX7fssZw2TUciMVTHX1cRYbaIUlN ZWBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=us+dLjYsj7y69xS3UKuaVga8AZkPesdObHEXPyfea7c=; b=qgQk3ILmOs/EbFKBp2R7FxinIciz1B1o2Xe4cmw0h1QQnpZKK0Yn9h+/K6gp0HVBOu Sy6YXntgevjnQs9fXkFuGp8AwkWavfTYIto3KyzmQQqkHPFZNszBkaC3lASCrfb1MwIX V6Bu8GGe1w5I77dcDxTnWdB4zZ1dOf7D1VJtXTX4+4Paah8vxRlYgVpmNIkRmI1zHhxz yuym2+q0L0l/SF+6gyQ3ihOcIxl+GUdIh7PqBC4Zbqp21UoOyaZY9Qy3aHfeMIXuDuBc QqD8OwCk/hoXuRwUuOiswDJtp+Qpd3Pu0I9GAmABtpSKTuCIX5/ctKHQKtTf5Zuiow5k 2vBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=CgxV01WF; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a63eb41000000b00434d19f437csi8564869pgk.558.2022.09.23.03.07.00; Fri, 23 Sep 2022 03:07:26 -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=@suse.cz header.s=susede2_rsa header.b=CgxV01WF; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbiIWJ5C (ORCPT + 99 others); Fri, 23 Sep 2022 05:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231516AbiIWJ45 (ORCPT ); Fri, 23 Sep 2022 05:56:57 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A23713073E; Fri, 23 Sep 2022 02:56:55 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0655821A8E; Fri, 23 Sep 2022 09:56:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1663927014; h=from:from:reply-to: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=us+dLjYsj7y69xS3UKuaVga8AZkPesdObHEXPyfea7c=; b=CgxV01WFtYUpA/rNfefeudFxFUhoOnJkG0HnO1V8uPJV6xSkn7z6huZF6R/QyGCFIU4LFW nLaS8GVaFPjeIepZRkh+yYXVCVHc6p3IUk7v/7W2BW+ptoKZAM5vDzldVqFlXMDJhkwMkj xQ+0bvG9JPXm64wVtf0yQcflvm+rYaA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1663927014; h=from:from:reply-to: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=us+dLjYsj7y69xS3UKuaVga8AZkPesdObHEXPyfea7c=; b=KXTNeaDMsUrJxPhK3xNAXOp5p3gQfxpAMM25eFV7D53yDuXmK5zyxRULi3uK1YGDGVOS1x vSjXFKMYV27kfYDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E584313A00; Fri, 23 Sep 2022 09:56:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Oh0FOOWCLWNiMQAAMHmgww (envelope-from ); Fri, 23 Sep 2022 09:56:53 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 443FDA0685; Fri, 23 Sep 2022 11:56:53 +0200 (CEST) Date: Fri, 23 Sep 2022 11:56:53 +0200 From: Jan Kara To: Jeff Layton Cc: Dave Chinner , Theodore Ts'o , NeilBrown , Trond Myklebust , "bfields@fieldses.org" , "zohar@linux.ibm.com" , "djwong@kernel.org" , "brauner@kernel.org" , "linux-xfs@vger.kernel.org" , "linux-api@vger.kernel.org" , "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" , "jack@suse.cz" , "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" Subject: Re: [man-pages RFC PATCH v4] statx, inode: document the new STATX_INO_VERSION field Message-ID: <20220923095653.5c63i2jgv52j3zqp@quack3> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ef261e3ff1fa7fcd0d75ed755931aacb8062de2.camel@kernel.org> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no 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 22-09-22 16:18:02, Jeff Layton wrote: > On Thu, 2022-09-22 at 06:18 -0400, Jeff Layton wrote: > > On Thu, 2022-09-22 at 07:41 +1000, Dave Chinner wrote: > > > e.g. The NFS server can track the i_version values when the NFSD > > > syncs/commits a given inode. The nfsd can sample i_version it when > > > calls ->commit_metadata or flushed data on the inode, and then when > > > it peeks at i_version when gathering post-op attrs (or any other > > > getattr op) it can decide that there is too much in-memory change > > > (e.g. 10,000 counts since last sync) and sync the inode. > > > > > > i.e. the NFS server can trivially cap the maximum number of > > > uncommitted NFS change attr bumps it allows to build up in memory. > > > At that point, the NFS server has a bound "maximum write count" that > > > can be used in conjunction with the xattr based crash counter to > > > determine how the change_attr is bumped by the crash counter. > > > > Well, not "trivially". This is the bit where we have to grow struct > > inode (or the fs-specific inode), as we'll need to know what the latest > > on-disk value is for the inode. > > > > I'm leaning toward doing this on the query side. Basically, when nfsd > > goes to query the i_version, it'll check the delta between the current > > version and the latest one on disk. If it's bigger than X then we'd just > > return NFS4ERR_DELAY to the client. > > > > If the delta is >X/2, maybe it can kick off a workqueue job or something > > that calls write_inode with WB_SYNC_ALL to try to get the thing onto the > > platter ASAP. > > Still looking at this bit too. Probably we can just kick off a > WB_SYNC_NONE filemap_fdatawrite at that point and hope for the best? "Hope" is not a great assurance regarding data integrity ;) Anyway, it depends on how you imagine the "i_version on disk" is going to be maintained. It could be maintained by NFSD inside commit_inode_metadata() - fetch current i_version value before asking filesystem for the sync and by the time commit_metadata() returns we know that value is on disk. If we detect the current - on_disk is > X/2, we call commit_inode_metadata() and we are done. It is not even *that* expensive because usually filesystems optimize away unnecessary IO when the inode didn't change since last time it got synced. Honza -- Jan Kara SUSE Labs, CR