Message ID | 20230405144453.930311-1-chao@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp445145vqo; Wed, 5 Apr 2023 09:42:06 -0700 (PDT) X-Google-Smtp-Source: AKy350Yxh3gArHsN+/+glc0Qex11U9AoRSjXLwRScxfN8FZgMhOFRcUX2//FrWa1//xfwRAiLnzL X-Received: by 2002:a17:902:f1cd:b0:19a:945d:e31 with SMTP id e13-20020a170902f1cd00b0019a945d0e31mr5873906plc.13.1680712926375; Wed, 05 Apr 2023 09:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680712926; cv=none; d=google.com; s=arc-20160816; b=ajxXI/fops9zuXiDkJ38otu+ayXzXNDbBMiqVULRaPfB4IW56FR2dWBYAhMTK7SxaR ZJpaK1T06RgJvT6sZBvCV6v1cfVE965B0PVp4D3xJnMKv4AMly1dLw5+ngSdCAbTJa8b +IKeh1x0SxiKqnQxyzAa+JPej/NcC4upAWCDCHojjLafBugVCDdpf634rVXOkEXqg1Vx o9uuzt8/ym3Be07nxYs79CD9SkhTCeDXVPHry0EwQLSSS51N4+5SJsnys0nzH2Gb1uFb sx10HsLIwsyrHhIZ8frXaopyPWUlewKuisVzvMxP+MY5CcN++M4ZfHRaUDH/PBjj77ag HTRg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=+k2iQv33P/fTdI9liK2nPnC8BnN5vQr2IFB/6e+xxF0=; b=dqiixGZshQOZi6lxQO48i3RqOcsr2MCD+D0FMpVMZTLJXZ8rwnHoOcy2DkeMD+Z/z4 a0Nra3/eu3xXFr2Fdjqu6HyVFnAeoCdpn5THJpM36M7JN/TKGp9To2rMbr8zuhzDIu9N Gm+4a6yVnbR3wv2iEkBvb1OX5qwHiW9qdP7857ShJTQjKCEj17BKEYXWLGQQhS2Lb/A9 wvaqrO9BkX4/D8+CAHt20I63ZwoAySJCMKcco9lo9Y8/k59Mb/ccXu3vvpS+tPyVW1++ 4wSJsA/EMD/KOcwJ9/UWWaZCKdN6DgXV+tptNcCKm4ERtO2BPjKrhWu+oVX/bpbYe5R3 XOcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uNFm0cqZ; 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 c14-20020a655a8e000000b0050bcbcaf7d6si12612089pgt.49.2023.04.05.09.41.53; Wed, 05 Apr 2023 09:42:06 -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=@kernel.org header.s=k20201202 header.b=uNFm0cqZ; 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 S232578AbjDEQWG (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Wed, 5 Apr 2023 12:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232206AbjDEQWD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Apr 2023 12:22:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0F1729F for <linux-kernel@vger.kernel.org>; Wed, 5 Apr 2023 09:21:50 -0700 (PDT) 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 E7A3363F67 for <linux-kernel@vger.kernel.org>; Wed, 5 Apr 2023 16:21:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57E2FC433D2; Wed, 5 Apr 2023 16:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680711709; bh=ef2YepiMAXx8RjWeBXAJGEINglAm0SF9NGq0mwWfm9g=; h=From:To:Cc:Subject:Date:From; b=uNFm0cqZXj4E38P6Z6QbhfvfCrMxn81ukq7npYUC2ISHSLJaPu1SBDaOkNpCGD2fM nS8V17kZby73sy1Z1c2mv4hUW+l9QYX/GPKrDf2zoxhS1/Sx0ZajzFnM0JKV7rFeUc fsT6+BM58vkDaphGnCwbHvhADHpiBp6uwKtAZbT4wY9mHszCRTISnO4omatC+u/Uyz IyNTNgMThi2aEhVXHbO2CI1G/dRiUQJgDrsew3O9WN0o/yd8+EfgB4x4mtMqVEVuqp EGFc0ZnJdcHvJlY88A146ybIBF3n/GpwAvu5a79hLdZM1+AQAFpTrL+i/hosFJHeap RcjWLPnibw2UA== 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>, Daeho Jeong <daehojeong@google.com> Subject: [PATCH] f2fs: fix to check return value of f2fs_do_truncate_blocks() Date: Wed, 5 Apr 2023 22:44:53 +0800 Message-Id: <20230405144453.930311-1-chao@kernel.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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?1762355237732573830?= X-GMAIL-MSGID: =?utf-8?q?1762355237732573830?= |
Series |
f2fs: fix to check return value of f2fs_do_truncate_blocks()
|
|
Commit Message
Chao Yu
April 5, 2023, 2:44 p.m. UTC
Otherwise, if truncation on cow_inode failed, remained data may
pollute current transaction of atomic write.
Cc: Daeho Jeong <daehojeong@google.com>
Fixes: a46bebd502fe ("f2fs: synchronize atomic write aborts")
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/file.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <jaegeuk@kernel.org>: On Wed, 5 Apr 2023 22:44:53 +0800 you wrote: > Otherwise, if truncation on cow_inode failed, remained data may > pollute current transaction of atomic write. > > Cc: Daeho Jeong <daehojeong@google.com> > Fixes: a46bebd502fe ("f2fs: synchronize atomic write aborts") > Signed-off-by: Chao Yu <chao@kernel.org> > > [...] Here is the summary with links: - [f2fs-dev] f2fs: fix to check return value of f2fs_do_truncate_blocks() https://git.kernel.org/jaegeuk/f2fs/c/b851ee6ba3cc You are awesome, thank you!
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 10743e864d57..39c41c7e834b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2113,7 +2113,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate) clear_inode_flag(fi->cow_inode, FI_INLINE_DATA); } else { /* Reuse the already created COW inode */ - f2fs_do_truncate_blocks(fi->cow_inode, 0, true); + ret = f2fs_do_truncate_blocks(fi->cow_inode, 0, true); + if (ret) { + f2fs_up_write(&fi->i_gc_rwsem[WRITE]); + goto out; + } } f2fs_write_inode(inode, NULL);