Message ID | 20230109034453.490176-2-chao@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1960797wrt; Sun, 8 Jan 2023 19:47:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXsKRlfMzLpitSG0qT51bCo3xSParLabOVdcULdD3zQ2tvBB6UNDPuF5OreQ9EGq8oS6D7X+ X-Received: by 2002:a17:907:8e93:b0:7ae:bfec:74c7 with SMTP id tx19-20020a1709078e9300b007aebfec74c7mr57913561ejc.72.1673236064426; Sun, 08 Jan 2023 19:47:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673236064; cv=none; d=google.com; s=arc-20160816; b=yBmGqRD251KQhpB4gc/8v92ABA+/SWaWrq9wz7aIRjYgk28ul8NZNvC37hDEWL1tHq oTJ7lUNXR3jXeaAmbVpZ6unePYR03cNr52QpEoFyMFGP2489XtpnT3GE+0KVw5QFhBuR sN/jbNdFP93CftofDexPNWizzIgzjsYGJaqtDpweGHM1zaM8LuidhTuFTN1ZJ+abDO2O Nw8JIKUXmKqDW4udflNSKkhqzUWGpw5dBKdEGzFzuEsQInQB9C/tXciiepJTJeVedm73 6Eo61BCOCvEjPhjIzIdosMAhthsQjRmaNN4280/CKTqq7Tvou5lFeR0xTaN8i0/XkjF+ UDlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=euvkepgFT3TX951BGNdItfqdJ54GGwjTkv52+qkVxEQ=; b=z6Ghc7IYaeJLbsh/jGJrhIphHy8Sdqdr6efBzGbDhawq35XPawz/XXK/afIFxmnmGt ++nAKxGfdt3aGGL4/hi+bPIhMqK3DKPMYk5G6q4YuLSTRiGebHvS1ETVxKIbPM1/Cd/H blU2yrPf0uCVEpg+6OeX9YYaYMMIET08m3iif1lrh/g0zCtd1xxO4XK1L0sYP240Rh+W iZFtWNE2avWMkNpV2nLBAB4UOR8b20vhogsDgeOe0hOrWqLPIINM6KW1b2Jh1aScrZ8o IWXeiijJGgrxE3hiYIbex53FORYajoZGFGprVtP+qLYUPuBoVYkfNgQXK2sjKpHLtXsp 9GCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HtGz6EvX; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ww2-20020a170907084200b0084cb7291b36si7375546ejb.991.2023.01.08.19.47.21; Sun, 08 Jan 2023 19:47:44 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=HtGz6EvX; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234261AbjAIDpW (ORCPT <rfc822;jian.xie.xdx@gmail.com> + 99 others); Sun, 8 Jan 2023 22:45:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233682AbjAIDpR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 8 Jan 2023 22:45:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A82F020 for <linux-kernel@vger.kernel.org>; Sun, 8 Jan 2023 19:45:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A165060EAD for <linux-kernel@vger.kernel.org>; Mon, 9 Jan 2023 03:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEBC1C433F2; Mon, 9 Jan 2023 03:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673235914; bh=z+rEkFMv+wRfNSPG7VtFK07vpI0/Mb7wF/w9G4C5Uac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtGz6EvXa+PBbLwGnayMZXLkItsmkkRMAzq4RG4PAi2baRQI+1yaWsh/aM3xDxP2v 3Vjdh6bHI6i/e4n+cSTmMDxh1IPlD7HACU6HAUuQgLw6uXVeZk1UTEHfGHCg4xyF+V suZvvZrCquqM7Fe88ORTzPJQEgckViUKuctoe0+hrsgRFsS1ME4falCNouyTrbyXvj kXliOVbAeEV9pt7voeRaoA4ACYnq8fpfm05Ao6f/Vc9vmBTJlZI6AczeccBXXOIjrz H6bFMyumDZIkYiUL5B9lQFVw7LjzK2c+syKYUp8wN5e2CnZn8nnQFRR95pU2mWGLdc uPACqtsXlbEnA== From: Chao Yu <chao@kernel.org> To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org> Subject: [PATCH 2/5] f2fs: clear atomic_write_task in f2fs_abort_atomic_write() Date: Mon, 9 Jan 2023 11:44:50 +0800 Message-Id: <20230109034453.490176-2-chao@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109034453.490176-1-chao@kernel.org> References: <20230109034453.490176-1-chao@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754515179721060008?= X-GMAIL-MSGID: =?utf-8?q?1754515179721060008?= |
Series |
[1/5] f2fs: introduce trace_f2fs_replace_atomic_write_block
|
|
Commit Message
Chao Yu
Jan. 9, 2023, 3:44 a.m. UTC
Otherwise, last .atomic_write_task will be remained in structure
f2fs_inode_info, resulting in aborting atomic_write accidentally
in race case. Meanwhile, clear original_i_size as well.
Fixes: 7a10f0177e11 ("f2fs: don't give partially written atomic data from process crash")
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/segment.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index c6f6d0618164..5f7e42b355eb 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -201,9 +201,12 @@ void f2fs_abort_atomic_write(struct inode *inode, bool clean) clear_inode_flag(inode, FI_ATOMIC_FILE); stat_dec_atomic_inode(inode); + F2FS_I(inode)->atomic_write_task = NULL; + if (clean) { truncate_inode_pages_final(inode->i_mapping); f2fs_i_size_write(inode, fi->original_i_size); + fi->original_i_size = 0; } }