[PATCH RFC 2/2] btrfs: scrub: Cleanup the nodatasum fixup code

2018-07-10 Thread Qu Wenruo
Since we no longer use the old method, which use inode page cache and could cause serious data corruption for compressed nodatasum extent, to fixup nodatasum error during scrub/replace, remove all related code. Signed-off-by: Qu Wenruo --- fs/btrfs/scrub.c | 234

[PATCH RFC v2 1/2] btrfs: scrub: Don't use inode page cache in scrub_handle_errored_block()

2018-07-10 Thread Qu Wenruo
In commit ac0b4145d662 ("btrfs: scrub: Don't use inode pages for device replace") we removed the branch of copy_nocow_pages() to avoid corruption for compressed nodatasum extents. However above commit only solves the problem in scrub_extent(), if during scrub_pages() we failed to read some pages,

Re: [PATCH 2/2] btrfs-progs: check: enhanced progress indicator

2018-07-10 Thread Qu Wenruo
On 2018年07月05日 03:20, Stéphane Lesimple wrote: > We reuse the task_position enum and task_ctx struct of the original progress > indicator, adding more values and fields for our needs. > > Then add hooks in all steps of the check to properly record progress. > > Signed-off-by: Stéphane Lesimple

Re: btrfs check lowmem, take 2

2018-07-10 Thread Marc MERLIN
On Wed, Jul 11, 2018 at 12:07:05PM +0800, Su Yue wrote: > > So, I went back to https://github.com/Damenly/btrfs-progs.git/tmp1 and > > I'm running it without the extra options you added with hardcoded stuff: > > gargamel:/var/local/src/btrfs-progs.sy-test# ./btrfsck --mode=lowmem > > --repair

Re: btrfs check lowmem, take 2

2018-07-10 Thread Su Yue
On 07/11/2018 11:36 AM, Marc MERLIN wrote: On Wed, Jul 11, 2018 at 09:58:36AM +0800, Su Yue wrote: On 07/11/2018 09:44 AM, Marc MERLIN wrote: On Wed, Jul 11, 2018 at 09:08:40AM +0800, Su Yue wrote: On 07/11/2018 08:58 AM, Marc MERLIN wrote: On Wed, Jul 11, 2018 at 08:53:58AM +0800, Su

Re: btrfs check lowmem, take 2

2018-07-10 Thread Marc MERLIN
On Wed, Jul 11, 2018 at 09:58:36AM +0800, Su Yue wrote: > > > On 07/11/2018 09:44 AM, Marc MERLIN wrote: > > On Wed, Jul 11, 2018 at 09:08:40AM +0800, Su Yue wrote: > > > > > > > > > On 07/11/2018 08:58 AM, Marc MERLIN wrote: > > > > On Wed, Jul 11, 2018 at 08:53:58AM +0800, Su Yue wrote: > >

Re: btrfs check lowmem, take 2

2018-07-10 Thread Su Yue
On 07/11/2018 09:44 AM, Marc MERLIN wrote: On Wed, Jul 11, 2018 at 09:08:40AM +0800, Su Yue wrote: On 07/11/2018 08:58 AM, Marc MERLIN wrote: On Wed, Jul 11, 2018 at 08:53:58AM +0800, Su Yue wrote: Problems 1) btrfs check --repair _still_ takes all 32GB of RAM and crashes the server,

Re: btrfs check lowmem, take 2

2018-07-10 Thread Marc MERLIN
On Wed, Jul 11, 2018 at 09:08:40AM +0800, Su Yue wrote: > > > On 07/11/2018 08:58 AM, Marc MERLIN wrote: > > On Wed, Jul 11, 2018 at 08:53:58AM +0800, Su Yue wrote: > > > > Problems > > > > 1) btrfs check --repair _still_ takes all 32GB of RAM and crashes the > > > > server, despite my deleting

[PATCH v3 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread Gu Jinxiang
Instead of pointer to btrfs_fs_devices as an arg in btrfs_scan_one_device, better to make it as a return value. Signed-off-by: Gu Jinxiang --- Changelog: v3: as comment by robot, use PTR_ERR_OR_ZERO, and rebase to misc-next. v2: as comment by Nikolay, use ERR_CAST instead of cast type manually.

[PATCH v3 1/2] btrfs: make fs_devices to be a local variable

2018-07-10 Thread Gu Jinxiang
fs_devices is always passed to btrfs_scan_one_device which overrides it. And in the call stack below fs_devices is passed to btrfs_scan_one_device from btrfs_mount_root. And in btrfs_mount_root the output fs_devices of this call stack is not used. btrfs_mount_root ->

Re: btrfs check lowmem, take 2

2018-07-10 Thread Su Yue
On 07/11/2018 08:58 AM, Marc MERLIN wrote: On Wed, Jul 11, 2018 at 08:53:58AM +0800, Su Yue wrote: Problems 1) btrfs check --repair _still_ takes all 32GB of RAM and crashes the server, despite my deleting lots of snapshots. Is it because I have too many files then? Yes. Original check

Re: So, does btrfs check lowmem take days? weeks?

2018-07-10 Thread Su Yue
On 07/10/2018 06:53 PM, Su Yue wrote: On 07/10/2018 12:10 PM, Marc MERLIN wrote: On Tue, Jul 10, 2018 at 08:56:15AM +0800, Su Yue wrote: I'm just not clear if my FS is still damaged and btrfsck was just hacked to ignore the damage it can't deal with, or whether it was able to repair

Re: btrfs check lowmem, take 2

2018-07-10 Thread Marc MERLIN
On Wed, Jul 11, 2018 at 08:53:58AM +0800, Su Yue wrote: > > Problems > > 1) btrfs check --repair _still_ takes all 32GB of RAM and crashes the > > server, despite my deleting lots of snapshots. > > Is it because I have too many files then? > > > Yes. Original check first gather all infomation

Re: btrfs check lowmem, take 2

2018-07-10 Thread Su Yue
On 07/11/2018 02:09 AM, Marc MERLIN wrote: Thanks to Su and Qu, I was able to get my filesystem to a point that it's mountable. I then deleted loads of snapshots and I'm down to 26. IT now looks like this: gargamel:~# btrfs fi show /mnt/mnt Label: 'dshelf2' uuid:

lockdep warning is impractical

2018-07-10 Thread Anand Jain
Hi, I can reproduce the below circular locking warning [1] using the test case btrfs/161. It can also be reproduced with 4.1 kernel so its not due to any of the recent patches. And this warning is unreasonable too .. here is why. From [1], Thread #0 is when mounting the sprout device, and

[PATCH] btrfs: do device clone using the btrfs_scan_one_device

2018-07-10 Thread Anand Jain
When we add a device to the RO mounted seed device, it becomes a RW sprout FS. The following steps are used to hold the seed and sprout fs_devices. (first two steps are not mandatory for the sprouting, they are there to ensure the seed device remains in the scanned state) . Clone the

info!!

2018-07-10 Thread Lee Morrow
Top of the day to you, this is in respect of a very beneficial transaction which you would not want to let go reply for more details, Regards, Lee -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info

Re: general protection fault in open_fs_devices

2018-07-10 Thread syzbot
Hello, syzbot has tested the proposed patch and the reproducer did not trigger crash: Reported-and-tested-by: syzbot+909a5177749d7990f...@syzkaller.appspotmail.com Tested on: commit: d38c078c856c btrfs: add helper function check device delet.. git tree:

Re: general protection fault in open_fs_devices

2018-07-10 Thread Anand Jain
#syz test: https://github.com/asj/btrfs-devel.git misc-next On 06/06/2018 09:17 PM, syzbot wrote: Hello, syzbot found the following crash on: HEAD commit:    af6c5d5e01ad Merge branch 'for-4.18' of git://git.kernel.o.. git tree:   upstream console output:

btrfs check lowmem, take 2

2018-07-10 Thread Marc MERLIN
Thanks to Su and Qu, I was able to get my filesystem to a point that it's mountable. I then deleted loads of snapshots and I'm down to 26. IT now looks like this: gargamel:~# btrfs fi show /mnt/mnt Label: 'dshelf2' uuid: 0f1a0c9f-4e54-4fa7-8736-fd50818ff73d Total devices 1 FS bytes used

Re: Re: general protection fault in open_fs_devices

2018-07-10 Thread syzbot
#syz test: git://g...@github.com:asj/btrfs-devel.git misc-next "git://g...@github.com:asj/btrfs-devel.git" does not look like a valid git repo address. On 06/06/2018 09:17 PM, syzbot wrote: Hello, syzbot found the following crash on: HEAD commit:    af6c5d5e01ad Merge branch

Re: general protection fault in open_fs_devices

2018-07-10 Thread Anand Jain
#syz test: git://g...@github.com:asj/btrfs-devel.git misc-next On 06/06/2018 09:17 PM, syzbot wrote: Hello, syzbot found the following crash on: HEAD commit:    af6c5d5e01ad Merge branch 'for-4.18' of git://git.kernel.o.. git tree:   upstream console output:

[PATCH 2nd try] btrfs: do device clone using the btrfs_scan_one_device

2018-07-10 Thread Anand Jain
When we add a device to the RO mounted seed device, it becomes a RW sprout FS. The following steps are used to hold the seed and sprout fs_devices. (first two steps are not mandatory for the sprouting, they are there to ensure the seed device remains in the scanned state) . Clone the

[PATCH 1/3] btrfs: warn for num_devices below 0

2018-07-10 Thread Anand Jain
In preparation to de-duplicate a section of code where we deduce the num_devices, use warn instead of bug. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH 3/3] btrfs: add helper function check device delete able

2018-07-10 Thread Anand Jain
Move the section of the code which performs the check if the device is indelible, move that into a helper function. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 49 ++--- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git

[PATCH 2/3] btrfs: add helper btrfs_num_devices() to deduce num_devices

2018-07-10 Thread Anand Jain
When the replace is running the fs_devices::num_devices also includes the replace device, however in some operations like device delete and balance it needs the actual num_devices without the repalce devices, so now the function btrfs_num_devices() just provides that. Signed-off-by: Anand Jain

Re: [PATCH 1/2] btrfs: code reorder in btrfs_prepare_sprout

2018-07-10 Thread Anand Jain
On 07/10/2018 06:41 PM, David Sterba wrote: On Mon, Jul 09, 2018 at 04:33:52PM +0800, Anand Jain wrote: No functional change, bring the clone of fs_devices and its operations closer, so that it indicates its purpose. Also add a comment to indicate why we clone the fs_devices.

[PATCH] btrfs: fix ptr_ret.cocci warnings

2018-07-10 Thread kbuild test robot
From: kbuild test robot fs/btrfs/super.c:2243:8-14: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Fixes: 193ea416dc5e ("btrfs: get fs_devices pointer form btrfs_scan_one_device") CC: Gu

Re: [PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread kbuild test robot
/Gu-Jinxiang/btrfs-make-fs_devices-to-be-a-local-variable/20180710-191730 coccinelle warnings: (new ones prefixed by >>) >> fs/btrfs/super.c:2243:8-14: WARNING: PTR_ERR_OR_ZERO can be used Please review and possibly fold the followup patch. --- 0-DAY kernel test infrastructure

Re: A list of new findings when fuzzing Linux btrfs module

2018-07-10 Thread David Sterba
On Wed, Jul 04, 2018 at 05:54:56PM +, Xu, Wen wrote: > Hi BTRFS developers, > > Here are a list of new issues I found: Thanks for sending the list to the list, hopefully this will make the bugs more visible as bugzilla gets low attention otherwise. -- To unsubscribe from this list: send the

Re: [PATCH 1/2] btrfs: code reorder in btrfs_prepare_sprout

2018-07-10 Thread David Sterba
On Mon, Jul 09, 2018 at 04:33:52PM +0800, Anand Jain wrote: > No functional change, bring the clone of fs_devices and its > operations closer, so that it indicates its purpose. > > Also add a comment to indicate why we clone the fs_devices. > > Signed-off-by: Anand Jain > --- >

Re: So, does btrfs check lowmem take days? weeks?

2018-07-10 Thread Su Yue
On 07/10/2018 12:55 PM, Qu Wenruo wrote: On 2018年07月10日 11:50, Marc MERLIN wrote: On Tue, Jul 10, 2018 at 09:34:36AM +0800, Qu Wenruo wrote: Ok, this is where I am now: WARNING: debug: end of checking extent item[18457780273152 169 1] type: 176 offset: 2 checking extent items

RE: [PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread Gu, Jinxiang
Duplicate one, please ignore this. > -Original Message- > From: linux-btrfs-ow...@vger.kernel.org > [mailto:linux-btrfs-ow...@vger.kernel.org] On Behalf Of Gu Jinxiang > Sent: Tuesday, July 10, 2018 6:27 PM > To: linux-btrfs@vger.kernel.org > Cc: nbori...@suse.com > Subject: [PATCH 2/2]

Re: [PATCH] btrfs: Remove unused function btrfs_account_dev_extents_size()

2018-07-10 Thread David Sterba
On Mon, Jul 09, 2018 at 02:52:54PM +0800, Qu Wenruo wrote: > This function is never used by any one in kernel, just remove it. It's good to note when and why the function got unused. In this case it's after removal of alloc_start mount option in 0d0c71b317207082856f40dbe8a2bac813f49677 "btrfs:

[PATCH v2 1/2] btrfs: make fs_devices to be a local variable

2018-07-10 Thread Gu Jinxiang
fs_devices is always passed to btrfs_scan_one_device which overrides it. And in the call stack below fs_devices is passed to btrfs_scan_one_device from btrfs_mount_root. And in btrfs_mount_root the output fs_devices of this call stack is not used. btrfs_mount_root ->

[PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread Gu Jinxiang
Instead of pointer to btrfs_fs_devices as an arg in btrfs_scan_one_device, better to make it as a return value. Signed-off-by: Gu Jinxiang --- fs/btrfs/super.c | 29 ++--- fs/btrfs/volumes.c | 14 +++--- fs/btrfs/volumes.h | 4 ++-- 3 files changed, 27

[PATCH v2 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread Gu Jinxiang
Instead of pointer to btrfs_fs_devices as an arg in btrfs_scan_one_device, better to make it as a return value. Signed-off-by: Gu Jinxiang --- changelog: v2: as comment by Nikolay, use ERR_CAST instead of cast type manually. fs/btrfs/super.c | 29 ++---

Re: [PATCH] btrfs: remove unused parameter

2018-07-10 Thread David Sterba
On Mon, Jul 09, 2018 at 02:39:15PM +0800, Gu Jinxiang wrote: > Since parameter flags is no more used since > commit d7407606564c ("btrfs: split parse_early_options() in two"), > remove it. Please be more specific about the function whre you remove the argument, something like "remove unused

Re: Transaction aborted (error -28) btrfs_run_delayed_refs*0x163/0x190

2018-07-10 Thread Martin Raiber
On 10.07.2018 09:04 Pete wrote: > I've just had the error in the subject which caused the file system to > go read-only. > > Further part of error message: > WARNING: CPU: 14 PID: 1351 at fs/btrfs/extent-tree.c:3076 > btrfs_run_delayed_refs*0x163/0x190 > > 'Screenshot' here: >

Re: [PATCH RFC 1/2] btrfs: scrub: Don't use inode page cache in scrub_handle_errored_block()

2018-07-10 Thread Nikolay Borisov
On 10.07.2018 10:14, Qu Wenruo wrote: > > > On 2018年07月10日 15:00, Nikolay Borisov wrote: >> >> >> On 10.07.2018 08:57, Qu Wenruo wrote: >>> When we need to fixup error blocks during scrub/dev-replace for >>> nodatasum extents, we still goes through the inode page cache and write >>> them back

Re: [PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread Nikolay Borisov
On 10.07.2018 09:33, Gu Jinxiang wrote: > Instead of pointer to btrfs_fs_devices as an arg in > btrfs_scan_one_device, better to make it as a return value. > > Signed-off-by: Gu Jinxiang > --- > fs/btrfs/super.c | 29 ++--- > fs/btrfs/volumes.c | 14 +++--- >

Re: [PATCH RFC 1/2] btrfs: scrub: Don't use inode page cache in scrub_handle_errored_block()

2018-07-10 Thread Qu Wenruo
On 2018年07月10日 15:00, Nikolay Borisov wrote: > > > On 10.07.2018 08:57, Qu Wenruo wrote: >> When we need to fixup error blocks during scrub/dev-replace for >> nodatasum extents, we still goes through the inode page cache and write >> them back onto disk. >> >> It's already proved that such

Transaction aborted (error -28) btrfs_run_delayed_refs*0x163/0x190

2018-07-10 Thread Pete
I've just had the error in the subject which caused the file system to go read-only. Further part of error message: WARNING: CPU: 14 PID: 1351 at fs/btrfs/extent-tree.c:3076 btrfs_run_delayed_refs*0x163/0x190 'Screenshot' here:

Re: [PATCH 1/2] btrfs: make fs_devices to be a local variable

2018-07-10 Thread Nikolay Borisov
On 10.07.2018 09:33, Gu Jinxiang wrote: > Since output parameter fs_devices of btrfs_parse_early_options is > not used in the caller, make it be a local variable. The changelog is a bit misleading, because 'fs_devices' is in fact used in the caller, however it's always passed to

Re: [PATCH RFC 1/2] btrfs: scrub: Don't use inode page cache in scrub_handle_errored_block()

2018-07-10 Thread Nikolay Borisov
On 10.07.2018 08:57, Qu Wenruo wrote: > When we need to fixup error blocks during scrub/dev-replace for > nodatasum extents, we still goes through the inode page cache and write > them back onto disk. > > It's already proved that such usage of on-disk data could lead to > serious data

[PATCH 1/2] btrfs: make fs_devices to be a local variable

2018-07-10 Thread Gu Jinxiang
Since output parameter fs_devices of btrfs_parse_early_options is not used in the caller, make it be a local variable. Signed-off-by: Gu Jinxiang --- fs/btrfs/super.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index

[PATCH 2/2] btrfs: get fs_devices pointer form btrfs_scan_one_device

2018-07-10 Thread Gu Jinxiang
Instead of pointer to btrfs_fs_devices as an arg in btrfs_scan_one_device, better to make it as a return value. Signed-off-by: Gu Jinxiang --- fs/btrfs/super.c | 29 ++--- fs/btrfs/volumes.c | 14 +++--- fs/btrfs/volumes.h | 4 ++-- 3 files changed, 27