All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
@ 2026-10-09  9:53 Joanne Chang via Linux-f2fs-devel
  2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joanne Chang via Linux-f2fs-devel @ 2026-10-09  9:53 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: Joanne Chang, linux-f2fs-devel

Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
compressed file") updated f2fs_should_update_outplace() to always
return true for compressed files. However, this function is also
called during f2fs_ioc_set_pin_file() validation, so pinning an
empty file with compression enabled now fails with -EINVAL before the
compression flag can be stripped.

Fix this by guarding the f2fs_compressed_file(inode) check with fio in
f2fs_should_update_outplace(). This preserves forced OPU for actual
compressed writes (fio != NULL), while allowing f2fs_ioc_set_pin_file()
(fio == NULL) to proceed to f2fs_disable_compressed_file(inode).

Fixes: a64a3fec11e7 ("f2fs: force out-place update for all writes on compressed file")
Assisted-by: LLM
Signed-off-by: Joanne Chang <joannechien@google.com>
---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2613e8821af6..1d071e7cb1c2 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3150,7 +3150,7 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
 	 * If IO comes from compressed write path and fallback to raw write,
 	 * force out‑place to prevent metadata‑data inconsistency.
 	 */
-	if (f2fs_compressed_file(inode))
+	if (fio && f2fs_compressed_file(inode))
 		return true;
 
 	/* swap file is migrating in aligned write mode */
-- 
2.56.0.170.g584c36229d-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-13 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  9:53 [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files Joanne Chang via Linux-f2fs-devel
2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
2026-10-12  9:27   ` Joanne Chang via Linux-f2fs-devel
2026-10-12  9:38     ` Chao Yu via Linux-f2fs-devel
2026-10-12  9:40 ` Chao Yu via Linux-f2fs-devel
2026-10-13 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.