Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4117508rwb; Fri, 30 Sep 2022 13:08:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bFS+VSN9hPsskKxN9NhbfVQlyqzsY0i3VyobmUMGRm512EShlA+mRUy+7cseuMQHe74mE X-Received: by 2002:a05:6402:1944:b0:457:fed7:5c30 with SMTP id f4-20020a056402194400b00457fed75c30mr8895774edz.278.1664568510935; Fri, 30 Sep 2022 13:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664568510; cv=none; d=google.com; s=arc-20160816; b=B10TvamXXft25tVi99CEcE+MP65GHfUPVHf/vtFm2HtfLQMslTyzIi85+m7m0LaZMR IF/aYTOgT/Bqxk8M9T24hJPSV4o0RleFc91JkC7R8Jg39CVY7qm05MoiZLCRuLvgYna3 ZZSOtFKxizCEDMUizY1kmikEQjj9DjRIRhScBPY0lX9xd90g9L/StLG91Rous0j8QqrD HXuUmqLKFMcYe0Degt7eVoXJ/PWK15Q7eCqtDvjskbeYDcqkcpJaOttsEirLAFf2b4TC P6oHPCtYHbxelFcw0hXJbetDvUyrualj6RDh6FVvRHrs2t9gLm+Gl8MgTp/uACnVaBNT 7s4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fHw5bthHkZ6wVmpLXXlxKzX4awvmiLNTfGvvpOnBM54=; b=NSagSfYHplM/3lKzov/go/g5H2HEQbxm8v/F/5ikd0qTt9ILojutMSoXa4470U+Lal R30zBjMB14bDwnHv/yNc9r/LEXTeVLeNrxPjlRWT+Scp/moHuXwPg6D/jzS8a73bx2r9 ZOv8V6FsLV+oW8rBPwZ6gNvw6+QbpYmOC/Ulb4xle8sSUJOo/Y7ISct6j9ZIWyskogCn 5Qao5rerufHkyQK4w82sk/UNAUiJB7hE+vvyR9qxDVxMMKFMWj2C5VoQX9c94BAUfrUp u3Dw+1YaWA/yLxhTH/3z5R+U2QE4huXW6puBSGF6RA2LCFHb5ClTXNuXF7h3Yyvrjekt yRJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=i0eKJXZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr16-20020a170906d55000b007830e41ed56si2707221ejc.431.2022.09.30.13.07.35; Fri, 30 Sep 2022 13:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20210112 header.b=i0eKJXZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232161AbiI3UBz (ORCPT + 99 others); Fri, 30 Sep 2022 16:01:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232098AbiI3UBu (ORCPT ); Fri, 30 Sep 2022 16:01:50 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7D3A15C5A1 for ; Fri, 30 Sep 2022 13:01:49 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-3560e81aa1dso32036257b3.2 for ; Fri, 30 Sep 2022 13:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=fHw5bthHkZ6wVmpLXXlxKzX4awvmiLNTfGvvpOnBM54=; b=i0eKJXZV7PNaL5CKCGGCLZHqCiIHNgG3V5nkz1Q0kfRN2gINoeslisnPK53cEJTbdB CiRwPUtD6MgLXUC4cqlsW16i4l71U6c+YG8G4SgeA+GpEvJWu2E5DT/0cf4CG0NEtpzo 6UZKjO5t/G1MWSt6PgcaFVhlsDWJsvvpq8J73DIGGzEIbHTAGJle3TFRmgBlHQuxWqNp OmnRTXUvdIg+zG3x+yBdk5HUqMODaPvPjEHkWiLEPQmIRvkBpTNl1E080zbWS9bkuA4G rD/xbANuIssEuiH53YaGbuw0K4ouPbLt0fq1s+DjYBSWnRjwXaaLwdSAr0cLLTZZ4fAr F3dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=fHw5bthHkZ6wVmpLXXlxKzX4awvmiLNTfGvvpOnBM54=; b=2iM16nH6sOoDSegWella3VtWQb5RNZugPff0H6xO73MTSUHUqx8O39bhPl8+ldDGdP WHYwfNd0wld8onyyu9wgxwcTtITeaKNGtq0BGXaXS1IN6Kj3SH27vbCUhH6zwoYbFCIa BC/649p57u6qKJ4GxFIPOXBZU/W+VLhaoD25XLG8hfTBgDO7bYOakRsCy9nbg90CfAsP XY+lsUrPf33acR637V5zIxrwiUQHN/xj3IY+yPHnMk9bvPI1LAfn2SP0p71H8uWCsJ5m 7ZoIdXFy1n1Auy5txlNLbUncIsRvxBszceZWTnI5FuxD7S76SaF6vpn3pvIMrhUEWCSN /gow== X-Gm-Message-State: ACrzQf2MMbeBFZtedCIuxzG5wfWdmWnQo3GOyb0PMdp4EBsd74LkZKqP rNfcIl4vy/mNTJi4V5AWRVTMZScjUTIQuNE4F24= X-Received: by 2002:a81:9ca:0:b0:354:fce9:814b with SMTP id 193-20020a8109ca000000b00354fce9814bmr9625750ywj.458.1664568108388; Fri, 30 Sep 2022 13:01:48 -0700 (PDT) MIME-Version: 1.0 References: <20220920014036.2295853-1-daeho43@gmail.com> <4aca0d00-d3b7-975f-6b72-ccd6f07d22e5@kernel.org> <53df1b78-c611-6a22-88b1-74cc83a9e148@kernel.org> In-Reply-To: From: Daeho Jeong Date: Fri, 30 Sep 2022 13:01:37 -0700 Message-ID: Subject: Re: [f2fs-dev] [PATCH v2] f2fs: introduce F2FS_IOC_START_ATOMIC_REPLACE To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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-kernel@vger.kernel.org On Fri, Sep 30, 2022 at 9:04 AM Daeho Jeong wrote: > > > >>>> > > >>>> Hi Daeho, > > >>>> > > >>>> isize should be updated after tagging inode as atomic_write one? > > >>>> otherwise f2fs_mark_inode_dirty_sync() may update isize to inode page, > > >>>> latter checkpoint may persist that change? IIUC... > > >>>> > > >>>> Thanks, > > >>> > > >>> Hi Chao, > > >>> > > >>> The first patch of this patchset prevents the inode page from being > > >>> updated as dirty for atomic file cases. > > >>> Is there any other chances for the inode page to be marked as dirty? > > >> > > >> I mean: > > >> > > >> Thread A Thread B > > >> - f2fs_ioc_start_atomic_write > > >> - f2fs_i_size_write(inode, 0) > > >> - f2fs_mark_inode_dirty_sync > > >> - checkpoint > > >> - persist inode with incorrect zero isize > > >> > > >> - set_inode_flag(inode, FI_ATOMIC_FILE) > > >> > > >> Am I missing something? > > >> > > > > > > So, f2fs_mark_inode_dirty_sync() will not work for atomic files > > > anymore, which means it doesn't make the inode dirty. > > > Plz, refer to the first patch of this patchset. Or I might be confused > > > with something. :( > > > > I mean FI_ATOMIC_FILE was set after f2fs_i_size_write(), so inode will be set > > as dirty. > > > > Thanks, > > > > Oh, I was confused that f2fs_update_inode() is called in > f2fs_mark_inode_dirty_sync(). > That is called in f2fs_write_inode(). Let me fix this. Hmm, I think the issue was already there before my patch. So, how about making the inode flushed and clean if the inode is already dirty when starting atomic write? > > Thanks,