From mboxrd@z Thu Jan 1 00:00:00 1970 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 9374838DE5; Mon, 1 Apr 2024 17:04:22 +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=1711991062; cv=none; b=Ro6bk6Et1IPlx10rlfeaBv2iFWHZej8UHLt1uisoIBUQ4XE6SXmu7YD3gjpzsSHnzVXTBQy6+TkqknyDGsrD97FlESB60TtyK16Eyk+Ns1E3bgnDnc9ggjXMtFSF+Gf0NPeeNNv/g0PpapaYGVHa7MYZY3VH81h9RLOO9Xz4Dko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711991062; c=relaxed/simple; bh=uJhhnljXq4/QXKMT702IiXrVDJItCRbUnMDxB8GVPAE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rFN3wOw9E/xiXUp7Xj9yqAdwJEZUIJlnPhmWBunHwHPRPj3elUfVv4QRsWjqnZhkaFbSpe1wTvjUH2rnfadLiPArlYu3gvp3EIa8kyMSsw6lkHqFw2KRiDknAFItmChV1+pN5vGZEiCFotioo+rmQIPQXg4IRCM+5AA6zdI9s3g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ozaX24GN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ozaX24GN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19DD2C433C7; Mon, 1 Apr 2024 17:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711991062; bh=uJhhnljXq4/QXKMT702IiXrVDJItCRbUnMDxB8GVPAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ozaX24GNZG4AnYE7UniYeZlITpw25K9KFJUD/qYJ+SkclRMRCSbyv9shVwOtIwiuU MoeU+YazhtXVRDWc1v1mHrZ+DRX6mZ6WmZcEX186txSYiBJJn3DnuhFHv1Mo3m1tER A/tGZGfTLZFcP4M2MGZ6FpvhmsoAnRBf5M18uG0g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sungjong Seo , Yeongjin Gil , Sunmin Jeong , Daeho Jeong , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.1 122/272] f2fs: mark inode dirty for FI_ATOMIC_COMMITTED flag Date: Mon, 1 Apr 2024 17:45:12 +0200 Message-ID: <20240401152534.477460113@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152530.237785232@linuxfoundation.org> References: <20240401152530.237785232@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sunmin Jeong [ Upstream commit 4bf78322346f6320313683dc9464e5423423ad5c ] In f2fs_update_inode, i_size of the atomic file isn't updated until FI_ATOMIC_COMMITTED flag is set. When committing atomic write right after the writeback of the inode, i_size of the raw inode will not be updated. It can cause the atomicity corruption due to a mismatch between old file size and new data. To prevent the problem, let's mark inode dirty for FI_ATOMIC_COMMITTED Atomic write thread Writeback thread __writeback_single_inode write_inode f2fs_update_inode - skip i_size update f2fs_ioc_commit_atomic_write f2fs_commit_atomic_write set_inode_flag(inode, FI_ATOMIC_COMMITTED) f2fs_do_sync_file f2fs_fsync_node_pages - skip f2fs_update_inode since the inode is clean 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: Daeho Jeong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/f2fs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 5ae1c4aa3ae92..b54d681c6457d 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3000,6 +3000,7 @@ static inline void __mark_inode_dirty_flag(struct inode *inode, case FI_INLINE_DOTS: case FI_PIN_FILE: case FI_COMPRESS_RELEASED: + case FI_ATOMIC_COMMITTED: f2fs_mark_inode_dirty_sync(inode, true); } } -- 2.43.0