Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp300741lqk; Thu, 14 Mar 2024 03:40:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjrQvOi3jj6vqPpNsvgCezd4JQDDyvVE3qSNxyC7lMvR4IwsLbq6WbOYwWZilhzg6mk12+N49AmDnEz3vCbmJNvtd08VSw4HFlZssHiQ== X-Google-Smtp-Source: AGHT+IEKf9wlByuY66O8YbzTrmmOiG5U3/5ZD/7TvZtoU+9m5WccjWHrQtkgUwYh2BwvpG5vXSOg X-Received: by 2002:a05:6102:2409:b0:475:ff34:a374 with SMTP id j9-20020a056102240900b00475ff34a374mr1360166vsi.8.1710412839603; Thu, 14 Mar 2024 03:40:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710412839; cv=pass; d=google.com; s=arc-20160816; b=c4GTn8OHGxSQuckmRCKG0Tp4IDQF3mfo7XwWNMswbFBTdLNzSfzZWX5ecKYHLSMIjV evEGFLrShBXsh7t0g8NWL20X3dWh+ewV/CRfeO9mn4HOTcgby6Ep1ARQsXurFGJ5edb+ XC9HaF/pIahbTwGMWgdumaa2xtZ8u3pygaDF8SnAryFyymCmqZphV9+PMGhq3g4p5c1j NKLLFlMvrYJ/bb/fE9XHM5CfInnUeGhA+JBUU0bsgdYq2d1dcnvuaTsZ2sStP3mmxHJG b/IZ/ZXnB5girHRxUHDPjMeKpk7EFOR2I88A67vfCBYWqyvkls+xc4wsE+xDI2MEWsNo v4Cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=s+flQKqZdkl7ncVdTsyDYkHNPMCGi8yAmeAgPG8I6XU=; fh=5mv+cs5YuOgmSYE85CAESeBuf7owLlzYQLqQJucVAjE=; b=bPU5Id3TtO1UCjzCN2I7OyodgK4JSIWI/ElEm5rHFo4VcTluYxEME9RvsxZrOoZQtP COrnpC1T8GTJ/fzJPDzZvVNtRl2BQAgnc5TqHpkPGauvoAQv8Oo1uPe9gkia7TtWrg5R kpM/jZ9nrsTCKD65M8GBYvT6+iSaEem4Z49icRwcjgLKYuc6pthWX7APB9jWkAOGXSii hYkv1HQ+3z7qUqxN3JzQ+NbFeg2p0UsDenYcvvB+nbNxVVMISVOHzErX/nSCuoqLy0jN 7dlBb21IMCt0EH3AJgxz++NXGYdRhtIOurDhhVt+C/iWu7muol5iRsEsp1OOqgjEv73V 5a1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H648jIk3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-103136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 9-20020a05621420e900b0068fb7f623fcsi345371qvk.220.2024.03.14.03.40.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 03:40:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H648jIk3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-103136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3E2AA1C20B3F for ; Thu, 14 Mar 2024 10:40:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51AD06CDB6; Thu, 14 Mar 2024 10:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H648jIk3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 772746EB7A; Thu, 14 Mar 2024 10:40:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710412810; cv=none; b=dYI72CfWdnJVQdrmZ88eEw/Q0jMDSN2ZuX6wDm2fpO5K8YMXyXHRNoD1V+oLuidt4lWYwvW+iNLd7ine6+vfx6AsCkiCmgesfAV+Pnx7Wn18eHvAlgddtIkKEVh8vtNtuJPx3ibZukYi+KDl1lKd32Fot+56vYPev9eJX/EHRVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710412810; c=relaxed/simple; bh=c4J7TAHcx++DxMeKEfMzpwWlcM8HgZRjo1aIWTMX0T8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CmahT6/lP57PIg/q4x2GM6vDilPbdMDmpWrXqVCGmiSmSM5rLXXi9iy0K0T4djV2LlVs2Spzc/FqP889di9zeyNg6C6CxeXGr9LAhODQYckFBMQ4R7/bWoLPqi8MSqrgT+jxWJuwykV6mjv8PcA28DzHJttBhx3IW3EqIIwPpxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H648jIk3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70D7CC43399; Thu, 14 Mar 2024 10:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710412809; bh=c4J7TAHcx++DxMeKEfMzpwWlcM8HgZRjo1aIWTMX0T8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=H648jIk3Ql7cXi/pjB0JMa/jLn7TkBiUqTvdQ623gjNtaz9sC7anE41WVWe6Jx+bB r+Y2MdID87ILDP91BvGCUnnGDvU7oPrfIy0w8HMNsmSXkBZ2MKBoKbCapAXbUX0Ke5 eT1WUMZDPPrRa/Mvn9XA1B6Zf2paPSmHoX3zpXx/pKQSDnD27SZyU0yiRguncpCjUT TwxrkbL3gns50MSsjPDOxQurs+gpGctcw8Gy0YGnWqxiCaQ33S2lA/BUcaUqB6aseQ UJFcdvTBTJPWW6lJcgpxSTHU9NWKjBBW+9QvYXSDmKT74cUdGFP4sZ0jZQ+lgMEusi pkphCrAn8MdAQ== Message-ID: Date: Thu, 14 Mar 2024 18:39:59 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] f2fs: truncate page cache before clearing flags when aborting atomic write Content-Language: en-US To: Sunmin Jeong , jaegeuk@kernel.org, daehojeong@google.com Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sungjong Seo , Yeongjin Gil References: <20240313112620.1061463-1-s_min.jeong@samsung.com> <20240313112620.1061463-2-s_min.jeong@samsung.com> From: Chao Yu In-Reply-To: <20240313112620.1061463-2-s_min.jeong@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/3/13 19:26, Sunmin Jeong wrote: > In f2fs_do_write_data_page, FI_ATOMIC_FILE flag selects the target inode > between the original inode and COW inode. When aborting atomic write and > writeback occur simultaneously, invalid data can be written to original > inode if the FI_ATOMIC_FILE flag is cleared meanwhile. > > To prevent the problem, let's truncate all pages before clearing the flag > > Atomic write thread Writeback thread > f2fs_abort_atomic_write > clear_inode_flag(inode, FI_ATOMIC_FILE) > __writeback_single_inode > do_writepages > f2fs_do_write_data_page > - use dn of original inode > truncate_inode_pages_final > > Fixes: 3db1de0e582c ("f2fs: change the current atomic write way") > Cc: stable@vger.kernel.org #v5.19+ > Reviewed-by: Sungjong Seo > Reviewed-by: Yeongjin Gil > Signed-off-by: Sunmin Jeong Reviewed-by: Chao Yu Thanks,