[PATCH] btrfs: tree-checker: Verify block_group_item

2018-07-01 Thread Qu Wenruo
As reported in https://bugzilla.kernel.org/show_bug.cgi?id=199849, a crafted image with invalid block group items could make free space cache code to cause panic. We could early detect such invalid block group item by checking: 1) Size (key) We have a up limit on block group item (10G) 2)

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

2018-07-01 Thread Marc MERLIN
On Mon, Jul 02, 2018 at 10:02:33AM +0800, Su Yue wrote: > Could you try follow dumps? They shouldn't cost much time. > > #btrfs inspect dump-tree -t 21872 | grep -C 50 "374857 > EXTENT_DATA " > > #btrfs inspect dump-tree -t 22911 | grep -C 50 "374857 > EXTENT_DATA " Ok, that's 29MB, so it

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

2018-07-01 Thread Su Yue
On 07/02/2018 07:22 AM, Marc MERLIN wrote: On Thu, Jun 28, 2018 at 11:43:54PM -0700, Marc MERLIN wrote: On Fri, Jun 29, 2018 at 02:32:44PM +0800, Su Yue wrote: https://github.com/Damenly/btrfs-progs/tree/tmp1 Not sure if I undertand that you meant, here. Sorry for my unclear words.

Re: btrfs check --readonly crash

2018-07-01 Thread Qu Wenruo
On 2018年07月02日 02:01, Lewis Diamond wrote: > Yes, you are right, after running `btrfs check --clear-space-cache v1 > ` a `btrfs check --readonly` passes without error. Thanks! > > I'm absolutely not familiar with the btrfs code, but would it be > possible to have some error handling in `btrfs

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

2018-07-01 Thread Marc MERLIN
On Thu, Jun 28, 2018 at 11:43:54PM -0700, Marc MERLIN wrote: > On Fri, Jun 29, 2018 at 02:32:44PM +0800, Su Yue wrote: > > > > https://github.com/Damenly/btrfs-progs/tree/tmp1 > > > > > > Not sure if I undertand that you meant, here. > > > > > Sorry for my unclear words. > > Simply speaking, I

Re: btrfs check of a raid0?

2018-07-01 Thread Marc MERLIN
On Sun, Jul 01, 2018 at 01:15:09PM -0600, Chris Murphy wrote: > > How is it supposed to work when you have multiple devices for a btrfs > > filesystem? > > > > gargamel:~# btrfs check --repair -p /dev/bcache2 > > enabling repair mode > > ERROR: mount check: cannot open /dev/bcache2: No such device

Re: btrfs check of a raid0?

2018-07-01 Thread Chris Murphy
On Sun, Jul 1, 2018 at 10:27 AM, Marc MERLIN wrote: > Howdy, > > I have a btrfs filesystem made out of 2 devices: > [ 75.141414] BTRFS: device label btrfs_space devid 1 transid 429220 > /dev/bcache3 > [ 75.164745] BTRFS: device label btrfs_space devid 2 transid 429220 > /dev/bcache2 > > One

Re: btrfs check --readonly crash

2018-07-01 Thread Chris Murphy
On Sun, Jul 1, 2018 at 12:01 PM, Lewis Diamond wrote: > Yes, you are right, after running `btrfs check --clear-space-cache v1 > ` a `btrfs check --readonly` passes without error. Thanks! > > I'm absolutely not familiar with the btrfs code, but would it be > possible to have some error handling in

btrfs check of a raid0?

2018-07-01 Thread Marc MERLIN
Howdy, I have a btrfs filesystem made out of 2 devices: [ 75.141414] BTRFS: device label btrfs_space devid 1 transid 429220 /dev/bcache3 [ 75.164745] BTRFS: device label btrfs_space devid 2 transid 429220 /dev/bcache2 One of the 2 devices had a hardware error (not btrfs' fault):

Re: btrfs check --readonly crash

2018-07-01 Thread Lewis Diamond
Yes, you are right, after running `btrfs check --clear-space-cache v1 ` a `btrfs check --readonly` passes without error. Thanks! I'm absolutely not familiar with the btrfs code, but would it be possible to have some error handling in `btrfs check` that picks up this situation instead of crashing?

Re: A list of bugs in btrfs found by fuzzing

2018-07-01 Thread Qu Wenruo
On 2018年07月01日 08:06, Xu, Wen wrote: > Dear BTRFS developers, > > I would like to know if these issues are fixed or handled? Thanks. Some bugs looks interesting and may be resolved by more checks in tree-checker. I'll take a look at them. Thanks for the detailed and comprehensive report, Qu