[f2fs-dev] [PATCH AUTOSEL 4.20 085/304] f2fs: avoid GC causing encrypted file corrupted

2019-01-28 Thread Sasha Levin
From: Yunlong Song [ Upstream commit 9bf1a3f73927492c8be127b642197125e9d52be8 ] The encrypted file may be corrupted by GC in following case: Time 1: | segment 1 blkaddr = A | GC -> | segment 2 blkaddr = B | Encrypted block 1 is moved from blkaddr A of segment 1 to blkaddr B of segment 2, Time

[f2fs-dev] [PATCH AUTOSEL 4.20 088/304] f2fs: fix race between write_checkpoint and write_begin

2019-01-28 Thread Sasha Levin
From: Sheng Yong [ Upstream commit 2866fb16d67992195b0526d19e65acb6640fb87f ] The following race could lead to inconsistent SIT bitmap: Task A Task B == == f2fs_write_checkpoint block_operations f2fs_lock_all down_write(node_

[f2fs-dev] [PATCH AUTOSEL 4.20 086/304] f2fs: move dir data flush to write checkpoint process

2019-01-28 Thread Sasha Levin
From: Yunlei He [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ] This patch move dir data flush to write checkpoint process, by doing this, it may reduce some time for dir fsync. pre: -f2fs_do_sync_file enter -file_write_and_wait_range <- flush & wait

[f2fs-dev] [PATCH AUTOSEL 4.20 089/304] f2fs: fix wrong return value of f2fs_acl_create

2019-01-28 Thread Sasha Levin
From: Tiezhu Yang [ Upstream commit f6176473a0c7472380eef72ebeb330cf9485bf0a ] When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create() should return -EIO instead of -ENOMEM, this patch makes it consistent with posix_acl_create() which has been fixed in commit beaf226b863a ("posix_a

[f2fs-dev] [PATCH AUTOSEL 4.20 087/304] f2fs: avoid build warn of fall_through

2019-01-28 Thread Sasha Levin
From: Jaegeuk Kim [ Upstream commit f5d5510e7389fa264337fb524346bac9eb93adc8 ] After merging the f2fs tree, today's linux-next build (x86_64_allmodconfig) produced this warning: In file included from fs/f2fs/dir.c:11: fs/f2fs/f2fs.h: In function '__mark_inode_dirty_flag': fs/f2fs/f2fs.h:238

[f2fs-dev] [PATCH AUTOSEL 4.20 178/304] f2fs: fix to reorder set_page_dirty and wait_on_page_writeback

2019-01-28 Thread Sasha Levin
From: Chao Yu [ Upstream commit 8d64d365aed355b2e2465d19ba61df02462fff4d ] This patch reorders flow from - update page - set_page_dirty - wait_on_page_writeback to - wait_on_page_writeback - update page - set_page_dirty The reason is: - set_page_dirty will increase reference of dirty page, t

[f2fs-dev] [PATCH AUTOSEL 4.20 270/304] f2fs: fix use-after-free issue when accessing sbi->stat_info

2019-01-28 Thread Sasha Levin
From: Sahitya Tummala [ Upstream commit 60aa4d5536ab7fe32433ca1173bd9d6633851f27 ] iput() on sbi->node_inode can update sbi->stat_info in the below context, if the f2fs_write_checkpoint() has failed with error. f2fs_balance_fs_bg+0x1ac/0x1ec f2fs_write_node_pages+0x4c/0x260 do_writepages+0x80/0

[f2fs-dev] [PATCH AUTOSEL 4.20 273/304] f2fs: fix sbi->extent_list corruption issue

2019-01-28 Thread Sasha Levin
From: Sahitya Tummala [ Upstream commit e4589fa545e0020dbbc3c9bde35f35f949901392 ] When there is a failure in f2fs_fill_super() after/during the recovery of fsync'd nodes, it frees the current sbi and retries again. This time the mount is successful, but the files that got recovered before retry

[f2fs-dev] [PATCH AUTOSEL 4.19 072/258] f2fs: move dir data flush to write checkpoint process

2019-01-28 Thread Sasha Levin
From: Yunlei He [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ] This patch move dir data flush to write checkpoint process, by doing this, it may reduce some time for dir fsync. pre: -f2fs_do_sync_file enter -file_write_and_wait_range <- flush & wait

[f2fs-dev] [PATCH AUTOSEL 4.19 074/258] f2fs: fix race between write_checkpoint and write_begin

2019-01-28 Thread Sasha Levin
From: Sheng Yong [ Upstream commit 2866fb16d67992195b0526d19e65acb6640fb87f ] The following race could lead to inconsistent SIT bitmap: Task A Task B == == f2fs_write_checkpoint block_operations f2fs_lock_all down_write(node_

[f2fs-dev] [PATCH AUTOSEL 4.19 073/258] f2fs: avoid build warn of fall_through

2019-01-28 Thread Sasha Levin
From: Jaegeuk Kim [ Upstream commit f5d5510e7389fa264337fb524346bac9eb93adc8 ] After merging the f2fs tree, today's linux-next build (x86_64_allmodconfig) produced this warning: In file included from fs/f2fs/dir.c:11: fs/f2fs/f2fs.h: In function '__mark_inode_dirty_flag': fs/f2fs/f2fs.h:238

[f2fs-dev] [PATCH AUTOSEL 4.19 075/258] f2fs: fix wrong return value of f2fs_acl_create

2019-01-28 Thread Sasha Levin
From: Tiezhu Yang [ Upstream commit f6176473a0c7472380eef72ebeb330cf9485bf0a ] When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create() should return -EIO instead of -ENOMEM, this patch makes it consistent with posix_acl_create() which has been fixed in commit beaf226b863a ("posix_a

[f2fs-dev] [PATCH AUTOSEL 4.19 230/258] f2fs: fix sbi->extent_list corruption issue

2019-01-28 Thread Sasha Levin
From: Sahitya Tummala [ Upstream commit e4589fa545e0020dbbc3c9bde35f35f949901392 ] When there is a failure in f2fs_fill_super() after/during the recovery of fsync'd nodes, it frees the current sbi and retries again. This time the mount is successful, but the files that got recovered before retry

[f2fs-dev] [PATCH AUTOSEL 4.19 227/258] f2fs: fix use-after-free issue when accessing sbi->stat_info

2019-01-28 Thread Sasha Levin
From: Sahitya Tummala [ Upstream commit 60aa4d5536ab7fe32433ca1173bd9d6633851f27 ] iput() on sbi->node_inode can update sbi->stat_info in the below context, if the f2fs_write_checkpoint() has failed with error. f2fs_balance_fs_bg+0x1ac/0x1ec f2fs_write_node_pages+0x4c/0x260 do_writepages+0x80/0

[f2fs-dev] [PATCH AUTOSEL 4.14 045/170] f2fs: move dir data flush to write checkpoint process

2019-01-28 Thread Sasha Levin
From: Yunlei He [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ] This patch move dir data flush to write checkpoint process, by doing this, it may reduce some time for dir fsync. pre: -f2fs_do_sync_file enter -file_write_and_wait_range <- flush & wait

[f2fs-dev] [PATCH AUTOSEL 4.14 047/170] f2fs: fix race between write_checkpoint and write_begin

2019-01-28 Thread Sasha Levin
From: Sheng Yong [ Upstream commit 2866fb16d67992195b0526d19e65acb6640fb87f ] The following race could lead to inconsistent SIT bitmap: Task A Task B == == f2fs_write_checkpoint block_operations f2fs_lock_all down_write(node_

[f2fs-dev] [PATCH AUTOSEL 4.14 046/170] f2fs: avoid build warn of fall_through

2019-01-28 Thread Sasha Levin
From: Jaegeuk Kim [ Upstream commit f5d5510e7389fa264337fb524346bac9eb93adc8 ] After merging the f2fs tree, today's linux-next build (x86_64_allmodconfig) produced this warning: In file included from fs/f2fs/dir.c:11: fs/f2fs/f2fs.h: In function '__mark_inode_dirty_flag': fs/f2fs/f2fs.h:238

[f2fs-dev] [PATCH AUTOSEL 4.14 048/170] f2fs: fix wrong return value of f2fs_acl_create

2019-01-28 Thread Sasha Levin
From: Tiezhu Yang [ Upstream commit f6176473a0c7472380eef72ebeb330cf9485bf0a ] When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create() should return -EIO instead of -ENOMEM, this patch makes it consistent with posix_acl_create() which has been fixed in commit beaf226b863a ("posix_a

[f2fs-dev] [PATCH AUTOSEL 4.14 150/170] f2fs: fix sbi->extent_list corruption issue

2019-01-28 Thread Sasha Levin
From: Sahitya Tummala [ Upstream commit e4589fa545e0020dbbc3c9bde35f35f949901392 ] When there is a failure in f2fs_fill_super() after/during the recovery of fsync'd nodes, it frees the current sbi and retries again. This time the mount is successful, but the files that got recovered before retry

[f2fs-dev] [PATCH AUTOSEL 4.9 028/107] f2fs: fix wrong return value of f2fs_acl_create

2019-01-28 Thread Sasha Levin
From: Tiezhu Yang [ Upstream commit f6176473a0c7472380eef72ebeb330cf9485bf0a ] When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create() should return -EIO instead of -ENOMEM, this patch makes it consistent with posix_acl_create() which has been fixed in commit beaf226b863a ("posix_a

[f2fs-dev] [PATCH AUTOSEL 4.9 026/107] f2fs: move dir data flush to write checkpoint process

2019-01-28 Thread Sasha Levin
From: Yunlei He [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ] This patch move dir data flush to write checkpoint process, by doing this, it may reduce some time for dir fsync. pre: -f2fs_do_sync_file enter -file_write_and_wait_range <- flush & wait

[f2fs-dev] [PATCH AUTOSEL 4.9 027/107] f2fs: avoid build warn of fall_through

2019-01-28 Thread Sasha Levin
From: Jaegeuk Kim [ Upstream commit f5d5510e7389fa264337fb524346bac9eb93adc8 ] After merging the f2fs tree, today's linux-next build (x86_64_allmodconfig) produced this warning: In file included from fs/f2fs/dir.c:11: fs/f2fs/f2fs.h: In function '__mark_inode_dirty_flag': fs/f2fs/f2fs.h:238

[f2fs-dev] [PATCH AUTOSEL 4.9 093/107] f2fs: fix sbi->extent_list corruption issue

2019-01-28 Thread Sasha Levin
From: Sahitya Tummala [ Upstream commit e4589fa545e0020dbbc3c9bde35f35f949901392 ] When there is a failure in f2fs_fill_super() after/during the recovery of fsync'd nodes, it frees the current sbi and retries again. This time the mount is successful, but the files that got recovered before retry

[f2fs-dev] [PATCH AUTOSEL 4.4 21/80] f2fs: fix wrong return value of f2fs_acl_create

2019-01-28 Thread Sasha Levin
From: Tiezhu Yang [ Upstream commit f6176473a0c7472380eef72ebeb330cf9485bf0a ] When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create() should return -EIO instead of -ENOMEM, this patch makes it consistent with posix_acl_create() which has been fixed in commit beaf226b863a ("posix_a

[f2fs-dev] [PATCH AUTOSEL 4.4 20/80] f2fs: move dir data flush to write checkpoint process

2019-01-28 Thread Sasha Levin
From: Yunlei He [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ] This patch move dir data flush to write checkpoint process, by doing this, it may reduce some time for dir fsync. pre: -f2fs_do_sync_file enter -file_write_and_wait_range <- flush & wait

[f2fs-dev] [PATCH AUTOSEL 3.18 16/61] f2fs: move dir data flush to write checkpoint process

2019-01-28 Thread Sasha Levin
From: Yunlei He [ Upstream commit b61ac5b720146c619c7cdf17eff2551b934399e5 ] This patch move dir data flush to write checkpoint process, by doing this, it may reduce some time for dir fsync. pre: -f2fs_do_sync_file enter -file_write_and_wait_range <- flush & wait

[f2fs-dev] [PATCH 2/7] f2fs: add quick mode of checkpoint=disable for QA

2019-01-28 Thread Jaegeuk Kim
This mode returns mount() quickly with EAGAIN. We can trigger this by shutdown(F2FS_GOING_DOWN_NEED_FSCK). Signed-off-by: Jaegeuk Kim --- fs/f2fs/checkpoint.c| 5 + fs/f2fs/f2fs.h | 2 ++ fs/f2fs/file.c | 6 +++--- fs/f2fs/segment.c | 3 +++ fs/f2fs/super.c

[f2fs-dev] [PATCH 4/7] f2fs: don't wake up too frequently, if there is lots of IOs

2019-01-28 Thread Jaegeuk Kim
Otherwise, it wakes up discard thread which will sleep again by busy IOs in a loop. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index a77f76f528b6..5c7ed0442d6e 100644 --- a/fs/f2fs/seg

[f2fs-dev] [PATCH 1/7] f2fs: run discard jobs when put_super

2019-01-28 Thread Jaegeuk Kim
When we umount f2fs, we need to avoid long delay due to discard commands, which is actually taking tens of seconds, if storage is very slow on UNMAP. So, this patch introduces timeout-based work on it. By default, let me give 5 seconds for discard. Signed-off-by: Jaegeuk Kim --- Documentation/A

[f2fs-dev] [PATCH 3/7] f2fs: try to keep CP_TRIMMED_FLAG after successful umount

2019-01-28 Thread Jaegeuk Kim
If every discard were issued successfully, we can avoid further discard. Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 342b720fb4db..fdd8cd21522f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segm

[f2fs-dev] [PATCH 6/7] f2fs: flush quota blocks after turnning it off

2019-01-28 Thread Jaegeuk Kim
After quota_off, we'll get some dirty blocks. If put_super don't have a chance to flush them by checkpoint, it causes NULL pointer exception in end_io after iput(node_inode). (e.g., by checkpoint=disable) Signed-off-by: Jaegeuk Kim --- fs/f2fs/super.c | 6 ++ 1 file changed, 6 insertions(+)

[f2fs-dev] [PATCH 7/7] f2fs: sync filesystem after roll-forward recovery

2019-01-28 Thread Jaegeuk Kim
Some works after roll-forward recovery can get an error which will release all the data structures. Let's flush them in order to make it clean. One possible corruption came from: [ 90.400500] list_del corruption. prev->next should be ffed1f566208, but was (null) [ 90.675349] Call trace:

[f2fs-dev] [PATCH 5/7] f2fs: avoid null pointer exception in dcc_info

2019-01-28 Thread Jaegeuk Kim
If dcc_info is not set yet, we can get null pointer panic. Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index fe95abb05d40..8c928cd72b61 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f