lkml.org 
[lkml]   [2022]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] f2fs: fix to check compression feature before enabling file compression
Date
From: Chao Yu <chao.yu@oppo.com>

This patch disallow to enable file compression in image which doesn't
support compression feature.

Signed-off-by: Chao Yu <chao.yu@oppo.com>
---
fs/f2fs/file.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 24f5b02c78e7..4a3f4eaa3fc5 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1872,6 +1872,8 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
if (!f2fs_disable_compressed_file(inode))
return -EINVAL;
} else {
+ if (!f2fs_sb_has_compression(F2FS_I_SB(inode)))
+ return -EOPNOTSUPP;
if (!f2fs_may_compress(inode))
return -EINVAL;
if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
--
2.36.1
\
 
 \ /
  Last update: 2022-08-04 15:43    [W:0.091 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site