[f2fs-dev] [PATCH v2] f2fs: get the right gc victim section when section has several segments

2020-06-17 Thread Jack Qiu
Assume each section has 4 segment: .___. |_Segment0_|_..._|_Segment3_| . . . . .__. |_section0_| Segment 0~2 has 0 valid block, segment 3 has 512 valid blocks. It will fail if we want to gc

Re: [f2fs-dev] [PATCH] f2fs: avoid checkpatch error

2020-06-17 Thread Chao Yu
On 2020/6/17 3:02, Jaegeuk Kim wrote: > ERROR:INITIALISED_STATIC: do not initialise statics to NULL > > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net

Re: [f2fs-dev] [PATCH 4/4] lib: pass all needed include paths to libf2fs

2020-06-17 Thread Chao Yu
On 2020/6/16 2:08, Jaegeuk Kim wrote: > From: Rolf Eike Beer > > Otherwise the paths to uuid and blkid headers extracted from pkg-config are > not > respected. > > Signed-off-by: Rolf Eike Beer > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks,

Re: [f2fs-dev] [PATCH 1/4] lib: fix include path for uuid.h

2020-06-17 Thread Chao Yu
On 2020/6/16 2:08, Jaegeuk Kim wrote: > From: Rolf Eike Beer > > $ pkg-config --cflags uuid > -I/usr/include/uuid > > The "uuid/" directory is actually part of the include path. This usually still > works because most people have the path one level up in their default include > path. > >

Re: [f2fs-dev] [PATCH 3/4] lib: use ${libuuid_LIBS} instead of -luuid everywhere

2020-06-17 Thread Chao Yu
On 2020/6/16 2:08, Jaegeuk Kim wrote: > From: Rolf Eike Beer > > Otherwise linking will fail if the library is in an uncommon location or has a > non-standard name. > > Signed-off-by: Rolf Eike Beer > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks,

Re: [f2fs-dev] [PATCH 2/4] lib: fix include path for blkid.h

2020-06-17 Thread Chao Yu
On 2020/6/16 2:08, Jaegeuk Kim wrote: > From: Rolf Eike Beer > > $ pkg-config --cflags blkid > -I/usr/include/blkid > > The "blkid/" directory is actually part of the include path. This usually > still > works because most people have the path one level up in their default include > path. > >

[f2fs-dev] 回复: 回复: [PATCH] f2fs: fix a race condition between f2fs_write_end_io and f2fs_del_fsync_node_entry

2020-06-17 Thread Zac via Linux-f2fs-devel
> On 2020/6/18 10:39, Zac wrote: > > > >> On 2020/6/17 17:04, zhaowu...@wingtech.com wrote: > >>> From: Wuyun Zhao > >>> > >>> Under some condition, the __write_node_page will submit a page which > is > >> not > >>> f2fs_in_warm_node_list and will not call f2fs_add_fsync_node_entry. > >>> f2fs_gc

Re: [f2fs-dev] [PATCH v3] f2fs: use kfree() instead of kvfree() to free superblock data

2020-06-17 Thread Chao Yu
On 2020/6/16 1:58, Jaegeuk Kim wrote: > On 06/09, Eric Biggers wrote: >> On Wed, Jun 10, 2020 at 01:14:46AM +0300, Denis Efremov wrote: >>> Use kfree() instead of kvfree() to free super in read_raw_super_block() >>> because the memory is allocated with kzalloc() in the function. >>> Use kfree()

Re: [f2fs-dev] [PATCH 1/4] fs: introduce SB_INLINECRYPT

2020-06-17 Thread Eric Biggers
On Thu, Jun 18, 2020 at 11:19:12AM +1000, Dave Chinner wrote: > On Wed, Jun 17, 2020 at 07:57:29AM +, Satya Tangirala wrote: > > Introduce SB_INLINECRYPT, which is set by filesystems that wish to use > > blk-crypto for file content en/decryption. This flag maps to the > > '-o inlinecrypt'

[f2fs-dev] [PATCH v2] f2fs: fix a race condition between f2fs_write_end_io and f2fs_del_fsync_node_entry

2020-06-17 Thread zhaowuyun--- via Linux-f2fs-devel
From: Wuyun Zhao Under some condition, the __write_node_page will submit a page which is not f2fs_in_warm_node_list and will not call f2fs_add_fsync_node_entry. f2fs_gc continue to run to invoke f2fs_iget -> do_read_inode to read the same node page and set code node, which make

Re: [f2fs-dev] 回复: [PATCH] f2fs: fix a race condition between f2fs_write_end_io and f2fs_del_fsync_node_entry

2020-06-17 Thread Chao Yu
On 2020/6/18 10:39, Zac wrote: > >> On 2020/6/17 17:04, zhaowu...@wingtech.com wrote: >>> From: Wuyun Zhao >>> >>> Under some condition, the __write_node_page will submit a page which is >> not >>> f2fs_in_warm_node_list and will not call f2fs_add_fsync_node_entry. >>> f2fs_gc continue to run to

[f2fs-dev] 回复: [PATCH] f2fs: fix a race condition between f2fs_write_end_io and f2fs_del_fsync_node_entry

2020-06-17 Thread Zac via Linux-f2fs-devel
> On 2020/6/17 17:04, zhaowu...@wingtech.com wrote: > > From: Wuyun Zhao > > > > Under some condition, the __write_node_page will submit a page which is > not > > f2fs_in_warm_node_list and will not call f2fs_add_fsync_node_entry. > > f2fs_gc continue to run to invoke f2fs_iget -> do_read_inode

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Yafang Shao
On Thu, Jun 18, 2020 at 5:09 AM Chris Down wrote: > > Naresh Kamboju writes: > >After this patch applied the reported issue got fixed. > > Great! Thank you Naresh and Michal for helping to get to the bottom of this > :-) > > I'll send out a new version tomorrow with the fixes applied and both of

Re: [f2fs-dev] [PATCH 1/4] fs: introduce SB_INLINECRYPT

2020-06-17 Thread Dave Chinner
On Wed, Jun 17, 2020 at 07:57:29AM +, Satya Tangirala wrote: > Introduce SB_INLINECRYPT, which is set by filesystems that wish to use > blk-crypto for file content en/decryption. This flag maps to the > '-o inlinecrypt' mount option which multiple filesystems will implement, > and code in

[f2fs-dev] [PATCH AUTOSEL 4.14 016/108] f2fs: report delalloc reserve as non-free in statfs for project quota

2020-06-17 Thread Sasha Levin
From: Konstantin Khlebnikov [ Upstream commit baaa7ebf25c78c5cb712fac16b7f549100beddd3 ] This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. See the same fix in ext4 commit f06925c73942 ("ext4: report delalloc reserve

[f2fs-dev] [PATCH AUTOSEL 4.19 020/172] f2fs: report delalloc reserve as non-free in statfs for project quota

2020-06-17 Thread Sasha Levin
From: Konstantin Khlebnikov [ Upstream commit baaa7ebf25c78c5cb712fac16b7f549100beddd3 ] This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. See the same fix in ext4 commit f06925c73942 ("ext4: report delalloc reserve

[f2fs-dev] [PATCH AUTOSEL 5.4 248/266] f2fs: don't return vmalloc() memory from f2fs_kmalloc()

2020-06-17 Thread Sasha Levin
From: Eric Biggers [ Upstream commit 0b6d4ca04a86b9dababbb76e58d33c437e127b77 ] kmalloc() returns kmalloc'ed memory, and kvmalloc() returns either kmalloc'ed or vmalloc'ed memory. But the f2fs wrappers, f2fs_kmalloc() and f2fs_kvmalloc(), both return both kinds of memory. It's redundant to

[f2fs-dev] [PATCH AUTOSEL 5.4 078/266] f2fs: handle readonly filesystem in f2fs_ioc_shutdown()

2020-06-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit 8626441f05dc45a2f4693ee6863d02456ce39e60 ] If mountpoint is readonly, we should allow shutdowning filesystem successfully, this fixes issue found by generic/599 testcase of xfstest. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin

[f2fs-dev] [PATCH AUTOSEL 5.4 027/266] f2fs: report delalloc reserve as non-free in statfs for project quota

2020-06-17 Thread Sasha Levin
From: Konstantin Khlebnikov [ Upstream commit baaa7ebf25c78c5cb712fac16b7f549100beddd3 ] This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. See the same fix in ext4 commit f06925c73942 ("ext4: report delalloc reserve

[f2fs-dev] [PATCH AUTOSEL 5.7 360/388] f2fs: don't return vmalloc() memory from f2fs_kmalloc()

2020-06-17 Thread Sasha Levin
From: Eric Biggers [ Upstream commit 0b6d4ca04a86b9dababbb76e58d33c437e127b77 ] kmalloc() returns kmalloc'ed memory, and kvmalloc() returns either kmalloc'ed or vmalloc'ed memory. But the f2fs wrappers, f2fs_kmalloc() and f2fs_kvmalloc(), both return both kinds of memory. It's redundant to

[f2fs-dev] [PATCH AUTOSEL 5.7 188/388] f2fs: Fix wrong stub helper update_sit_info

2020-06-17 Thread Sasha Levin
From: YueHaibing [ Upstream commit 48abe91ac1ad27cd5a5709f983dcf58f2b9a6b70 ] update_sit_info should be f2fs_update_sit_info, otherwise build fails while no CONFIG_F2FS_STAT_FS. Fixes: fc7100ea2a52 ("f2fs: Add f2fs stats to sysfs") Signed-off-by: YueHaibing Reviewed-by: Chao Yu

[f2fs-dev] [PATCH AUTOSEL 5.7 190/388] f2fs: compress: fix zstd data corruption

2020-06-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit 1454c978efbb57b052670d50023f48c759d704ce ] During zstd compression, ZSTD_endStream() may return non-zero value because distination buffer is full, but there is still compressed data remained in intermediate buffer, it means that zstd algorithm can not save at

[f2fs-dev] [PATCH AUTOSEL 5.7 189/388] f2fs: fix potential use-after-free issue

2020-06-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit f3494345ce624b36109252a4bf5f00e51a46 ] In error path of f2fs_read_multi_pages(), it should let last referrer release decompress io context memory, otherwise, other referrer will cause use-after-free issue. Fixes: 4c8ff7095bef ("f2fs: support data

[f2fs-dev] [PATCH AUTOSEL 5.7 101/388] f2fs: handle readonly filesystem in f2fs_ioc_shutdown()

2020-06-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit 8626441f05dc45a2f4693ee6863d02456ce39e60 ] If mountpoint is readonly, we should allow shutdowning filesystem successfully, this fixes issue found by generic/599 testcase of xfstest. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin

[f2fs-dev] [PATCH AUTOSEL 5.7 035/388] f2fs: compress: let lz4 compressor handle output buffer budget properly

2020-06-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit f6644143c63f2eac88973f7fea087582579b0189 ] Commonly, in order to handle lz4 worst compress case, caller should allocate buffer with size of LZ4_compressBound(inputsize) for target compressed data storing, however in this case, if caller didn't allocate enough

[f2fs-dev] [PATCH AUTOSEL 5.7 036/388] f2fs: report delalloc reserve as non-free in statfs for project quota

2020-06-17 Thread Sasha Levin
From: Konstantin Khlebnikov [ Upstream commit baaa7ebf25c78c5cb712fac16b7f549100beddd3 ] This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. See the same fix in ext4 commit f06925c73942 ("ext4: report delalloc reserve

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Chris Down
Naresh Kamboju writes: After this patch applied the reported issue got fixed. Great! Thank you Naresh and Michal for helping to get to the bottom of this :-) I'll send out a new version tomorrow with the fixes applied and both of you credited in the changelog for the detection and fix.

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Naresh Kamboju
On Wed, 17 Jun 2020 at 21:36, Michal Hocko wrote: > > On Wed 17-06-20 21:23:05, Naresh Kamboju wrote: > > On Wed, 17 Jun 2020 at 19:41, Michal Hocko wrote: > > > > > > [Our emails have crossed] > > > > > > On Wed 17-06-20 14:57:58, Chris Down wrote: > > > > Naresh Kamboju writes: > > > > > mkfs

Re: [f2fs-dev] [PATCH 2/4] fscrypt: add inline encryption support

2020-06-17 Thread Jaegeuk Kim
On 06/17, Satya Tangirala wrote: > Add support for inline encryption to fs/crypto/. With "inline > encryption", the block layer handles the decryption/encryption as part > of the bio, instead of the filesystem doing the crypto itself via > Linux's crypto API. This model is needed in order to

Re: [f2fs-dev] [PATCH 3/4] f2fs: add inline encryption support

2020-06-17 Thread Jaegeuk Kim
On 06/17, Satya Tangirala wrote: > Wire up f2fs to support inline encryption via the helper functions which > fs/crypto/ now provides. This includes: > > - Adding a mount option 'inlinecrypt' which enables inline encryption > on encrypted files where it can be used. > > - Setting the

Re: [f2fs-dev] [PATCH 1/4] fs: introduce SB_INLINECRYPT

2020-06-17 Thread Jaegeuk Kim
On 06/17, Satya Tangirala wrote: > Introduce SB_INLINECRYPT, which is set by filesystems that wish to use > blk-crypto for file content en/decryption. This flag maps to the > '-o inlinecrypt' mount option which multiple filesystems will implement, > and code in fs/crypto/ needs to be able to check

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Michal Hocko
On Wed 17-06-20 21:23:05, Naresh Kamboju wrote: > On Wed, 17 Jun 2020 at 19:41, Michal Hocko wrote: > > > > [Our emails have crossed] > > > > On Wed 17-06-20 14:57:58, Chris Down wrote: > > > Naresh Kamboju writes: > > > > mkfs -t ext4 /dev/disk/by-id/ata-TOSHIBA_MG04ACA100N_Y8RQK14KF6XF > > > >

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Naresh Kamboju
On Wed, 17 Jun 2020 at 19:41, Michal Hocko wrote: > > [Our emails have crossed] > > On Wed 17-06-20 14:57:58, Chris Down wrote: > > Naresh Kamboju writes: > > > mkfs -t ext4 /dev/disk/by-id/ata-TOSHIBA_MG04ACA100N_Y8RQK14KF6XF > > > mke2fs 1.43.8 (1-Jan-2018) > > > Creating filesystem with

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Chris Down
Michal Hocko writes: and it makes some sense. Except for the root memcg where we do not account any memory. Adding if (mem_cgroup_is_root(memcg)) return false; should do the trick. The same is the case for mem_cgroup_below_low. Could you give it a try please just to confirm? Oh, of course :-)

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Michal Hocko
[Our emails have crossed] On Wed 17-06-20 14:57:58, Chris Down wrote: > Naresh Kamboju writes: > > mkfs -t ext4 /dev/disk/by-id/ata-TOSHIBA_MG04ACA100N_Y8RQK14KF6XF > > mke2fs 1.43.8 (1-Jan-2018) > > Creating filesystem with 244190646 4k blocks and 61054976 inodes > > Filesystem UUID:

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Chris Down
Naresh Kamboju writes: mkfs -t ext4 /dev/disk/by-id/ata-TOSHIBA_MG04ACA100N_Y8RQK14KF6XF mke2fs 1.43.8 (1-Jan-2018) Creating filesystem with 244190646 4k blocks and 61054976 inodes Filesystem UUID: 7c380766-0ed8-41ba-a0de-3c08e78f1891 Superblock backups stored on blocks: 32768, 98304, 163840,

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Michal Hocko
On Wed 17-06-20 19:07:20, Naresh Kamboju wrote: > On Thu, 21 May 2020 at 22:04, Michal Hocko wrote: > > > > On Thu 21-05-20 11:55:16, Michal Hocko wrote: > > > On Wed 20-05-20 20:09:06, Chris Down wrote: > > > > Hi Naresh, > > > > > > > > Naresh Kamboju writes: > > > > > As a part of

Re: [f2fs-dev] mm: mkfs.ext4 invoked oom-killer on i386 - pagecache_get_page

2020-06-17 Thread Naresh Kamboju
On Thu, 21 May 2020 at 22:04, Michal Hocko wrote: > > On Thu 21-05-20 11:55:16, Michal Hocko wrote: > > On Wed 20-05-20 20:09:06, Chris Down wrote: > > > Hi Naresh, > > > > > > Naresh Kamboju writes: > > > > As a part of investigation on this issue LKFT teammate Anders Roxell > > > > git bisected

Re: [f2fs-dev] [PATCH] f2fs: fix a race condition between f2fs_write_end_io and f2fs_del_fsync_node_entry

2020-06-17 Thread Chao Yu
On 2020/6/17 17:04, zhaowu...@wingtech.com wrote: > From: Wuyun Zhao > > Under some condition, the __write_node_page will submit a page which is not > f2fs_in_warm_node_list and will not call f2fs_add_fsync_node_entry. > f2fs_gc continue to run to invoke f2fs_iget -> do_read_inode to read the

[f2fs-dev] [PATCH] f2fs: use kfree() to free variables allocated by match_strdup()

2020-06-17 Thread Wang Xiaojun
Use kfree() instead of kvfree() to free variables allocated by match_strdup(). Because the memory is allocated with kmalloc inside match_strdup(). Signed-off-by: Wang Xiaojun --- fs/f2fs/super.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff

[f2fs-dev] [PATCH] f2fs: fix a race condition between f2fs_write_end_io and f2fs_del_fsync_node_entry

2020-06-17 Thread zhaowuyun--- via Linux-f2fs-devel
From: Wuyun Zhao Under some condition, the __write_node_page will submit a page which is not f2fs_in_warm_node_list and will not call f2fs_add_fsync_node_entry. f2fs_gc continue to run to invoke f2fs_iget -> do_read_inode to read the same node page and set code node, which make

[f2fs-dev] [PATCH 2/4] fscrypt: add inline encryption support

2020-06-17 Thread Satya Tangirala via Linux-f2fs-devel
Add support for inline encryption to fs/crypto/. With "inline encryption", the block layer handles the decryption/encryption as part of the bio, instead of the filesystem doing the crypto itself via Linux's crypto API. This model is needed in order to take advantage of the inline encryption

[f2fs-dev] [PATCH 0/4] Inline Encryption Support for fscrypt

2020-06-17 Thread Satya Tangirala via Linux-f2fs-devel
This patch series adds support for Inline Encryption to fscrypt, f2fs and ext4. It builds on the inline encryption support now present in the block layer, and has been rebased on v5.8-rc1. Patch 1 introduces the SB_INLINECRYPT sb options, which filesystems should set if they want to use

[f2fs-dev] [PATCH 1/4] fs: introduce SB_INLINECRYPT

2020-06-17 Thread Satya Tangirala via Linux-f2fs-devel
Introduce SB_INLINECRYPT, which is set by filesystems that wish to use blk-crypto for file content en/decryption. This flag maps to the '-o inlinecrypt' mount option which multiple filesystems will implement, and code in fs/crypto/ needs to be able to check for this mount option in a

[f2fs-dev] [PATCH 4/4] ext4: add inline encryption support

2020-06-17 Thread Satya Tangirala via Linux-f2fs-devel
From: Eric Biggers Wire up ext4 to support inline encryption via the helper functions which fs/crypto/ now provides. This includes: - Adding a mount option 'inlinecrypt' which enables inline encryption on encrypted files where it can be used. - Setting the bio_crypt_ctx on bios that will be

[f2fs-dev] [PATCH 3/4] f2fs: add inline encryption support

2020-06-17 Thread Satya Tangirala via Linux-f2fs-devel
Wire up f2fs to support inline encryption via the helper functions which fs/crypto/ now provides. This includes: - Adding a mount option 'inlinecrypt' which enables inline encryption on encrypted files where it can be used. - Setting the bio_crypt_ctx on bios that will be submitted to an