lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221208050808.2448146-1-zhoudan8@xiaomi.com>
Date:   Thu,  8 Dec 2022 13:08:08 +0800
From:   zhoudan8 <zhuqiandann@...il.com>
To:     jaegeuk@...nel.org
Cc:     chao@...nel.org, linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, zhoudan8 <zhoudan8@...omi.com>
Subject: [PATCH] f2fs: don't set FI_COMPRESS_RELEASED if file is not compressed

In compress_mode=user, f2fs_release_compress_blocks()
 does not verify whether it has been compressed and
 sets FI_COMPRESS_RELEASED directly. which will lead to
return -EINVAL after calling compress.
To fix it,let's do not set FI_COMPRESS_RELEASED if file
is not compressed.

Signed-off-by: zhoudan8 <zhoudan8@...omi.com>
---
 fs/f2fs/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 82cda1258227..f32910077df6 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3451,14 +3451,13 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
 	ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
 	if (ret)
 		goto out;
-
-	set_inode_flag(inode, FI_COMPRESS_RELEASED);
 	inode->i_ctime = current_time(inode);
 	f2fs_mark_inode_dirty_sync(inode, true);
 
 	if (!atomic_read(&F2FS_I(inode)->i_compr_blocks))
 		goto out;
 
+	set_inode_flag(inode, FI_COMPRESS_RELEASED);
 	f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
 	filemap_invalidate_lock(inode->i_mapping);
 
-- 
2.38.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ