If a file has FI_COMPRESS_RELEASED, all writes for it should not be
allowed.
Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
Signed-off-by: Qi Han <hanqi@vivo.com>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
 
        inode_lock(inode);
 
+       if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
+               err = -EINVAL;
+               goto unlock_out;
+       }
+
        /* if in-place-update policy is enabled, don't waste time here */
        set_inode_flag(inode, FI_OPU_WRITE);
        if (f2fs_should_update_inplace(inode, NULL)) {
        clear_inode_flag(inode, FI_SKIP_WRITES);
 out:
        clear_inode_flag(inode, FI_OPU_WRITE);
+unlock_out:
        inode_unlock(inode);
        if (!err)
                range->len = (u64)total << PAGE_SHIFT;