Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3528407rwb; Tue, 16 Aug 2022 04:52:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR5XHhe6p/WxDOb3nAc4JDePGb1HMzQaVB6OG1DuxBOZxso0n0ubMiMkUwj/mnp5EoN3ie4Q X-Received: by 2002:aa7:cd51:0:b0:440:595d:aeed with SMTP id v17-20020aa7cd51000000b00440595daeedmr18467400edw.143.1660650733648; Tue, 16 Aug 2022 04:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660650733; cv=none; d=google.com; s=arc-20160816; b=Ksql4Neh1OgQkNDit52DSuu05EGHKVWu6amegqso3fUo1psFcHnTubPTzVi2ZhTkl2 Mv1T79gRW+nz8HT27IJdcKuflXhmYGWdmyyCGL0gJm/5bTJ0iBaPEm2VtwPvcPRdXlou ACvVG1+4rS6i4w3xi72GGUTAeW4GLVkuCEOpsaQ6NucFEenS17Sz+Bj/jUir4ipaDNVW eyGc2d1rhM7S8GIZa8fB5k4oOTUCZNG+rE8J1pRwsRdC+kVmXqCMfQhaQr9PjkeMqjEf fxqJCm+2M7IT0S0p0SQYGIdToG8tdB19YBsxKWIeE0pGAIQq5WAiK6Vna1bHrE+bOr9+ fx6A== 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=jzhGbva5hBefaLpjvEShS1ChaQcEbODk+AyWbDL94nk=; b=VXWRAjm0KtsoD+u+K0HxOi5VhFopwqysAE94kDSKYKnOf/WMfewWW46nkKecEm7E4Z +AXLLLtcbmhpUUDSdS8DZtRhaNJgSj4lpHNC5kY+iI43l7SsCjySW5pfgznS9CmT9kZy 59A8i8RxxWpTQ7aAZ3SIPbd3T/uvFXyf+k+N+ACqDVEnoDdyPB+FJDKA0uO7b+eY5IE9 NKDnpS2qdDUlpY46CBq76Pk6+xZtbJ1xK3Zd5H6aVwxjq4jM5Bp8Fyp75WGl10MRigAU PZyYsyi3qK3b7oVjZIX2J356rxibdO7ax55oRPLRkWjrPIAkKBfw671sC9RRbg9Tt4Q2 HMZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ODBpoxKe; 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 fu10-20020a170907b00a00b007262b3cd387si7790386ejc.421.2022.08.16.04.51.41; Tue, 16 Aug 2022 04:52:13 -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=ODBpoxKe; 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 S234572AbiHPLrv (ORCPT + 99 others); Tue, 16 Aug 2022 07:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbiHPLre (ORCPT ); Tue, 16 Aug 2022 07:47:34 -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 2BBE0CB5FD; Tue, 16 Aug 2022 04:21:28 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4F164371AE; Tue, 16 Aug 2022 11:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1660648887; 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=jzhGbva5hBefaLpjvEShS1ChaQcEbODk+AyWbDL94nk=; b=ODBpoxKehExsyanPD4hEWq7HBqIK3GbfzB8Acha+rRf8eXb4DEgWQDhmMIz5ns3QcfOTdm DpxQHe6X7ftByvdzVGj2GMs5Uvj9cBx2iug0yVIUPFP4FAQjFP8vFtHzzXY6lk3cyre927 gHbQ9eAI9wQY+Gjb0qoBvwIi5PpHY7I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1660648887; 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=jzhGbva5hBefaLpjvEShS1ChaQcEbODk+AyWbDL94nk=; b=Ag4yuhOVTCeyd6nXs4Ig2CF20+PiyZSPqwumsu+pUMl+sLsp28dmDkKJ5LVHkc4YbckAFX al/Um3EWKBtnPLBA== Received: from quack3.suse.cz (unknown [10.100.224.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2DA6E2C14E; Tue, 16 Aug 2022 11:21:27 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 5C254A066C; Tue, 16 Aug 2022 13:21:24 +0200 (CEST) Date: Tue, 16 Aug 2022 13:21:24 +0200 From: Jan Kara To: Eric Biggers Cc: Lukas Czerner , linux-ext4@vger.kernel.org, tytso@mit.edu, jlayton@kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org, david@fromorbit.com, Christoph Hellwig Subject: Re: [PATCH v3 2/3] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE Message-ID: <20220816112124.taqvli527475gwv4@quack3> References: <20220812123727.46397-1-lczerner@redhat.com> <20220812123727.46397-2-lczerner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE 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 Fri 12-08-22 11:12:27, Eric Biggers wrote: > On Fri, Aug 12, 2022 at 02:37:26PM +0200, Lukas Czerner wrote: > > diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst > > index 6cd6953e175b..5d72b6ba4e63 100644 > > --- a/Documentation/filesystems/vfs.rst > > +++ b/Documentation/filesystems/vfs.rst > > @@ -274,6 +274,8 @@ or bottom half). > > This is specifically for the inode itself being marked dirty, > > not its data. If the update needs to be persisted by fdatasync(), > > then I_DIRTY_DATASYNC will be set in the flags argument. > > + If the inode has dirty timestamp and lazytime is enabled > > + I_DIRTY_TIME will be set in the flags. > > The new sentence is not always true, since with this patch if > __mark_inode_dirty(I_DIRTY_INODE) is called twice on an inode that has > I_DIRTY_TIME, the second call will no longer include I_DIRTY_TIME -- even though > the inode still has dirty timestamps. Please be super clear about what the > flags actually mean -- I'm still struggling to understand this patch... Let me chime in here because I was the one who suggested the solution to Lukas. There are two different things (which is why this is confusing I guess): 1) I_DIRTY_TIME in the inode->i_state should mean: struct inode has times updated after we last called ->dirty_inode() callback. Hence inode_is_dirtytime_only() as well as the chunk: /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ flags &= ~I_DIRTY_TIME; you mention in the previous email are compatible with this meaning AFAICT. 2) I_DIRTY_TIME flag passed to ->dirty_inode() callback. This is admittedly bit of a hack. Currently XFS relies on the fact that the only time its ->dirty_inode() callback needs to do anything is when VFS decides it is time to writeback timestamps and XFS detects this situation by checking for I_DIRTY_TIME in inode->i_state. Now to fix the race, we need to first clear I_DIRTY_TIME in inode->i_state and only then call the ->dirty_inode() callback (otherwise timestamp update can get lost). So the solution I've suggested was to propagate the information "timestamp update needed" to XFS through I_DIRTY_TIME in flags passed to ->dirty_inode(). I hope things are clearer now. Honza -- Jan Kara SUSE Labs, CR