BTRFS errors, and won't mount

2019-10-04 Thread Patrick Dijkgraaf
Hi guys, During the night, I started getting the following errors and data was no longer accessible: [Fri Oct 4 08:04:26 2019] btree_readpage_end_io_hook: 2522 callbacks suppressed [Fri Oct 4 08:04:26 2019] BTRFS error (device sde2): bad tree block start 17686343003259060482 7808404996096 [Fri

Re: BTRFS errors, and won't mount

2019-10-04 Thread Patrick Dijkgraaf
BTRFS restore shows the following output: #btrfs restore -D /dev/sde2 /mnt/data This is a dry-run, no files are going to be restored parent transid verify failed on 4314638041088 wanted 470169 found 470107 parent transid verify failed on 4314638041088 wanted 470169 found 470107 checksum verify fai

Re: BTRFS errors, and won't mount

2019-10-04 Thread Qu Wenruo
On 2019/10/4 下午2:59, Patrick Dijkgraaf wrote: > Hi guys, > > During the night, I started getting the following errors and data was > no longer accessible: > > [Fri Oct 4 08:04:26 2019] btree_readpage_end_io_hook: 2522 callbacks > suppressed > [Fri Oct 4 08:04:26 2019] BTRFS error (device sde2

Re: BTRFS errors, and won't mount

2019-10-04 Thread Patrick Dijkgraaf
Hi Qu, I know about RAID5/6 risks, so I won't blame anyone but myself. I'm currenlty working on another solution, but I was not quite there yet... mount -o ro /dev/sdh2 /mnt/data gives me: [Fri Oct 4 09:36:27 2019] BTRFS info (device sde2): disk space caching is enabled [Fri Oct 4 09:36:27 201

[PATCH 3/4] btrfs: include non-missing as a qualifier for the latest_bdev

2019-10-04 Thread Anand Jain
btrfs_free_extra_devids() reorgs fs_devices::latest_bdev to point to the bdev with greatest device::generation number. For a typical-missing device the generation number is zero so fs_devices::latest_bdev will never point to it. But if the missing device is due to alienating [1], then device::gene

[PATCH 4/4] btrfs: free alien device due to device add

2019-10-04 Thread Anand Jain
When the old device has new fsid through btrfs device add -f our fs_devices list has an alien device in one of the fs_devices. By having an alien device in fs_devices, we have two issues so far 1. missing device is not shows as missing in the userland Which is due to cracks in the function btrf

[PATCH 2/4] btrfs: delete identified alien device in open_fs_devices

2019-10-04 Thread Anand Jain
In open_fs_devices() we identify alien device but we don't reset its the device::name. So progs device list does not show the device missing as shown in the script below. mkfs.btrfs -fq /dev/sdd && mount /dev/sdd /btrfs mkfs.btrfs -fq -draid1 -mraid1 /dev/sdc /dev/sdb sleep 3 # avoid racing with u

[PATCH 1/4] btrfs: drop useless goto in open_fs_devices

2019-10-04 Thread Anand Jain
There is no need of goto out in open_fs_devices() as there is nothing special done at %out:. So refactor it. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e176346afed

[PATCH 0/4] btrfs: fix issues due to alien device

2019-10-04 Thread Anand Jain
Alien device is a device in fs_devices list having a different fsid than the expected fsid. This patch set fixes issues found due to the same. Patch1: is a cleanup patch, not related. Patch2: fixes the missing device not missing in the userland, by hardening the function btrfs_open_one_dev

Re: BTRFS errors, and won't mount

2019-10-04 Thread Qu Wenruo
On 2019/10/4 下午3:41, Patrick Dijkgraaf wrote: > Hi Qu, > > I know about RAID5/6 risks, so I won't blame anyone but myself. I'm > currenlty working on another solution, but I was not quite there yet... > > mount -o ro /dev/sdh2 /mnt/data gives me: > > [Fri Oct 4 09:36:27 2019] BTRFS info (devi

Re: BTRFS errors, and won't mount

2019-10-04 Thread Patrick Dijkgraaf
Decided to upgrade my system to the latest and give it a shot: # btrfs check /dev/sde2 Opening filesystem to check... parent transid verify failed on 4314780106752 wanted 470169 found 470107 checksum verify failed on 4314780106752 found 7077566E wanted 9494EBD8 checksum verify failed on 4314780106

Re: [PATCH 3/4] btrfs: include non-missing as a qualifier for the latest_bdev

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 10:50 ч., Anand Jain wrote: > btrfs_free_extra_devids() reorgs fs_devices::latest_bdev > to point to the bdev with greatest device::generation number. > For a typical-missing device the generation number is zero so > fs_devices::latest_bdev will never point to it. > > But if the m

Re: [PATCH 1/4] btrfs: drop useless goto in open_fs_devices

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 10:50 ч., Anand Jain wrote: > There is no need of goto out in open_fs_devices() as there is nothing > special done at %out:. So refactor it. > > Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > fs/btrfs/volumes.c | 12 +--- > 1 file changed, 5 insertions

Re: [PATCH 2/4] btrfs: delete identified alien device in open_fs_devices

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 10:50 ч., Anand Jain wrote: > In open_fs_devices() we identify alien device but we don't reset its > the device::name. So progs device list does not show the device missing > as shown in the script below. > > mkfs.btrfs -fq /dev/sdd && mount /dev/sdd /btrfs > mkfs.btrfs -fq -draid

Re: [PATCH 0/4] btrfs: fix issues due to alien device

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 10:49 ч., Anand Jain wrote: > Alien device is a device in fs_devices list having a different fsid than > the expected fsid. This patch set fixes issues found due to the same. Are you going to submit an fstests patch for this bug ? > > Patch1: is a cleanup patch, not related. > P

Re: [PATCH] btrfs: drop unused parameter is_new from btrfs_iget

2019-10-04 Thread Anand Jain
On 10/4/19 1:09 AM, David Sterba wrote: The parameter is now always set to NULL and could be dropped. The last user was get_default_root but that got reworked in 05dbe6837b60 ("Btrfs: unify subvol= and subvolid= mounting") and the parameter became unused. Signed-off-by: David Sterba Reviewed-

Re: [Not TLS] Re: [PATCH 3/4] btrfs: include non-missing as a qualifier for the latest_bdev

2019-10-04 Thread Graham Cobb
On 04/10/2019 09:11, Nikolay Borisov wrote: > > > On 4.10.19 г. 10:50 ч., Anand Jain wrote: >> btrfs_free_extra_devids() reorgs fs_devices::latest_bdev >> to point to the bdev with greatest device::generation number. >> For a typical-missing device the generation number is zero so >> fs_devices::

Re: [Not TLS] Re: [PATCH 3/4] btrfs: include non-missing as a qualifier for the latest_bdev

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 12:08 ч., Graham Cobb wrote: > On 04/10/2019 09:11, Nikolay Borisov wrote: >> >> >> On 4.10.19 г. 10:50 ч., Anand Jain wrote: >>> btrfs_free_extra_devids() reorgs fs_devices::latest_bdev >>> to point to the bdev with greatest device::generation number. >>> For a typical-missing dev

[PATCH 0/3] btrfs: tree-checker: False alerts fixes for log trees

2019-10-04 Thread Qu Wenruo
There is a false alerts of tree-checker when running fstests/btrfs/063 in a loop. The bug is caused by commit 59b0d030fb30 ("btrfs: tree-checker: Try to detect missing INODE_ITEM"). For the full error analyse, please check the first patch. The first patch will give it a quick fix, so that it can

[PATCH 2/3] btrfs: tree-checker: Refactor prev_key check for ino into a function

2019-10-04 Thread Qu Wenruo
Refactor the check for prev_key->objectid of the following key types into one function, check_prev_ino(): - EXTENT_DATA - INODE_REF - DIR_INDEX - DIR_ITEM - XATTR_ITEM Despite the refactor, also add the check of prev_key for INODE_REF. Signed-off-by: Qu Wenruo --- fs/btrfs/tree-checker.c | 113

[PATCH 3/3] btrfs: Enhance the error outputting for write time tree checker

2019-10-04 Thread Qu Wenruo
Unlike read time tree checker error, write time error can't be inspected by "btrfs ins dump-tree", so we need extra info to determine what's going wrong. The patch will add the following output for write time tree checker error: - The content of the offending tree block To help determining if it

[PATCH 1/3] btrfs: tree-checker: Fix false alerts on log trees

2019-10-04 Thread Qu Wenruo
[BUG] When running btrfs/063 in a loop, we got the following random write time tree checker error: BTRFS critical (device dm-4): corrupt leaf: root=18446744073709551610 block=33095680 slot=2 ino=307 file_offset=0, invalid previous key objectid, have 305 expect 307 BTRFS info (device dm-4): l

Re: [bug] strange systemd-udevd scan for btrfs device

2019-10-04 Thread Anand Jain
use appropriate ml for systemd bugs -systemd-b...@lists.freedesktop.org +systemd-de...@lists.freedesktop.org inline below.. On 10/2/19 9:33 PM, Andrei Borzenkov wrote: On Wed, Oct 2, 2019 at 1:19 PM Anand Jain wrote: On 10/2/19 6:02 PM, Anand Jain wrote: On 10/2/19 5:55 PM, Andrei Bor

Re: BTRFS Raid5 error during Scrub.

2019-10-04 Thread Robert Krig
Thank you all for your help so far. I'm doing backups at the moment. My other Server is a ZFS system. I think what I'm going to do, is to have this system, that's currently BTRFS RAID5 migrated to using ZFS and once that's done, migrate my backup system to BTRFS RAID5. That way I can still experim

Re: [PATCH 1/3] btrfs: add __cold attribute to more functions

2019-10-04 Thread David Sterba
On Wed, Oct 02, 2019 at 01:52:16PM +0300, Nikolay Borisov wrote: > On 1.10.19 г. 20:57 ч., David Sterba wrote: > > The attribute can mark functions supposed to be called rarely if at all > > and the text can be moved to sections far from the other code. The > > attribute has been added to several f

Re: [PATCH 2/3] btrfs: add const function attribute

2019-10-04 Thread David Sterba
On Wed, Oct 02, 2019 at 02:07:50PM +0300, Nikolay Borisov wrote: > > +struct list_head * __attribute_const__ btrfs_get_fs_uuids(void) > > I'm not entirely sure this function is cons. According to the manual: > > Calls to functions whose return value is not affected by changes to the > observable

Re: Intro to fstests environment?

2019-10-04 Thread Austin S. Hemmelgarn
On 2019-10-03 13:51, Graham Cobb wrote: Hi, I seem to have another case where scrub gets confused when it is cancelled and restarted many times (or, maybe, it is my error or something). I will look into it further but, instead of just hacking away at my script to work out what is going on, I tho

Re: BTRFS errors, and won't mount

2019-10-04 Thread Patrick Dijkgraaf
Hi Qu, Tried it with backup roots and it won't mount. I have a backup of a week ago and I'll accept the dataloss. I'll rebuild (this time without BTRFS RAID5/6) and restore. Thanks for your help! -- Groet / Cheers, Patrick Dijkgraaf On Fri, 2019-10-04 at 09:59 +0200, Patrick Dijkgraaf wrote

Re: while (1) in btrfs_relocate_block_group didn't end

2019-10-04 Thread Cebtenzzre
On Sun, 2019-09-29 at 07:37 +0800, Qu Wenruo wrote: > > On 2019/9/29 上午2:36, Cebtenzzre wrote: > > On Mon, 2019-09-16 at 17:20 -0400, Cebtenzzre wrote: > > > On Sat, 2019-09-14 at 17:36 -0400, Cebtenzzre wrote: > > > > Hi, > > > > > > > > I started a balance of one block group, and I saw this in

Re: [PATCH 1/3] btrfs: tree-checker: Fix false alerts on log trees

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 12:31 ч., Qu Wenruo wrote: > [BUG] > When running btrfs/063 in a loop, we got the following random write time > tree checker error: > > BTRFS critical (device dm-4): corrupt leaf: root=18446744073709551610 > block=33095680 slot=2 ino=307 file_offset=0, invalid previous key obje

Re: [PATCH 1/3] btrfs: tree-checker: Fix false alerts on log trees

2019-10-04 Thread Filipe Manana
On Fri, Oct 4, 2019 at 2:54 PM Nikolay Borisov wrote: > > > > On 4.10.19 г. 12:31 ч., Qu Wenruo wrote: > > [BUG] > > When running btrfs/063 in a loop, we got the following random write time > > tree checker error: > > > > BTRFS critical (device dm-4): corrupt leaf: root=18446744073709551610 > >

Re: [PATCH 1/3] btrfs: tree-checker: Fix false alerts on log trees

2019-10-04 Thread Filipe Manana
On Fri, Oct 4, 2019 at 11:27 AM Qu Wenruo wrote: > > [BUG] > When running btrfs/063 in a loop, we got the following random write time > tree checker error: > > BTRFS critical (device dm-4): corrupt leaf: root=18446744073709551610 > block=33095680 slot=2 ino=307 file_offset=0, invalid previous k

Re: [PATCH 1/3] btrfs: tree-checker: Fix false alerts on log trees

2019-10-04 Thread Nikolay Borisov
On 4.10.19 г. 17:13 ч., Filipe Manana wrote: > On Fri, Oct 4, 2019 at 2:54 PM Nikolay Borisov wrote: >> >> >> >> On 4.10.19 г. 12:31 ч., Qu Wenruo wrote: >>> [BUG] >>> When running btrfs/063 in a loop, we got the following random write time >>> tree checker error: >>> >>> BTRFS critical (devi

[PATCH 1/3] btrfs: remove unnecessary hash_init()

2019-10-04 Thread Chengguang Xu
hash_init() is not necessary in btrfs_props_init(), so remove it. Signed-off-by: Chengguang Xu --- fs/btrfs/props.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index 1e664e0b59b8..68508db3dc65 100644 --- a/fs/btrfs/props.c +++ b/fs/btrfs/props.c @@ -4

[PATCH 3/3] btrfs: using enum to replace macro

2019-10-04 Thread Chengguang Xu
using enum to replace macro definition for extent types. Signed-off-by: Chengguang Xu --- fs/btrfs/tree-checker.c | 4 ++-- include/uapi/linux/btrfs_tree.h | 10 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c i

[PATCH 2/3] btrfs: code cleanup for compression type

2019-10-04 Thread Chengguang Xu
Let BTRFS_COMPRESS_TYPES represents the total number of cmpressoin types and fix related calling places. It will be more safe when adding new compression type in the future. Signed-off-by: Chengguang Xu --- fs/btrfs/compression.c | 2 ++ fs/btrfs/compression.h | 12 ++-- fs/btrfs/ioct