Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-10 Thread Daeho Jeong
Ok, I got it. Thanks for quick response~ :) 2020년 6월 11일 (목) 오전 10:56, Eric Biggers 님이 작성: > > On Thu, Jun 11, 2020 at 09:23:23AM +0900, Daeho Jeong wrote: > > Yes, I saw the implementation in vfs_write(). > > But if we use mnt_want_write_file() here, it'll call mnt_clone_write() > > internally if

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-10 Thread Eric Biggers
On Thu, Jun 11, 2020 at 09:23:23AM +0900, Daeho Jeong wrote: > Yes, I saw the implementation in vfs_write(). > But if we use mnt_want_write_file() here, it'll call mnt_clone_write() > internally if the file is already open in write mode. > Don't you think the below thing is needed? We can increase

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-10 Thread Daeho Jeong
Yes, I saw the implementation in vfs_write(). But if we use mnt_want_write_file() here, it'll call mnt_clone_write() internally if the file is already open in write mode. Don't you think the below thing is needed? We can increase the counter each of them, open and ioctl, like other filesystems such

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-10 Thread Eric Biggers
On Thu, Jun 11, 2020 at 08:53:10AM +0900, Daeho Jeong wrote: > > > > > Using FMODE_WRITE is more proper for this case, since we're going to > > > > > modify the data. But I think mnt_want_write_file() is still required > > > > > to prevent the filesystem from freezing or something else. > > > > > >

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-10 Thread Daeho Jeong
> > > > Using FMODE_WRITE is more proper for this case, since we're going to > > > > modify the data. But I think mnt_want_write_file() is still required > > > > to prevent the filesystem from freezing or something else. > > > > > > Right, the freezing check is actually still necessary. But gettin

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-10 Thread Daeho Jeong
> > > > > + > > > > > + if (f2fs_readonly(sbi->sb)) > > > > > + return -EROFS; > > > > > > > > Isn't this redundant with mnt_want_write_file()? > > > > > > > > Also, shouldn't write access to the file be required, i.e. > > > > (filp->f_mode & FMODE_WRITE)? Then the f2fs_readonly()

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-09 Thread Daeho Jeong
> > > > To prevent the file data from garbage collecting, the user needs to > > use pinfile ioctl and fallocate system call after creating the file. > > The sequence is like below. > > 1. create an empty file > > 2. pinfile > > 3. fallocate() > > Is that persistent? So the file will never be moved

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-09 Thread Eric Biggers
On Wed, Jun 10, 2020 at 11:05:46AM +0900, Daeho Jeong wrote: > > > Added a new ioctl to send discard commands or/and zero out > > > to whole data area of a regular file for security reason. > > > > With this ioctl available, what is the exact procedure to write and then > > later > > securely eras

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-09 Thread Daeho Jeong
> > Added a new ioctl to send discard commands or/and zero out > > to whole data area of a regular file for security reason. > > With this ioctl available, what is the exact procedure to write and then later > securely erase a file on f2fs? In particular, how can the user prevent f2fs > from makin

Re: [f2fs-dev] [PATCH] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

2020-06-09 Thread Eric Biggers
On Tue, Jun 09, 2020 at 03:01:37PM +0900, Daeho Jeong wrote: > From: Daeho Jeong > > Added a new ioctl to send discard commands or/and zero out > to whole data area of a regular file for security reason. With this ioctl available, what is the exact procedure to write and then later securely eras