[f2fs-dev] [PATCH 0/3] f2fs: fixes for FS_IOC_{GET,SET}FSLABEL

2019-08-15 Thread Eric Biggers
Fix some bugs in the f2fs implementation of the FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL ioctls. Eric Biggers (3): f2fs: fix buffer overruns in FS_IOC_{GET,SET}FSLABEL f2fs: fix copying too many bytes in FS_IOC_SETFSLABEL f2fs: add missing authorization check in FS_IOC_SETFSLABEL

[f2fs-dev] [PATCH 1/3] f2fs: fix buffer overruns in FS_IOC_{GET, SET}FSLABEL

2019-08-15 Thread Eric Biggers
From: Eric Biggers utf16s_to_utf8s() and utf8s_to_utf16s() take the number of characters, not the number of bytes. Fixes: 61a3da4d5ef8 ("f2fs: support FS_IOC_{GET,SET}FSLABEL") Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[f2fs-dev] [PATCH 3/3] f2fs: add missing authorization check in FS_IOC_SETFSLABEL

2019-08-15 Thread Eric Biggers
From: Eric Biggers FS_IOC_SETFSLABEL modifies the filesystem superblock, so it shouldn't be allowed to regular users. Require CAP_SYS_ADMIN, like xfs and btrfs do. Fixes: 61a3da4d5ef8 ("f2fs: support FS_IOC_{GET,SET}FSLABEL") Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 3 +++ 1 file

[f2fs-dev] [PATCH 2/3] f2fs: fix copying too many bytes in FS_IOC_SETFSLABEL

2019-08-15 Thread Eric Biggers
From: Eric Biggers Userspace provides a null-terminated string, so don't assume that the full FSLABEL_MAX bytes can always be copied. Fixes: 61a3da4d5ef8 ("f2fs: support FS_IOC_{GET,SET}FSLABEL") Signed-off-by: Eric Biggers --- fs/f2fs/file.c | 22 +- 1 file changed, 5

[PATCH] f2fs: fix to avoid data corruption by forbidding SSR overwrite

2019-08-15 Thread Chao Yu
There is one case can cause data corruption. - write 4k to fileA - fsync fileA, 4k data is writebacked to lbaA - write 4k to fileA - kworker flushs 4k to lbaB; dnode contain lbaB didn't be persisted yet - write 4k to fileB - kworker flush 4k to lbaA due to SSR - SPOR -> dnode with lbaA will be

Re: [f2fs-dev] [PATCH v2] f2fs_io: add get/setflags

2019-08-15 Thread Jaegeuk Kim
Signed-off-by: Jaegeuk Kim --- - Add + flags for now tools/f2fs_io/f2fs_io.c | 98 + tools/f2fs_io/f2fs_io.h | 14 ++ 2 files changed, 112 insertions(+) diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c index a5a9836..add40c4 100644 ---

Re: [f2fs-dev] [PATCH] f2fs_io: add get/setflags

2019-08-15 Thread Jaegeuk Kim
On 08/15, Jaegeuk Kim wrote: > On 08/12, Chao Yu wrote: > > On 2019/8/9 23:23, Jaegeuk Kim wrote: > > > From: Jaegeuk Kim > > > > > > Signed-off-by: Jaegeuk Kim > > > --- > > > tools/f2fs_io/f2fs_io.c | 91 + > > > tools/f2fs_io/f2fs_io.h | 14 +++ >

Re: [f2fs-dev] [PATCH] f2fs_io: add get/setflags

2019-08-15 Thread Jaegeuk Kim
On 08/12, Chao Yu wrote: > On 2019/8/9 23:23, Jaegeuk Kim wrote: > > From: Jaegeuk Kim > > > > Signed-off-by: Jaegeuk Kim > > --- > > tools/f2fs_io/f2fs_io.c | 91 + > > tools/f2fs_io/f2fs_io.h | 14 +++ > > 2 files changed, 105 insertions(+) > > >

Re: [f2fs-dev] [PATCH v2] mkfs.f2fs: check zeros in first 16MB for Android

2019-08-15 Thread Chao Yu
On 2019/8/16 9:02, Jaegeuk Kim wrote: > On 08/16, Chao Yu wrote: >> On 2019/8/16 6:21, Jaegeuk Kim wrote: >>> On 08/12, Chao Yu wrote: On 2019/8/9 23:12, Jaegeuk Kim wrote: > We actually don't need to issue trim on entire disk by checking first > blocks having zeros. In heap

Re: [f2fs-dev] [PATCH 2/4] fsck.f2fs: fix to check c.fix_on before repair

2019-08-15 Thread Chao Yu
On 2019/8/16 9:06, Jaegeuk Kim wrote: > On 08/12, Chao Yu wrote: >> We should always set c.bug_on whenever found a bug, then fix them >> if c.fix_on is on, otherwise, some bugs won't be shown unless we >> enable debug log. >> >> Signed-off-by: Chao Yu >> --- >> fsck/fsck.c | 137

Re: [f2fs-dev] [PATCH 2/4] fsck.f2fs: fix to check c.fix_on before repair

2019-08-15 Thread Jaegeuk Kim
On 08/12, Chao Yu wrote: > We should always set c.bug_on whenever found a bug, then fix them > if c.fix_on is on, otherwise, some bugs won't be shown unless we > enable debug log. > > Signed-off-by: Chao Yu > --- > fsck/fsck.c | 137 +++- > 1 file

Re: [f2fs-dev] [PATCH 1/4] fsck.f2fs: fix to recover out-of-border inline size

2019-08-15 Thread Jaegeuk Kim
On 08/15, Jaegeuk Kim wrote: > On 08/12, Chao Yu wrote: > > It tries to let fsck be noticed wrong inline size, and do the fix. > > > > Signed-off-by: Chao Yu > > --- > > fsck/fsck.c | 8 > > 1 file changed, 8 insertions(+) > > > > diff --git a/fsck/fsck.c b/fsck/fsck.c > > index

Re: [f2fs-dev] [PATCH v2] mkfs.f2fs: check zeros in first 16MB for Android

2019-08-15 Thread Jaegeuk Kim
On 08/16, Chao Yu wrote: > On 2019/8/16 6:21, Jaegeuk Kim wrote: > > On 08/12, Chao Yu wrote: > >> On 2019/8/9 23:12, Jaegeuk Kim wrote: > >>> We actually don't need to issue trim on entire disk by checking first > >>> blocks having zeros. > >> > >> In heap mode, we locate node log header to tail

Re: [f2fs-dev] [PATCH v2] mkfs.f2fs: check zeros in first 16MB for Android

2019-08-15 Thread Chao Yu
On 2019/8/16 6:21, Jaegeuk Kim wrote: > On 08/12, Chao Yu wrote: >> On 2019/8/9 23:12, Jaegeuk Kim wrote: >>> We actually don't need to issue trim on entire disk by checking first >>> blocks having zeros. >> >> In heap mode, we locate node log header to tail end of device, should we >> consider to

Re: [f2fs-dev] [PATCH 1/4] fsck.f2fs: fix to recover out-of-border inline size

2019-08-15 Thread Jaegeuk Kim
On 08/12, Chao Yu wrote: > It tries to let fsck be noticed wrong inline size, and do the fix. > > Signed-off-by: Chao Yu > --- > fsck/fsck.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/fsck/fsck.c b/fsck/fsck.c > index d53317c..7eb599d 100644 > --- a/fsck/fsck.c > +++

Re: [f2fs-dev] [PATCH] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-15 Thread James Morris
On Thu, 15 Aug 2019, Mark Salyzyn wrote: > Good Idea, but using the same argument structure for set and get I would be > concerned about the loss of compiler protection for the buffer argument; Agreed, I missed that. > struct getxattr_args { > struct dentry *dentry; > struct inode

Re: [f2fs-dev] [PATCH v2] mkfs.f2fs: check zeros in first 16MB for Android

2019-08-15 Thread Jaegeuk Kim
On 08/12, Chao Yu wrote: > On 2019/8/9 23:12, Jaegeuk Kim wrote: > > We actually don't need to issue trim on entire disk by checking first > > blocks having zeros. > > In heap mode, we locate node log header to tail end of device, should we > consider to check block contain according to heap

Re: [f2fs-dev] [PATCH] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-15 Thread Greg Kroah-Hartman
On Fri, Aug 16, 2019 at 05:20:36AM +1000, James Morris wrote: > On Tue, 13 Aug 2019, Greg Kroah-Hartman wrote: > > > On Mon, Aug 12, 2019 at 12:32:49PM -0700, Mark Salyzyn wrote: > > > --- a/include/linux/xattr.h > > > +++ b/include/linux/xattr.h > > > @@ -30,10 +30,10 @@ struct xattr_handler { >

Re: [f2fs-dev] [PATCH] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-15 Thread James Morris
On Tue, 13 Aug 2019, Greg Kroah-Hartman wrote: > On Mon, Aug 12, 2019 at 12:32:49PM -0700, Mark Salyzyn wrote: > > --- a/include/linux/xattr.h > > +++ b/include/linux/xattr.h > > @@ -30,10 +30,10 @@ struct xattr_handler { > > const char *prefix; > > int flags; /* fs private flags */

[f2fs-dev] [PATCH v4] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-15 Thread Mark Salyzyn via Linux-f2fs-devel
Add a flag option to get xattr method that could have a bit flag of XATTR_NOSECURITY passed to it. XATTR_NOSECURITY is generally then set in the __vfs_getxattr path. This handles the case of a union filesystem driver that is being requested by the security layer to report back the xattr data.

Re: [f2fs-dev] [PATCH v2] Add flags option to get xattr method paired to __vfs_getxattr

2019-08-15 Thread Jan Kara
On Wed 14-08-19 07:54:16, Mark Salyzyn wrote: > On 8/14/19 4:00 AM, Jan Kara wrote: > > On Tue 13-08-19 07:55:06, Mark Salyzyn wrote: > > ... > > > diff --git a/fs/xattr.c b/fs/xattr.c > > > index 90dd78f0eb27..71f887518d6f 100644 > > > --- a/fs/xattr.c > > > +++ b/fs/xattr.c > > ... > > >

[PATCH 2/3] f2fs: use wrapped f2fs_cp_error()

2019-08-15 Thread Chao Yu
Just cleanup, no logic change. Signed-off-by: Chao Yu --- fs/f2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 5d78f2db7a67..88af85e0db62 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -706,7 +706,7 @@ void

[PATCH 3/3] f2fs: fix to use more generic EOPNOTSUPP

2019-08-15 Thread Chao Yu
EOPNOTSUPP is widely used as error number indicating operation is not supported in syscall, and ENOTSUPP was defined and only used for NFSv3 protocol, so use EOPNOTSUPP instead. Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up") Signed-off-by: Chao Yu --- fs/f2fs/file.c |

[PATCH 1/3] f2fs: use wrapped IS_SWAPFILE()

2019-08-15 Thread Chao Yu
Just cleanup, no logic change. Signed-off-by: Chao Yu --- fs/f2fs/f2fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 73e007dca3bb..d2b718e33f88 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3706,7 +3706,7 @@ static inline bool

Re: [f2fs-dev] [PATCH 2/2] mkfs.f2fs: add VM disk files to hot data types

2019-08-15 Thread Chao Yu
Hi Ju Hyung, On 2019/8/14 17:22, Ju Hyung Park wrote: > Hi Chao, > > You're right and Android will never use those types. > > But then again, what's the point of separating the list? I'm just thinking to use extension list space more efficiently to avoid free slot exhaustion. And in android,