Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp133950imn; Fri, 29 Jul 2022 02:07:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sat5pO/98MSDAO2tuHh7QyG0gCysqV8NthC3kc21bxWpxSJ1a+uhLecgH2TCHlLvD2fusO X-Received: by 2002:a17:907:9491:b0:72f:2827:37c3 with SMTP id dm17-20020a170907949100b0072f282737c3mr2224205ejc.306.1659085650911; Fri, 29 Jul 2022 02:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659085650; cv=none; d=google.com; s=arc-20160816; b=RxBmk5Bn/STkMrpJntNjJ/LXGu40YIjHK5HoUcwwOxUGoabuc9UCcoiKO5+P7P7Z5i II7jFRJBUo/uI7OS8eM2K/wRoOIcV4y6ogmcfnCiIKYO/jw7csJF2H+PPMOSyGSne5k9 oYNYDO8qMTUa9DP4PCMr9v7iBNUHotuU0Ab5ujZP0Sk6nTBY3cmT1RqjkFPzVEhP9ZdG 7X6o2eMIpj2PFBDQ5IhcDKE4NPHFPJIXNJQMY3Par/8VWfi++Duw1BY202enLUuUDePo oMw7qvIIEdhOfLlvhT9FmAoBfShsOGjYcn4edQVRuC0INNgxgIuqvVlPMMWCAixHQ/xX O4Ng== 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; bh=IHI9txL3xcXBJhnn+nRJ6psIpAzN5VY5djmq3vxdXkM=; b=FdTrPmn9+9qyRJdlY/HhcVAjfof4UdXVwNB7qjB72LqtFxwn45+4BWeeMmXxUO1HkE n73DaEgReevWSHKbcLsKjXxGvIan66QFm7Id+VqJgQ+7P3JqxgLp8RXsRpEenxA1Rk53 QuKy7VV6DvskbU4DV8JbIkiPOOHJIqNjAPQXPHX7OSQRy1gZFsSOTDLYjVZ4uDcDtES/ jrDzd7G0vVJw4V9zRLql2yE9EBI6XHPSmRjf44IM7ZBgobTPmpwVIHsigtUL41K8EQcI WGpVmo1J/gkrdfT9kbySTeqHQyTpdC1pw5TxDE5Su1ZwqZDH/SvzhT++9YyeNUnNbA0S IspA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PUreQo38; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz12-20020a0564021d4c00b0043bd841300asi1475183edb.111.2022.07.29.02.06.54; Fri, 29 Jul 2022 02:07:30 -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=@redhat.com header.s=mimecast20190719 header.b=PUreQo38; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229602AbiG2Iyo (ORCPT + 99 others); Fri, 29 Jul 2022 04:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbiG2Iyn (ORCPT ); Fri, 29 Jul 2022 04:54:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E3DC983226 for ; Fri, 29 Jul 2022 01:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659084882; 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=IHI9txL3xcXBJhnn+nRJ6psIpAzN5VY5djmq3vxdXkM=; b=PUreQo38rWv+9iC6aA6KMC8uZqVS5mF9xHi+A0GnTOm7KD9qJTbQe+eNghDtaQiY9pq/Fw K7CbxB8BGeXnW7NE60gauNnJSEIFn4WopnZWX+G2vqxJg709ZixKh+2QQZyQsi6+33bg7f ibZjiXrtH89K38HxRTN/Xu2/W9+xfj8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-aVGpGE0iO6m0313Zxd-55Q-1; Fri, 29 Jul 2022 04:54:38 -0400 X-MC-Unique: aVGpGE0iO6m0313Zxd-55Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 298E51C05132; Fri, 29 Jul 2022 08:54:38 +0000 (UTC) Received: from fedora (unknown [10.40.194.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E11F2026D64; Fri, 29 Jul 2022 08:54:37 +0000 (UTC) Date: Fri, 29 Jul 2022 10:54:35 +0200 From: Lukas Czerner To: Eric Biggers Cc: linux-ext4@vger.kernel.org, jlayton@kernel.org, tytso@mit.edu, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/2] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE Message-ID: <20220729085435.b5unegq5ilbtcywu@fedora> References: <20220728133914.49890-1-lczerner@redhat.com> <20220728133914.49890-2-lczerner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE 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, Jul 28, 2022 at 09:05:11PM -0700, Eric Biggers wrote: > On Thu, Jul 28, 2022 at 03:39:14PM +0200, Lukas Czerner wrote: > > Currently the I_DIRTY_TIME will never get set if the inode already has > > I_DIRTY_INODE with assumption that it supersedes I_DIRTY_TIME. That's > > true, however ext4 will only update the on-disk inode in > > ->dirty_inode(), not on actual writeback. As a result if the inode > > already has I_DIRTY_INODE state by the time we get to > > __mark_inode_dirty() only with I_DIRTY_TIME, the time was already filled > > into on-disk inode and will not get updated until the next I_DIRTY_INODE > > update, which might never come if we crash or get a power failure. > > > > The problem can be reproduced on ext4 by running xfstest generic/622 > > with -o iversion mount option. Fix it by setting I_DIRTY_TIME even if > > the inode already has I_DIRTY_INODE. > > > > Also clear the I_DIRTY_TIME after ->dirty_inode() otherwise it may never > > get cleared. > > > > Signed-off-by: Lukas Czerner > > If you're going to change the meaning of I_* flags, please update the comment in > include/linux/fs.h that describes what they mean. > > - Eric Good point, it does say that I_DIRTY_TIME and I_DIRTY_INODE can't be both set. Thanks! -Lukas