[f2fs-dev] [PATCH] f2fs: call unlock_new_inode() before d_instantiate()

2018-04-18 Thread Eric Biggers
From: Eric Biggers xfstest generic/429 sometimes hangs on f2fs, caused by a thread being unable to take a directory's i_rwsem for write in vfs_rmdir(). In the test, one thread repeatedly creates and removes a directory, and other threads repeatedly look up a file in the

[f2fs-dev] [PATCH v2 1/2] fscrypt: allow synchronous bio decryption

2018-04-18 Thread Eric Biggers via Linux-f2fs-devel
Currently, fscrypt provides fscrypt_decrypt_bio_pages() which decrypts a bio's pages asynchronously, then unlocks them afterwards. But, this assumes that decryption is the last "postprocessing step" for the bio, so it's incompatible with additional postprocessing steps such as authenticity

[f2fs-dev] [PATCH v2 2/2] f2fs: refactor read path to allow multiple postprocessing steps

2018-04-18 Thread Eric Biggers via Linux-f2fs-devel
Currently f2fs's ->readpage() and ->readpages() assume that either the data undergoes no postprocessing, or decryption only. But with fs-verity, there will be an additional authenticity verification step, and it may be needed either by itself, or combined with decryption. To support this, store

[f2fs-dev] [PATCH v2 0/2] fscrypt / f2fs: prepare I/O path for fs-verity

2018-04-18 Thread Eric Biggers via Linux-f2fs-devel
Hello, These two patches restructure f2fs's read path to allow the data to go through multiple postprocessing steps, rather than just decryption as is implemented currently. This is mainly in preparation for doing authenticity verification of data via fs-verity, though this change might also be

Re: [f2fs-dev] [PATCH 2/2] f2fs: refactor read path to allow multiple postprocessing steps

2018-04-18 Thread Jaegeuk Kim
On 04/18, Eric Biggers wrote: > Hi Chao, > > On Wed, Apr 18, 2018 at 02:27:32PM +0800, Chao Yu wrote: > > Hi Eric, > > > > On 2018/4/18 1:42, Eric Biggers wrote: > > > Hi Chao, > > > > > > On Tue, Apr 17, 2018 at 05:13:12PM +0800, Chao Yu wrote: > > >>> + > > >>> +static void

Re: [f2fs-dev] [PATCH 2/2] f2fs: refactor read path to allow multiple postprocessing steps

2018-04-18 Thread Eric Biggers via Linux-f2fs-devel
Hi Chao, On Wed, Apr 18, 2018 at 02:27:32PM +0800, Chao Yu wrote: > Hi Eric, > > On 2018/4/18 1:42, Eric Biggers wrote: > > Hi Chao, > > > > On Tue, Apr 17, 2018 at 05:13:12PM +0800, Chao Yu wrote: > >>> + > >>> +static void bio_post_read_processing(struct bio_post_read_ctx *ctx); > >>> + > >>>

Re: [f2fs-dev] [PATCH 1/5] f2fs: fix race in between GC and atomic open

2018-04-18 Thread Chao Yu
Hi all, Please ignore this patch, I just sent this before, sorry. Thanks, On 2018/4/18 17:45, Chao Yu wrote: > ThreadGC thread > - f2fs_ioc_start_atomic_write > - get_dirty_pages > - filemap_write_and_wait_range > -

[f2fs-dev] [PATCH v2 5/5] f2fs: fix to avoid race during access gc_thread pointer

2018-04-18 Thread Chao Yu
Thread AThread BThread C - f2fs_remount - stop_gc_thread - f2fs_sbi_store - issue_discard_thread sbi->gc_thread = NULL;

[f2fs-dev] [PATCH 1/5] f2fs: fix race in between GC and atomic open

2018-04-18 Thread Chao Yu
Thread GC thread - f2fs_ioc_start_atomic_write - get_dirty_pages - filemap_write_and_wait_range - f2fs_gc - do_garbage_collect -

[f2fs-dev] [PATCH 2/5] f2fs: fix return value in f2fs_ioc_commit_atomic_write

2018-04-18 Thread Chao Yu
In f2fs_ioc_commit_atomic_write, if file is volatile, return -EINVAL to indicate that commit failure. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index

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

2018-04-18 Thread Chao Yu
f2fs doesn't allow abuse on atomic write class interface, so except limiting in-mem pages' total memory usage capacity, we need to limit atomic-write usage as well when filesystem is seriously fragmented, otherwise we may run into infinite loop during foreground GC because target blocks in victim

[f2fs-dev] [PATCH 4/5] f2fs: show GC failure info in debugfs

2018-04-18 Thread Chao Yu
This patch adds to show GC failure information in debugfs, now it just shows count of failure caused by atomic write. Signed-off-by: Chao Yu --- fs/f2fs/debug.c | 5 + fs/f2fs/f2fs.h | 1 + fs/f2fs/gc.c| 13 +++-- fs/f2fs/gc.h| 2 +- 4 files changed,

[f2fs-dev] [PATCH 5/5] f2fs: fix to avoid race during access gc_thread pointer

2018-04-18 Thread Chao Yu
Thread AThread BThread C - f2fs_remount - stop_gc_thread - f2fs_sbi_store - issue_discard_thread sbi->gc_thread = NULL;

Re: [f2fs-dev] [PATCH v2] f2fs: allocate hot_data for atomic write more strictly

2018-04-18 Thread Chao Yu
On 2018/4/18 11:06, Yunlei He wrote: > If a file not set type as hot, has dirty pages more than > threshold 64 before starting atomic write, may be lose hot > flag. > > v1->v2: move set FI_ATOMIC_FILE flag behind flush dirty pages too, > in case of dirty pages before starting atomic use atomic

Re: [f2fs-dev] [PATCH 2/2] f2fs: refactor read path to allow multiple postprocessing steps

2018-04-18 Thread Chao Yu
Hi Eric, On 2018/4/18 1:42, Eric Biggers wrote: > Hi Chao, > > On Tue, Apr 17, 2018 at 05:13:12PM +0800, Chao Yu wrote: >>> + >>> +static void bio_post_read_processing(struct bio_post_read_ctx *ctx); >>> + >>> +static void decrypt_work(struct work_struct *work) >>> +{ >>> + struct