Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl

2020-10-15 Thread Daeho Jeong
> mnt_want_write_file() checks for write permission to the mount, not to the > file. > > I think this ioctl wants what f2fs_sec_trim_file() does: > > if (!(filp->f_mode & FMODE_WRITE)) > return -EBADF; > > file_start_write(filp); > inode_lock(inode); >

Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl

2020-10-14 Thread Eric Biggers
On Wed, Oct 14, 2020 at 11:27:30AM +0900, Daeho Jeong wrote: > > f2fs_readonly() is redundant with mnt_want_write_file(). > > > > Also, shouldn't this require a writable file descriptor? As-is, this ioctl > > can > > be called on a file owned by another user, as long as the caller has read > > ac

Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl

2020-10-14 Thread Daeho Jeong
> f2fs_readonly() is redundant with mnt_want_write_file(). > > Also, shouldn't this require a writable file descriptor? As-is, this ioctl > can > be called on a file owned by another user, as long as the caller has read > access. > > Note: if you change this to require a writable file descriptor,

Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl

2020-10-12 Thread Eric Biggers
On Tue, Oct 13, 2020 at 11:24:29AM +0900, Daeho Jeong wrote: > +static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) > +{ > + struct inode *inode = file_inode(filp); > + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > + struct f2fs_comp_option option; > + int