Re: [f2fs-dev] [PATCH] f2fs: prevent compressed file from being disabled after releasing cblocks

From: Daeho Jeong
Date: Sun Aug 30 2020 - 23:55:43 EST


> - open(O_RDWR)
> - ioctl(FS_IOC_SETFLAGS, F2FS_COMPR_FL)
> - write()
> - ioctl(RELEASE_COMPRESS_BLOCKS) -- inode is immutable now
> - ioctl(FS_IOC_SETFLAGS, ~F2FS_COMPR_FL) -- Should we allow to update immutable inode?
> as we know, normally, immutable inode should deny open(O_WRONLY or O_RDWR) and later update.
>

For this case, with this patch we'll return -EINVAL for
ioctl(FS_IOC_SETFLAGS, ~F2FS_COMPR_FL).
I thought RESERVE_COMPRESS_BLOCKS ioctl is always required to get the
file to normal mode after RELEASE_COMPRESS_BLOCKS is called.