[f2fs-dev] [PATCH v2] f2fs: fix compressed file start atomic write may cause data corruption

2022-03-09 Thread Fengnan Chang via Linux-f2fs-devel
When compressed file has blocks, f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode. If write partial compreseed cluster and commit atomic write will cause data corruption. This is the reproduction process: Step 1: create a compressed file ,write 64K data , cal

Re: [f2fs-dev] [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

2022-03-09 Thread 常凤楠 via Linux-f2fs-devel
> -Original Message- > From: Chao Yu > Sent: Wednesday, March 9, 2022 11:33 AM > To: 常凤楠 ; Fengnan Chang > ; [email protected] > Cc: [email protected] > Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause > data corruption > > On 2022/3/7

Re: [f2fs-dev] [PATCH] generic/066: attr1 is still there after log replay on f2fs

2022-03-09 Thread Chao Yu
On 2022/3/10 9:41, Dave Chinner wrote: On Wed, Mar 09, 2022 at 03:34:27PM +0800, Chao Yu wrote: On 2022/3/9 14:22, Dave Chinner wrote: On Wed, Mar 09, 2022 at 12:31:17PM +0800, Chao Yu wrote: On 2022/2/28 11:57, Sun Ke via Linux-f2fs-devel wrote: The test fail on f2fs: xattr names and

Re: [f2fs-dev] [PATCH 1/2 v2] f2fs: do not expose unwritten blocks to user by DIO

2022-03-09 Thread Jaegeuk Kim
DIO preallocates physical blocks before writing data, but if an error occurrs or power-cut happens, we can see block contents from the disk. This patch tries to fix it by 1) turning to buffered writes for DIO into holes, 2) truncating unwritten blocks from error or power-cut. Signed-off-by: Jaegeu

Re: [f2fs-dev] [PATCH 2/2] f2fs: use spin_lock to avoid hang

2022-03-09 Thread Jaegeuk Kim
On 03/10, Chao Yu wrote: > On 2022/3/10 5:48, Jaegeuk Kim wrote: > > [14696.634553] task:cat state:D stack:0 pid:1613738 > > ppid:1613735 flags:0x0004 > > [14696.638285] Call Trace: > > [14696.639038] > > [14696.640032] __schedule+0x302/0x930 > > [14696.640969] schedule+0x5

Re: [f2fs-dev] [PATCH -next v3] f2fs: remove unnecessary read for F2FS_FITS_IN_INODE

2022-03-09 Thread Chao Yu
On 2022/3/9 19:09, Jia Yang via Linux-f2fs-devel wrote: F2FS_FITS_IN_INODE only cares the type of f2fs inode, so there is no need to read node page of f2fs inode. Signed-off-by: Jia Yang Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing

Re: [f2fs-dev] [PATCH 2/2] f2fs: use spin_lock to avoid hang

2022-03-09 Thread Chao Yu
On 2022/3/10 5:48, Jaegeuk Kim wrote: [14696.634553] task:cat state:D stack:0 pid:1613738 ppid:1613735 flags:0x0004 [14696.638285] Call Trace: [14696.639038] [14696.640032] __schedule+0x302/0x930 [14696.640969] schedule+0x58/0xd0 [14696.641799] schedule_preempt_disabled+

Re: [f2fs-dev] [PATCH 1/2] f2fs: evict inode cache for frozen fs

2022-03-09 Thread Chao Yu
On 2022/3/10 5:48, Jaegeuk Kim wrote: Let's purge inode cache in order to avoid the below deadlock. [freeze test] shrinkder freeze_super - pwercpu_down_write(SB_FREEZE_FS) - super_cache_scan

Re: [f2fs-dev] [PATCH] generic/066: attr1 is still there after log replay on f2fs

2022-03-09 Thread Dave Chinner
On Wed, Mar 09, 2022 at 03:34:27PM +0800, Chao Yu wrote: > On 2022/3/9 14:22, Dave Chinner wrote: > > On Wed, Mar 09, 2022 at 12:31:17PM +0800, Chao Yu wrote: > > > On 2022/2/28 11:57, Sun Ke via Linux-f2fs-devel wrote: > > > > The test fail on f2fs: > > > >xattr names and values after seco

Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset

2022-03-09 Thread Jaegeuk Kim
Hi Jens, On 03/08, Jens Axboe wrote: > On 3/7/22 11:06 PM, Christoph Hellwig wrote: > > On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: > >> On 2022/2/28 20:41, Christoph Hellwig wrote: > >>> Refactor block I/O code so that the bio operation and known flags are set > >>> at bio allocation

Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset

2022-03-09 Thread Jaegeuk Kim
On 03/01, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: > > Refactor block I/O code so that the bio operation and known flags are set > > at bio allocation time. Only the later updated flags are updated on the > > fly. > > > > Signed-off-by: Christoph Hellwig > > Reviewed-by: Ch

Re: [f2fs-dev] [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device

2022-03-09 Thread Jaegeuk Kim
On 03/01, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: > > Set the bdev at bio allocation time by changing the f2fs_target_device > > calling conventions, so that no bio needs to be passed in. > > > > Signed-off-by: Christoph Hellwig > > Reviewed-by: Chao Yu Acked-by: Jaegeuk

[f2fs-dev] [PATCH 1/2] f2fs: evict inode cache for frozen fs

2022-03-09 Thread Jaegeuk Kim
Let's purge inode cache in order to avoid the below deadlock. [freeze test] shrinkder freeze_super - pwercpu_down_write(SB_FREEZE_FS) - super_cache_scan - down_read(&sb->s_umount)

[f2fs-dev] [PATCH 2/2] f2fs: use spin_lock to avoid hang

2022-03-09 Thread Jaegeuk Kim
[14696.634553] task:cat state:D stack:0 pid:1613738 ppid:1613735 flags:0x0004 [14696.638285] Call Trace: [14696.639038] [14696.640032] __schedule+0x302/0x930 [14696.640969] schedule+0x58/0xd0 [14696.641799] schedule_preempt_disabled+0x18/0x30 [14696.642890] __mutex_lock.c

[f2fs-dev] [PATCH -next v3] f2fs: remove unnecessary read for F2FS_FITS_IN_INODE

2022-03-09 Thread Jia Yang via Linux-f2fs-devel
F2FS_FITS_IN_INODE only cares the type of f2fs inode, so there is no need to read node page of f2fs inode. Signed-off-by: Jia Yang --- fs/f2fs/file.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index cfdc41f87f5d..7049be2

Re: [f2fs-dev] [PATCH] f2fs: fix compressed file start atomic write may cause data corruption

2022-03-09 Thread Chao Yu
On 2022/3/9 17:37, Fengnan Chang wrote: When compressed file has blocks, f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode. If write partial compreseed cluster and commit atomic write will cause data corruption. This is the reproduction process: Step 1: crea

Re: [f2fs-dev] [PATCH -next v2] f2fs: remove unnecessary read for F2FS_FITS_IN_INODE

2022-03-09 Thread Chao Yu
On 2022/3/9 17:27, Jia Yang via Linux-f2fs-devel wrote: F2FS_FITS_IN_INODE only cares the type of f2fs inode, so there is no need to read node page of f2fs inode. Signed-off-by: Jia Yang --- v2: - initialize ri with NULL --- fs/f2fs/file.c | 15 --- 1 file changed, 4 insertions(+

[f2fs-dev] [PATCH] f2fs: fix compressed file start atomic write may cause data corruption

2022-03-09 Thread Fengnan Chang via Linux-f2fs-devel
When compressed file has blocks, f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode. If write partial compreseed cluster and commit atomic write will cause data corruption. This is the reproduction process: Step 1: create a compressed file ,write 64K data , cal

[f2fs-dev] [PATCH -next v2] f2fs: remove unnecessary read for F2FS_FITS_IN_INODE

2022-03-09 Thread Jia Yang via Linux-f2fs-devel
F2FS_FITS_IN_INODE only cares the type of f2fs inode, so there is no need to read node page of f2fs inode. Signed-off-by: Jia Yang --- v2: - initialize ri with NULL --- fs/f2fs/file.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/fi