Skip to content

Commit 567c4bf

Browse files
Daeho JeongJaegeuk Kim
authored andcommitted
f2fs: make file immutable even if releasing zero compression block
When we use F2FS_IOC_RELEASE_COMPRESS_BLOCKS ioctl, if we can't find any compressed blocks in the file even with large file size, the ioctl just ends up without changing the file's status as immutable. It makes the user, who expects that the file is immutable when it returns successfully, confused. Signed-off-by: Daeho Jeong <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 1f0b067 commit 567c4bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/f2fs/file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3535,14 +3535,14 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
35353535
if (ret)
35363536
goto out;
35373537

3538-
if (!F2FS_I(inode)->i_compr_blocks)
3539-
goto out;
3540-
35413538
F2FS_I(inode)->i_flags |= F2FS_IMMUTABLE_FL;
35423539
f2fs_set_inode_flags(inode);
35433540
inode->i_ctime = current_time(inode);
35443541
f2fs_mark_inode_dirty_sync(inode, true);
35453542

3543+
if (!F2FS_I(inode)->i_compr_blocks)
3544+
goto out;
3545+
35463546
down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
35473547
down_write(&F2FS_I(inode)->i_mmap_sem);
35483548

0 commit comments

Comments
 (0)