Re: [PATCH] f2fs: read page index before freeing

2018-11-26 Thread Chao Yu
On 2018/11/27 8:22, PanBian wrote: > On Mon, Nov 26, 2018 at 07:07:08PM +0800, Chao Yu wrote: >> On 2018/11/26 18:28, PanBian wrote: >>> On Mon, Nov 26, 2018 at 05:13:53PM +0800, Chao Yu wrote: >>>> Hi Pan, >>>> >>>> On 2018/11/22 18:58,

Re: [PATCH] f2fs: read page index before freeing

2018-11-26 Thread Chao Yu
Hi Pan, On 2018/11/22 18:58, Pan Bian wrote: > The function truncate_node frees the page with f2fs_put_page. However, > the page index is read after that. So, the patch reads the index before > freeing the page. I notice that you found another use-after-free bug in ext4, out of curiosity, I'd

Re: [PATCH] f2fs: read page index before freeing

2018-11-22 Thread Chao Yu
drop obsolete node page when it is truncated") Cc: > > Signed-off-by: Pan Bian Reviewed-by: Chao Yu Thanks,

[PATCH v2] f2fs: add bio cache for IPU

2018-11-18 Thread Chao Yu
1,0)/(251,0), rw = WRITE(S), NODE, sector = 57352, size = 4096 After: f2fs_submit_write_bio: dev = (251,0)/(251,0), rw = WRITE(S), DATA, sector = 65544, size = 65536 f2fs_submit_write_bio: dev = (251,0)/(251,0), rw = WRITE(S), NODE, sector = 57368, size = 4096 Signed-off-by: Chao Yu --- v2: - su

[PATCH] f2fs: add to account direct IO

2018-10-31 Thread Chao Yu
This patch adds f2fs_dio_submit_bio() to hook submit_io/end_io functions in direct IO path, in order to account DIO. Later, we will add this count into is_idle() to let background GC/Discard thread be aware of DIO. Signed-off-by: Chao Yu --- fs/f2fs/data.c | 51

Re: [f2fs-dev] [PATCH] f2fs: clear cold data flag if IO is not counted

2018-10-15 Thread Chao Yu
On 2018/10/11 5:22, Jaegeuk Kim wrote: > If we clear the cold data flag out of the writeback flow, we can miscount > -1 by end_io. I didn't get it, which count do you mean? Thanks, > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/data.c | 4 > 1 file changed, 4 deletions(-) > > diff

Re: [f2fs-dev] [PATCH] f2fs: fix quota info to adjust recovered data

2018-09-30 Thread Chao Yu
On 2018-10-1 9:27, Jaegeuk Kim wrote: > On 10/01, Chao Yu wrote: >> On 2018-10-1 7:58, Jaegeuk Kim wrote: >>> On 09/29, Chao Yu wrote: >>>> On 2018/9/29 7:40, Jaegeuk Kim wrote: >>>>> Testing other fix. >>>>> >>>>> --

[PATCH 1/2] f2fs: add to account meta IO

2018-09-29 Thread Chao Yu
This patch supports to account meta IO, it enables to show write IO from f2fs more comprehensively via 'status' debugfs entry. Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 13 + fs/f2fs/f2fs.h| 15 +++ fs/f2fs/segment.c | 1 + 3 files changed, 29 insertions

[PATCH v3] Revert: "f2fs: check last page index in cached bio to decide submission"

2018-09-27 Thread Chao Yu
From: Chao Yu There is one case that we can leave bio in f2fs, result in hanging page writeback waiter. Thread AThread B - f2fs_write_cache_pages - f2fs_submit_page_write page #0 cached in bio #0 of cold log - f2fs_submit_page_write page #1 cached in bio #1

Re: [f2fs-dev] [PATCH 2/2 v3] f2fs: avoid f2fs_bug_on if f2fs_get_meta_page_nofail got EIO

2018-09-27 Thread Chao Yu
On 2018-9-21 5:48, Jaegeuk Kim wrote: > This patch avoids BUG_ON when f2fs_get_meta_page_nofail got EIO during > xfstests/generic/475. > > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks,

Re: [PATCH v3] f2fs: submit cached bio to avoid endless PageWriteback

2018-09-25 Thread Chao Yu
On 2018/9/26 8:20, Jaegeuk Kim wrote: > On 09/21, Chao Yu wrote: >> On 2018/9/18 10:14, Chao Yu wrote: >>> On 2018/9/18 10:02, Jaegeuk Kim wrote: >>>> On 09/18, Chao Yu wrote: >>>>> On 2018/9/18 9:37, Jaegeuk Kim wrote: >>>>>> On 09/

Re: [PATCH] jfs: remove redundant dquot_initialize() in jfs_evict_inode()

2018-09-20 Thread Chao Yu
On 2018/9/20 22:24, Dave Kleikamp wrote: > On 9/20/18 9:18 AM, Chao Yu wrote: >> Ping, >> >> Any comments? > > Sorry for putting it off. It looks good to me. I'll push it upstream. Thanks for your review. ;) Thanks, > > Thanks, > Dave > >> >&

Re: [PATCH] jfs: remove redundant dquot_initialize() in jfs_evict_inode()

2018-09-20 Thread Chao Yu
Ping, Any comments? On 2018/9/17 15:12, Chao Yu wrote: > We don't need to call dquot_initialize() twice in jfs_evict_inode(), > remove one of them for cleanup. > > Signed-off-by: Chao Yu > --- > fs/jfs/inode.c | 1 - > 1 file changed, 1 deletion(-) > > diff --gi

Re: [PATCH] f2fs: avoid GC causing encrypted file corrupted

2018-09-18 Thread Chao Yu
t; f2fs_wait_on_page_writeback to avoid racing between GC and flush. > > Signed-off-by: Yunlong Song Reviewed-by: Chao Yu Thanks,

Re: [PATCH] ext4: fix to propagate error from dquot_initialize()

2018-09-17 Thread Chao Yu
Hi Shilong, On 2018/9/17 16:18, Wang Shilong wrote: > Hi Chao, > >    I sent a early patch  series which included this but forgot  to send to > f2fs list.. > https://patchwork.ozlabs.org/patch/968759/ Oh, sorry, I didn't notice that one. To all, please ignore this reduplicated one. > > It

[PATCH] ext4: fix to propagate error from dquot_initialize()

2018-09-17 Thread Chao Yu
In ext4_ioctl_setproject(), we forgot to check error return from dquot_initialize(), if we ignore such error, later, quota info can be out-of-update, fix it. Signed-off-by: Chao Yu --- fs/ext4/ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/ioctl.c b/fs

[PATCH] jfs: remove redundant dquot_initialize() in jfs_evict_inode()

2018-09-17 Thread Chao Yu
We don't need to call dquot_initialize() twice in jfs_evict_inode(), remove one of them for cleanup. Signed-off-by: Chao Yu --- fs/jfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 054cc761b426..805ae9e8944a 100644 --- a/fs/jfs/inode.c +++ b/fs

Re: [PATCH] Revert "staging: erofs: disable compiling temporarile"

2018-09-12 Thread Chao Yu
Hi Stephen, On 2018/9/12 15:34, Stephen Rothwell wrote: > Hi Chao, > > On Wed, 12 Sep 2018 15:19:16 +0800 Chao Yu wrote: >> >> To make sure, did -next tree enable erofs compiling now? > > Yes, from yesterday. Great, thanks for your help. :) > >> Xiang has

[PATCH] f2fs: submit cached bio to avoid endless PageWriteback

2018-09-11 Thread Chao Yu
When migrating encrypted block from background GC thread, we only add them into f2fs inner bio cache, but forget to submit the cached bio, it may cause potential deadlock when we are waiting page writebacked, fix it. Signed-off-by: Chao Yu --- fs/f2fs/gc.c | 42

Re: [PATCH 2/2] f2fs: fix to avoid quota inode leak in ->put_super

2018-09-07 Thread Chao Yu
I can see it in dev, thanks for merging. ;) On 2018/9/8 6:38, Jaegeuk Kim wrote: > I merged as one. Please check dev. :) > > On 09/06, Chao Yu wrote: >> generic/019 reports below error: >> >> __quota_error: 1160 callbacks suppressed >> Quota error (device zram1

[PATCH v7] f2fs: guarantee journalled quota data by checkpoint

2018-09-07 Thread Chao Yu
From: Chao Yu For journalled quota mode, let checkpoint to flush dquot dirty data and quota file data to guarntee persistence of all quota sysfile in last checkpoint, by this way, we can avoid corrupting quota sysfile when encountering SPO. The implementation is as below: 1. add a global state

Re: [PATCH v2] f2fs: fix to avoid NULL pointer dereference on se->discard_map

2018-09-04 Thread Chao Yu
On 2018/9/4 23:25, Vicente Bergas wrote: > On Mon, Sep 3, 2018 at 9:52 PM, Chao Yu wrote: >> From: Chao Yu >> >> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D200951data=02%7C01%7C%7Cc2be7ee866b

Re: [PATCH 1/2] f2fs: fix to avoid quota inode leak in ->put_super

2018-08-20 Thread Chao Yu
On 2018/8/18 23:16, Jaegeuk Kim wrote: > On 08/17, Chao Yu wrote: >> generic/019 reports below error: >> >> __quota_error: 1160 callbacks suppressed >> Quota error (device zram1): write_blk: dquota write failed >> Quota error (device zram1): qtree_writ

Re: [f2fs-dev] [PATCH v3] f2fs: fix performance issue observed with multi-thread sequential read

2018-08-14 Thread Chao Yu
On 2018/8/14 12:04, Jaegeuk Kim wrote: > On 08/14, Chao Yu wrote: >> On 2018/8/14 4:11, Jaegeuk Kim wrote: >>> On 08/13, Chao Yu wrote: >>>> Hi Jaegeuk, >>>> >>>> On 2018/8/11 2:56, Jaegeuk Kim wrote: >>>>> This reverts the co

[PATCH] f2fs: fix use-after-free of dicard command entry

2018-08-07 Thread Chao Yu
ent.c:2550 __issue_discard_cmd_range() warn: 'dc' was already freed. In order to fix this issue, let's get error from __submit_discard_cmd(), and release current discard command after we referenced next one. Reported-by: Dan Carpenter Signed-off-by: Chao Yu --- fs/f2fs/segm

Re: [PATCH] drivers/staging: Remove some unneeded semicolon

2018-08-05 Thread Chao Yu
Hi Xiang, On 2018/8/6 9:27, Gao Xiang wrote: > Hi Jiang, > > On 2018/8/5 21:57, zhong jiang wrote: >> That semicolons are unneeded, JUst remove them. >> >> Signed-off-by: zhong jiang > > Thanks for your patch. Since erofs and gasket are different feature, it is > better to seperate into two

Re: [PATCH] staging: erofs: fix if assignment style issue

2018-08-05 Thread Chao Yu
On 2018/8/5 23:21, Kristaps Čivkulis wrote: > Fix coding style issue "do not use assignment in if condition" > detected by checkpatch.pl. > > Signed-off-by: Kristaps Čivkulis Reviewed-by: Chao Yu Thanks,

Re: linux-next: build failure after merge of the staging tree

2018-08-02 Thread Chao Yu
On 2018/8/2 15:14, Greg KH wrote: > On Thu, Aug 02, 2018 at 03:01:59PM +0800, Chao Yu wrote: >> Hi Greg, >> >> On 2018/8/2 14:15, Greg KH wrote: >>> On Wed, Aug 01, 2018 at 05:09:13PM +0800, Chao Yu wrote: >>>> Hi Stephen, >>>> >

Re: linux-next: build failure after merge of the staging tree

2018-08-02 Thread Chao Yu
Hi Greg, On 2018/8/2 14:15, Greg KH wrote: > On Wed, Aug 01, 2018 at 05:09:13PM +0800, Chao Yu wrote: >> Hi Stephen, >> >> On 2018/7/30 14:31, Gao Xiang wrote: >>> Hi Stephen, >>> >>> On 2018/7/30 14:16, Stephen Rothwell wrote: >>>> Hi G

Re: linux-next: build failure after merge of the staging tree

2018-08-02 Thread Chao Yu
Hi Stephen, Sorry, yesterday I missed this email due to my email filter. On 2018/8/1 23:07, Stephen Rothwell wrote: > Hi Chao, > > On Wed, 1 Aug 2018 17:09:13 +0800 Chao Yu wrote: >> >> Xiang has submitted several patches as below to fix compiling error on -next >&g

Re: linux-next: build failure after merge of the staging tree

2018-08-01 Thread Chao Yu
Hi Stephen, On 2018/7/30 14:31, Gao Xiang wrote: > Hi Stephen, > > On 2018/7/30 14:16, Stephen Rothwell wrote: >> Hi Greg, >> >> After merging the staging tree, today's linux-next build (x86_64 >> allmodconfig) failed like this: >> >> drivers/staging/erofs/super.c: In function

Re: [PATCH] f2fs: avoid race between zero_range and background GC

2018-07-27 Thread Chao Yu
On 2018/7/27 18:29, Jaegeuk Kim wrote: > On 07/26, Chao Yu wrote: >> Thread A Background GC >> - f2fs_zero_range >> - truncate_pagecache_range >> - gc_data_segment >>

[PATCH 1/4] f2fs: don't keep meta pages used for block migration

2018-07-27 Thread Chao Yu
For migration of encrypted inode's block, we load data of encrypted block into meta inode's page cache, after checkpoint, those all intermediate pages should be clean, and no one will read them again, so let's just release them for more memory. Signed-off-by: Chao Yu --- fs/f2fs/checkpoint.c

[PATCH 4/4] f2fs: fix to spread clear_cold_data()

2018-07-27 Thread Chao Yu
We need to drop PG_checked flag on page as well when we clear PG_uptodate flag, in order to avoid treating the page as GCing one later. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu --- fs/f2fs/data.c| 8 +++- fs/f2fs/dir.c | 1 + fs/f2fs/segment.c | 4 +++- 3 files changed, 11

[PATCH 3/4] f2fs: fix avoid race between truncate and background GC

2018-07-27 Thread Chao Yu
- set_cold_data - f2fs_truncate - f2fs_setattr isize to 4k - read 4k <--- hit data in cached page #0 Above race condition can cause read out invalid data in a truncated page, fix it by i_gc_rwsem[WRITE] lock. Signed-off-by: Chao Yu --- fs/f2fs/data.c |

Re: [f2fs-dev] [PATCH] f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc

2018-07-25 Thread Chao Yu
On 2018/7/25 11:22, Jaegeuk Kim wrote: > The f2fs_gc() called by f2fs_balance_fs() requires to be called outside of > fi->i_gc_rwsem[WRITE], since f2fs_gc() can try to grab it in a loop. It seems there are other paths having the same issue, how about fixing all of them in this patch? Thanks, >

Re: [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-25 Thread Chao Yu
On 2018/7/24 23:19, Yunlong Song wrote: > > > On 2018/7/24 22:17, Chao Yu wrote: >> On 2018/7/24 21:39, Yunlong Song wrote: >>> >>> On 2018/7/24 21:11, Chao Yu wrote: >>>> On 2018/7/23 22:10, Yunlong Song wrote: >>>>> If f2fs abo

[PATCH] f2fs: fix to restrict mount condition when without CONFIG_QUOTA

2018-07-25 Thread Chao Yu
From: Chao Yu Like quota_ino feature, we need to reject mounting RDWR with image which enables project_quota feature when there is no CONFIG_QUOTA be set in kernel. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/f2fs/super.c b/fs/f2fs

Re: [f2fs-dev] [PATCH] f2fs: fix 32-bit format string warning

2018-07-25 Thread Chao Yu
On 2018/7/24 17:34, Arnd Bergmann wrote: > On 32-bit targets, size_t is often 'unsigned int', so printing it as %lu > causes a warning: > > fs/f2fs/inode.c: In function 'sanity_check_inode': > fs/f2fs/inode.c:247:4: error: format '%lu' expects argument of type 'long > unsigned int', but argument

[PATCH v4 1/2] f2fs: fix to avoid broken of dnode block list

2018-07-25 Thread Chao Yu
see db corruption becase of this. We can excuse to lose the last transaction." Finally, we decide to keep original implementation of atomic write interface sematics that we don't wait all dnode writeback before preflush+fua submission. Signed-off-by: Chao Yu --- v4: - add test number with A

[PATCH v4 2/2] f2fs: let checkpoint flush dnode page of regular

2018-07-25 Thread Chao Yu
of dnode page can be elimitnated, making fsyncer only need to wait for sync IO. Signed-off-by: Chao Yu --- v4: - rebase to last dev-test. fs/f2fs/node.c| 8 +++- fs/f2fs/node.h| 5 + fs/f2fs/segment.c | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/f2fs

Re: [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-24 Thread Chao Yu
On 2018/7/24 21:39, Yunlong Song wrote: > > > On 2018/7/24 21:11, Chao Yu wrote: >> On 2018/7/23 22:10, Yunlong Song wrote: >>> If f2fs aborts BG_GC, then the section bit of victim_secmap will be set, >>> which will cause the section skipped in the future get_vic

Re: [PATCH 2/5] f2fs: add cur_victim_sec for BG_GC to avoid skipping BG_GC victim

2018-07-24 Thread Chao Yu
On 2018/7/23 22:10, Yunlong Song wrote: > If f2fs aborts BG_GC, then the section bit of victim_secmap will be set, > which will cause the section skipped in the future get_victim of BG_GC. > In a worst case that each section in the victim_secmap is set and there > are enough free sections (so

Re: [PATCH v2] f2fs: clear the remaining prefree_map of the section

2018-07-17 Thread Chao Yu
On 2018/7/16 18:03, Yunlong Song wrote: > For the case when sbi->segs_per_sec > 1 with lfs mode, take > section:segment = 5 for example, if the section prefree_map is > ...previous section | current section (1 1 0 1 1) | next section..., > then the start = x, end = x + 1, after start = start_segno

Re: [PATCH 5/5] f2fs: do not __punch_discard_cmd in lfs mode

2018-07-12 Thread Chao Yu
On 2018/7/12 23:09, Yunlong Song wrote: > In lfs mode, it is better to submit and wait for discard of the > new_blkaddr's overall section, rather than punch it which makes > more small discards and is not friendly with flash alignment. And > f2fs does not have to wait discard of each new_blkaddr

Re: [f2fs-dev] [PATCH 2/4] f2fs: allow wrong configure dio to buffered write

2018-07-09 Thread Chao Yu
On 2018/7/7 5:09, Jaegeuk Kim wrote: > This fixes to support unaligned dio as buffered writes. Should we return -EINVAL as manual of write said: EINVAL fd is attached to an object which is unsuitable for writing; or the file was opened with the O_DIRECT flag, and either the address specified

[PATCH] f2fs: enable real-time discard by default

2018-07-05 Thread Chao Yu
f2fs is focused on flash based storage, so let's enable real-time discard by default, if user don't want to enable it, 'nodiscard' mount option should be used on mount. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/f2fs

[PATCH v2 1/2] f2fs: fix to avoid broken of dnode block list

2018-07-04 Thread Chao Yu
by out-of-order IO submission due to IO scheduler or driver. Signed-off-by: Chao Yu --- v2: add missing definition modification in f2fs.h. fs/f2fs/f2fs.h | 2 +- fs/f2fs/file.c | 17 - fs/f2fs/node.c | 4 ++-- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/fs/f2fs

Re: [PATCH] f2fs: Replace strncpy with memcpy

2018-07-01 Thread Chao Yu
On 2018/7/2 10:16, Guenter Roeck wrote: > On 07/01/2018 06:53 PM, Chao Yu wrote: >> On 2018/7/2 4:57, Guenter Roeck wrote: >>> gcc 8.1.0 complains: >>> >>> fs/f2fs/namei.c: In function 'f2fs_update_extension_list': >>> fs/f2fs/namei.c:257:3: warni

[PATCH v2 2/2] f2fs: fix to do sanity check with extra_attr feature

2018-06-25 Thread Chao Yu
From: Chao Yu If FI_EXTRA_ATTR is set in inode by fuzzing, inode.i_addr[0] will be parsed as inode.i_extra_isize, then in __recover_inline_status, inline data address will beyond boundary of page, result in accessing invalid memory. So in this condition, during reading inode page, let's do

[PATCH v2] f2fs: disable f2fs_check_rb_tree_consistence

2018-06-22 Thread Chao Yu
do not choose to kill it directly, instead, adding an flag to disable the check now, if there is related code change, we can reuse it to detect bugs. Signed-off-by: Yunlei He Signed-off-by: Chao Yu --- v2: use unlikely suggested by Jaegeuk. fs/f2fs/f2fs.h| 1 + fs/f2fs/segment.c | 10

[PATCH 1/2] f2fs: relocate readdir_ra configure initialization

2018-06-11 Thread Chao Yu
readdir_ra is sysfs configuration instead of mount option, so it should not be initialized in default_options(), otherwise after remount, it can be reset to be enabled which may not as user wish, so let's move it to f2fs_tuning_parameters(). Signed-off-by: Chao Yu --- fs/f2fs/super.c | 3 ++- 1

[PATCH 2/2] f2fs: fix error path of fill_super

2018-06-11 Thread Chao Yu
In fill_super, if root inode's attribute is incorrect, we need to call f2fs_destroy_stats to release stats memory. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 19ef966a99e9..a790dae6c16f

[PATCH v2 2/2] f2fs: fix to update mtime correctly

2018-06-04 Thread Chao Yu
From: Chao Yu If we change system time to the past, get_mtime() will return a overflowed time, and SIT_I(sbi)->max_mtime will be udpated incorrectly, this patch fixes the two issues. Signed-off-by: Chao Yu --- v2: - fix to correct return value of get_mtime(). fs/f2fs/checkpoint.c | 2 +-

[PATCH 1/2] f2fs: fix to let caller retry allocating block address

2018-05-28 Thread Chao Yu
From: Chao Yu <yuch...@huawei.com> Configure io_bits with 2 and enable LFS mode, generic/013 reports below dmesg: BUG: unable to handle kernel NULL pointer dereference at 0104 *pdpt = 29b7b001 *pde = Oops: 0002 [#1] PREEMPT SMP Modules linked in: crc32_generi

[PATCH 2/2] f2fs: fix to avoid accessing cross the boundary

2018-05-28 Thread Chao Yu
From: Chao Yu <yuch...@huawei.com> Configure io_bits with 2 and enable LFS mode, generic/017 reports below dmesg: BUG: unable to handle kernel NULL pointer dereference at 0039 *pdpt = 2fcb2001 *pde = Oops: [#1] PREEMPT SMP Modules linked in: crc32_generi

[PATCH 2/2] f2fs: fix error path of move_data_page

2018-05-28 Thread Chao Yu
This patch fixes error path of move_data_page: - clear cold data flag if it fails to write page. - redirty page for non-ENOMEM case. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/gc.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/gc.c b/f

[PATCH 1/2] f2fs: don't drop dentry pages after fs shutdown

2018-05-28 Thread Chao Yu
As description in commit "f2fs: don't drop any page on f2fs_cp_error() case": "We still provide readdir() after shtudown, so we should keep pages to avoid additional IOs." In order to provider lastest directory structure, let's keep dentry pages in cache after fs shutdown.

[PATCH v3] f2fs: fix to avoid race during access gc_thread pointer

2018-05-28 Thread Chao Yu
thread mount option, the memory can be released if we turn off that mount option, but still there are several places access gc_thread pointer without considering race condition, result in NULL point dereference. In order to fix this issue, use sb->s_umount to exclude those operations. Signed-

Re: [RESEND PATCH V5 24/33] f2fs: conver to bio_for_each_page_all2

2018-05-28 Thread Chao Yu
On 2018/5/25 11:46, Ming Lei wrote: > bio_for_each_page_all() can't be used any more after multipage bvec is > enabled, so we have to convert to bio_for_each_page_all2(). > > Signed-off-by: Ming Lei <ming@redhat.com> Acked-by: Chao Yu <yuch...@huawei.com> Thanks,

Re: [PATCH] f2fs-tools: fix overflow bug of start_sector when computing zone_align_start_offset

2018-05-28 Thread Chao Yu
On 2018/5/26 16:09, Yunlong Song wrote: > zone_align_start_offset should be u64, but config.start_sector is u32, > so it may be overflow when computing zone_align_start_offset. Could you rebase this patch on top of "f2fs-tools: fix to match with the start_sector"? Thanks, > > Signed-off-by:

Re: [PATCH v2] f2fs-tools: fix to match with the start_sector

2018-05-28 Thread Chao Yu
ce start_sector is got from ioctl HDIO_GETGEO and > is always in 512 size unit for a sector. To fix this problem, just > change the sector_size to the default value when computing with > start_sector. And fix sectors_per_blk as well. > > Signed-off-by: Yunlong Song <yunlong.s...@

[PATCH 2/2] f2fs: clean up with clear_radix_tree_dirty_tag

2018-05-26 Thread Chao Yu
Introduce clear_radix_tree_dirty_tag to include common codes for cleanup. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/data.c | 11 +++ fs/f2fs/dir.c| 8 +--- fs/f2fs/f2fs.h | 1 + fs/f2fs/inline.c | 7 +-- fs/f2fs/node.c | 12 ++-- 5 files c

[PATCH 1/2] f2fs: fix to don't trigger writeback during recovery

2018-05-26 Thread Chao Yu
, in order to avoid entering above writeback flow, let's detect recovery status and do skip in f2fs_balance_fs_bg. Signed-off-by: Chao Yu <yuch...@huawei.com> Signed-off-by: Yunlei He <heyun...@huawei.com> --- fs/f2fs/segment.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/se

Re: [PATCH v2] f2fs: let fstrim issue discard commands in lower priority

2018-05-26 Thread Chao Yu
On 2018/5/26 3:49, Jaegeuk Kim wrote: > The fstrim gathers huge number of large discard commands, and tries to issue > without IO awareness, which results in long user-perceive IO latencies on > READ, WRITE, and FLUSH in UFS. We've observed some of commands take several > seconds due to long

Re: [RFC PATCH] f2fs: add fsync_mode=nobarrier for non-atomic files

2018-05-25 Thread Chao Yu
On 2018/5/26 9:04, Jaegeuk Kim wrote: > For non-atomic files, this patch adds an option to give nobarrier which > doesn't issue flush commands to the device. > > Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org> Reviewed-by: Chao Yu <yuch...@huawei.com> Thanks,

[PATCH v2] f2fs: keep migration IO order in LFS mode

2018-05-25 Thread Chao Yu
an additional lock to keep submitting order. Signed-off-by: Chao Yu <yuch...@huawei.com> Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- v2: - introduce variable lfs_mode to record historical option, it can avoid option being changed. fs/f2fs/f2fs.h| 2 ++ fs/f2fs/gc.c | 6 +++

Re: [PATCH v2] f2fs: let fstrim issue discard commands in lower priority

2018-05-25 Thread Chao Yu
due to long discard latency. > > This patch limits the maximum size to 2MB per candidate, and check IO > congestion > when issuing them to disk. > > Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org> It looks good to me. :) Reviewed-by: Chao Yu <yuch...@huawei.com> Thanks,

Re: [PATCH v3] f2fs: Fix deadlock in shutdown ioctl

2018-05-25 Thread Chao Yu
f2fs_ioctl+0xc0c/0x1ce0 > f2fs_compat_ioctl+0x98/0x1f0 > > Signed-off-by: Sahitya Tummala <stumm...@codeaurora.org> Reviewed-by: Chao Yu <yuch...@huawei.com> Thanks,

Re: [PATCH] f2fs: let fstrim issue discard commands in lower priority

2018-05-25 Thread Chao Yu
On 2018/5/25 14:18, Jaegeuk Kim wrote: > On 05/25, Chao Yu wrote: >> Hi Jaegeuk, >> >> On 2018/5/25 13:10, Jaegeuk Kim wrote: >>> The fstrim gathers huge number of large discard commands, and tries to issue >>> without IO awareness, which results in long

Re: [PATCH] f2fs: let fstrim issue discard commands in lower priority

2018-05-25 Thread Chao Yu
Hi Jaegeuk, On 2018/5/25 13:10, Jaegeuk Kim wrote: > The fstrim gathers huge number of large discard commands, and tries to issue > without IO awareness, which results in long user-perceive IO latencies on > READ, WRITE, and FLUSH in UFS. We've observed some of commands take several > seconds due

[PATCH] f2fs: keep migration IO order in LFS mode

2018-05-24 Thread Chao Yu
an additional lock to keep submitting order. Signed-off-by: Chao Yu <yuch...@huawei.com> Signed-off-by: Yunlong Song <yunlong.s...@huawei.com> --- fs/f2fs/f2fs.h| 2 ++ fs/f2fs/gc.c | 5 + fs/f2fs/segment.c | 5 + fs/f2fs/super.c | 1 + 4 files changed, 13 insertions(+) dif

[PATCH 2/2] f2fs: detect synchronous writeback more earlier

2018-05-23 Thread Chao Yu
From: Chao Yu <yuch...@huawei.com> This patch changes to detect synchronous writeback more earlier before, in order to avoid unnecessary page writeback before exiting asynchronous writeback. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/data.c | 11 --- 1 fil

[PATCH 1/2] f2fs: clean up with is_valid_blkaddr()

2018-05-23 Thread Chao Yu
From: Chao Yu <yuch...@huawei.com> - rename is_valid_blkaddr() to is_valid_meta_blkaddr() for readability. - introduce is_valid_blkaddr() for cleanup. No logic change in this patch. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/checkpoint.c | 4 ++-- fs/f2fs/data.

Re: [PATCH v4] f2fs: fix to avoid race during access gc_thread pointer

2018-05-17 Thread Chao Yu
On 2018/5/8 5:36, Jaegeuk Kim wrote: > On 05/07, Chao Yu wrote: >> Thread A Thread BThread C >> - f2fs_remount >> - stop_gc_thread >> - f2fs_sbi_store >>

Re: [PATCH 1/3] f2fs: fix to wait page writeback during revoking atomic write

2018-05-17 Thread Chao Yu
Hi Jaegeuk, Could you recheck this patch? On 2018/4/23 10:36, Chao Yu wrote: > After revoking atomic write, related LBA can be reused by others, so we > need to wait page writeback before reusing the LBA, in order to avoid > interference between old atomic written in-flight IO a

Re: [PATCH v2] f2fs: Fix deadlock in shutdown ioctl

2018-05-17 Thread Chao Yu
On 2018/5/17 16:03, Sahitya Tummala wrote: > f2fs_ioc_shutdown() ioctl gets stuck in the below path > when issued with F2FS_GOING_DOWN_FULLSYNC option. > > __switch_to+0x90/0xc4 > percpu_down_write+0x8c/0xc0 > freeze_super+0xec/0x1e4 > freeze_bdev+0xc4/0xcc > f2fs_ioctl+0xc0c/0x1ce0 >

Re: [PATCH] f2fs: Fix deadlock in shutdown ioctl

2018-05-16 Thread Chao Yu
On 2018/5/15 15:57, Sahitya Tummala wrote: > On Mon, May 14, 2018 at 11:39:42AM +0800, Chao Yu wrote: >> On 2018/5/10 21:20, Sahitya Tummala wrote: >>> f2fs_ioc_shutdown() ioctl gets stuck in the below path >>> when going down with full sync (F2FS_GOIN

Re: [PATCH v2 1/3] f2fs: fix to initialize i_current_depth according to inode type

2018-05-15 Thread Chao Yu
Sorry, I sent the wrong patch, please ignore this one. On 2018/5/15 18:50, Chao Yu wrote: > i_current_depth is used only for directory inode, but its space is > shared with i_gc_failures field used for regular inode, in order to > avoid affecting i_gc_failures' value, this pa

[PATCH] f2fs: fix to initialize min_mtime with ULLONG_MAX

2018-05-15 Thread Chao Yu
Since sit_i.min_mtime's type is unsigned long long, so we should initialize it with max value of the type ULLONG_MAX instead of LLONG_MAX. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/segment.

[PATCH v2 1/3] f2fs: fix to initialize i_current_depth according to inode type

2018-05-15 Thread Chao Yu
i_current_depth is used only for directory inode, but its space is shared with i_gc_failures field used for regular inode, in order to avoid affecting i_gc_failures' value, this patch fixes to initialize the union's fields according to inode type. Signed-off-by: Chao Yu <yuch...@huawei.

Re: [PATCH] f2fs: Fix deadlock in shutdown ioctl

2018-05-13 Thread Chao Yu
On 2018/5/10 21:20, Sahitya Tummala wrote: > f2fs_ioc_shutdown() ioctl gets stuck in the below path > when going down with full sync (F2FS_GOING_DOWN_FULLSYNC) > option. > > __switch_to+0x90/0xc4 > percpu_down_write+0x8c/0xc0 > freeze_super+0xec/0x1e4 > freeze_bdev+0xc4/0xcc >

Re: [PATCH 32/76] fs/f2fs: Use inode_sb() helper instead of inode->i_sb

2018-05-10 Thread Chao Yu
On 2018/5/9 2:03, Mark Fasheh wrote: > Signed-off-by: Mark Fasheh <mfas...@suse.de> Reviewed-by: Chao Yu <yuch...@huawei.com> Thanks,

[PATCH] f2fs: fix to let checkpoint guarantee atomic page persistence

2018-05-08 Thread Chao Yu
fixes to treat atomic page as checkpoint guaranteed one, then in checkpoint, we can make sure all atomic page can be writebacked with metadata of atomic file. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/data.c b/f

Re: [PATCH] f2fs: fix to wait IO writeback in __revoke_inmem_pages()

2018-05-08 Thread Chao Yu
On 2018/5/8 11:31, Jaegeuk Kim wrote: > On 05/08, Chao Yu wrote: >> On 2018/5/8 4:46, Jaegeuk Kim wrote: >>> On 04/27, Chao Yu wrote: >>>> On 2018/4/27 0:36, Jaegeuk Kim wrote: >>>>> On 04/26, Chao Yu wrote: >>>>>> On 2018

[PATCH v2] f2fs: fix to avoid race during access gc_thread pointer

2018-05-07 Thread Chao Yu
thread mount option, the memory can be released if we turn off that mount option, but still there are several places access gc_thread pointer without considering race condition, result in NULL point dereference. In order to fix this issue, use sb->s_umount to exclude those operations. Signed-

[PATCH] f2fs: fix to avoid race during access gc_thread pointer

2018-05-07 Thread Chao Yu
thread mount option, the memory can be released if we turn off that mount option, but still there are several places access gc_thread pointer without considering race condition, result in NULL point dereference. In order to fix this issue, use sb->s_umount to exclude those operations. Signed-

Re: [PATCH v4] f2fs: fix to avoid race during access gc_thread pointer

2018-05-07 Thread Chao Yu
On 2018/5/8 11:17, Jaegeuk Kim wrote: > On 05/08, Chao Yu wrote: >> On 2018/5/8 5:36, Jaegeuk Kim wrote: >>> On 05/07, Chao Yu wrote: >>>> Thread A Thread BThread C >>>> - f2fs_remount >>>> - stop_gc_t

Re: [PATCH] f2fs: fix to wait IO writeback in __revoke_inmem_pages()

2018-05-07 Thread Chao Yu
On 2018/5/8 4:46, Jaegeuk Kim wrote: > On 04/27, Chao Yu wrote: >> On 2018/4/27 0:36, Jaegeuk Kim wrote: >>> On 04/26, Chao Yu wrote: >>>> On 2018/4/26 23:48, Jaegeuk Kim wrote: >>>>> On 04/26, Chao Yu wrote: >>>>>> Thread A

[PATCH] f2fs: fix to wait atomic pages writeback in block_operations()

2018-05-07 Thread Chao Yu
fixes to try to wait all atomic pages writeback in block_operations(). Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/checkpoint.c | 4 +++- fs/f2fs/data.c | 2 ++ fs/f2fs/f2fs.h | 2 ++ fs/f2fs/segment.c| 17 + 4 files changed, 24 insertions(+), 1 de

Re: [PATCH v4] f2fs: fix to avoid race during access gc_thread pointer

2018-05-07 Thread Chao Yu
On 2018/5/8 5:36, Jaegeuk Kim wrote: > On 05/07, Chao Yu wrote: >> Thread A Thread BThread C >> - f2fs_remount >> - stop_gc_thread >> - f2fs_sbi_store >>

[PATCH v2 3/3] f2fs: avoid stucking GC due to atomic write

2018-05-07 Thread Chao Yu
patch adds to show GC skip information in debugfs, now it just shows count of skipped caused by atomic write. Signed-off-by: Chao Yu <yuch...@huawei.com> --- v2: - rebase code. fs/f2fs/data.c| 2 +- fs/f2fs/debug.c | 6 ++ fs/f2fs/f2fs.h| 21 +++-- fs/f2fs/

[PATCH v2 2/3] f2fs: introduce GC_I for cleanup

2018-05-07 Thread Chao Yu
Introduce GC_I to replace sbi->gc_thread for cleanup, no logic changes. Signed-off-by: Chao Yu <yuch...@huawei.com> --- v2: - rebase code. fs/f2fs/debug.c | 2 +- fs/f2fs/f2fs.h| 5 + fs/f2fs/gc.c | 14 +++--- fs/f2fs/segment.c | 4 ++-- fs/f2fs/super.c | 4

[PATCH v2 1/3] f2fs: fix to initialize i_current_depth according to inode type

2018-05-07 Thread Chao Yu
i_current_depth is used only for directory inode, but its space is shared with i_gc_failures field used for regular inode, in order to avoid affecting i_gc_failures' value, this patch fixes to initialize the union's fields according to inode type. Signed-off-by: Chao Yu <yuch...@huawei.

[PATCH v4] f2fs: fix to avoid race during access gc_thread pointer

2018-05-07 Thread Chao Yu
are several places access gc_thread pointer without considering race condition, result in NULL point dereference. In order to fix this issue, introduce gc_rwsem to exclude those operations. Signed-off-by: Chao Yu <yuch...@huawei.com> --- v4: - use introduced sbi.gc_rwsem lock instead of sb.s

Re: [PATCH v3] f2fs: fix to avoid race during access gc_thread pointer

2018-05-05 Thread Chao Yu
On 2018/5/5 18:02, Chao Yu wrote: > Thread A Thread BThread C > - f2fs_remount > - stop_gc_thread > - f2fs_sbi_store > - issue_discard_thread >sbi

[PATCH 3/3] f2fs: avoid stucking GC due to atomic write

2018-05-05 Thread Chao Yu
patch adds to show GC skip information in debugfs, now it just shows count of skipped caused by atomic write. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/data.c| 2 +- fs/f2fs/debug.c | 8 fs/f2fs/f2fs.h| 19 +-- fs/f2fs/file.c

[PATCH 1/3] f2fs: fix to initialize i_current_depth according to inode type

2018-05-05 Thread Chao Yu
i_current_depth is used only for directory inode, but its space is shared with i_gc_failures field used for regular inode, in order to avoid affecting i_gc_failures' value, this patch fixes to initialize the union's fields according to inode type. Signed-off-by: Chao Yu <yuch...@huawei.

[PATCH 2/3] f2fs: introduce GC_I for cleanup

2018-05-05 Thread Chao Yu
Introduce GC_I to replace sbi->gc_thread for cleanup, no logic changes. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fs/f2fs/debug.c | 2 +- fs/f2fs/f2fs.h| 5 + fs/f2fs/gc.c | 14 +++--- fs/f2fs/segment.c | 4 ++-- fs/f2fs/super.c | 4 ++-- fs/f2fs/sysfs

[PATCH v3] f2fs: fix to avoid race during access gc_thread pointer

2018-05-05 Thread Chao Yu
are several places access gc_thread pointer without considering race condition, result in NULL point dereference. In order to fix this issue, use sb->s_umount to exclude those operations Signed-off-by: Chao Yu <yuch...@huawei.com> --- v3: - use sb->s_umount to make all race cases excl

  1   2   3   4   5   6   7   8   9   10   >