[PATCH 1/2] f2fs: immutable file can have null address in compressed chunk

Jaegeuk Kim
2021-05-21T19:02:25Z

If we released compressed blocks having an immutable bit, we can see less
number of compressed block addresses. Let's fix wrong BUG_ON.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/compress.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index d4f7371fb0d8..1189740aa141 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -927,7 +927,8 @@ static int __f2fs_cluster_blocks(struct inode *inode,
}
}

- f2fs_bug_on(F2FS_I_SB(inode), !compr && ret != cluster_size);
+ f2fs_bug_on(F2FS_I_SB(inode),
+ !compr && ret != cluster_size && !IS_IMMUTABLE(inode));
}
fail:
f2fs_put_dnode(&dn);
--
2.31.1.818.g46aad6cb9e-goog