Re: [PATCH 1/1] btrfs-progs: btrfstune: print seeding status

2019-01-03 Thread Nikolay Borisov
On 4.01.19 г. 1:22 ч., David Disseldorp wrote: > btrfstune -s prints "Seeding flag is currently [un]set", based on > whether or not BTRFS_SUPER_FLAG_SEEDING is enabled for the given device. > > Signed-off-by: David Disseldorp btrfs inspect-internal dump-super already supports showing seeding

[PATCH v14] btrfs-progs: add cli to forget one or all scanned devices

2019-01-03 Thread Anand Jain
This patch adds cli btrfs device forget [dev] to remove the given device structure in the kernel if the device is unmounted. If no argument is given it shall remove all stale (device which are not mounted) from the kernel. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- v13->v14: no

[PATCH v14] Add cli and ioctl to forget scanned device(s)

2019-01-03 Thread Anand Jain
v14: Splits refactoring part of btrfs_free_stale_devices() into a new patch v13: Please ref individual patches. v12: Fixed coding style - leave space between " : ". v11: btrfs-progs: Bring the code into the else part of if(forget). Use strerror to print the erorr instead of re

[PATCH 1/2 v14] btrfs: refactor btrfs_free_stale_devices() to get return value

2019-01-03 Thread Anand Jain
Preparatory patch to add forget cli. Re-factors btrfs_free_stale_devices() to obtain return status. As this function can fail if it can't find the given path (returns -ENOENT) or trying to delete a mounted device (returns -EBUSY). Signed-off-by: Anand Jain --- v14: born. A split from the patch

[PATCH 2/2 v14] btrfs: introduce feature to forget a btrfs device

2019-01-03 Thread Anand Jain
Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty. IOW(BTRFS_IOCTL_MAGIC, 5, ..) This patch adds new ioctl BTRFS_IOC_FORGET_DEV which can be sent from the /d

Re: [PATCH v13] btrfs: introduce feature to forget a btrfs device

2019-01-03 Thread Anand Jain
On 01/03/2019 11:24 PM, David Sterba wrote: On Thu, Jan 03, 2019 at 04:01:37PM +0800, Anand Jain wrote: Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty.

Re: Unrecoverable btrfs corruption (backref bytes do not match extent backref)

2019-01-03 Thread Qu Wenruo
On 2019/1/4 上午11:43, Chris Murphy wrote: > On Thu, Jan 3, 2019 at 6:32 PM Qu Wenruo wrote: >> >> >> >> On 2019/1/4 上午9:15, Chris Murphy wrote: >>> If you use btrfs-image -ss option, there won't be any sensitive >>> information included. Files are hashed. Some short name files or dirs >>> can't b

Re: Unrecoverable btrfs corruption (backref bytes do not match extent backref)

2019-01-03 Thread Chris Murphy
On Thu, Jan 3, 2019 at 6:32 PM Qu Wenruo wrote: > > > > On 2019/1/4 上午9:15, Chris Murphy wrote: > > If you use btrfs-image -ss option, there won't be any sensitive > > information included. Files are hashed. Some short name files or dirs > > can't be hashed (you'll see a warning) and those are rep

Re: Unrecoverable btrfs corruption (backref bytes do not match extent backref)

2019-01-03 Thread Hans van Kranenburg
On 1/4/19 2:32 AM, Qu Wenruo wrote: > > > On 2019/1/4 上午9:15, Chris Murphy wrote: >> On Thu, Jan 3, 2019 at 3:13 PM Nazar Mokrynskyi wrote: >> >>> root@ubuntu:~# btrfsck /dev/mapper/luks-739967f1-9770-470a-a031-8d8b8bcdb350 >>> warning, bad space info total_bytes 2155872256 used 2155876352 >>> w

Re: Unrecoverable btrfs corruption (backref bytes do not match extent backref)

2019-01-03 Thread Qu Wenruo
On 2019/1/4 上午9:15, Chris Murphy wrote: > On Thu, Jan 3, 2019 at 3:13 PM Nazar Mokrynskyi wrote: > >> root@ubuntu:~# btrfsck /dev/mapper/luks-739967f1-9770-470a-a031-8d8b8bcdb350 >> warning, bad space info total_bytes 2155872256 used 2155876352 >> warning, bad space info total_bytes 3229614080

Re: Unrecoverable btrfs corruption (backref bytes do not match extent backref)

2019-01-03 Thread Chris Murphy
On Thu, Jan 3, 2019 at 3:13 PM Nazar Mokrynskyi wrote: > root@ubuntu:~# btrfsck /dev/mapper/luks-739967f1-9770-470a-a031-8d8b8bcdb350 > warning, bad space info total_bytes 2155872256 used 2155876352 > warning, bad space info total_bytes 3229614080 used 3229618176 > warning, bad space info total_b

[PATCH 1/1] btrfs-progs: btrfstune: print seeding status

2019-01-03 Thread David Disseldorp
btrfstune -s prints "Seeding flag is currently [un]set", based on whether or not BTRFS_SUPER_FLAG_SEEDING is enabled for the given device. Signed-off-by: David Disseldorp --- Documentation/btrfstune.asciidoc | 3 +++ btrfstune.c | 29 +++-- 2 files

[PATCH 0/1] btrfs-progs: btrfstune: print seeding status

2019-01-03 Thread David Disseldorp
AFAICT there's currently no way to easily determine whether or not seeding is enabled for a given device. The following patch adds new "btrfstune -s" functionality to perform this. An xfstests test case will follow if/when the interface is deemed acceptable. Cheers, David

Unrecoverable btrfs corruption (backref bytes do not match extent backref)

2019-01-03 Thread Nazar Mokrynskyi
Today I have faced yet another BTRFS corruption, the only major software change in recent days was upgrade to Linux 4.20, so this is something to keep in mind. Previous corruption happened with kernel 4.14 a bit over a year ago I think, so filesystem was with high probability created in December

Re: [PATCH] Btrfs: setup a nofs context for memory allocation at __btrfs_set_acl

2019-01-03 Thread David Sterba
On Thu, Dec 13, 2018 at 09:16:56PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > We are holding a transaction handle when setting an acl, therefore we can > not allocate the xattr value buffer using GFP_KERNEL, as we could deadlock > if reclaim is triggered by the allocation, theref

Re: [PATCH] Btrfs: setup a nofs context for memory allocation at btrfs_create_tree()

2019-01-03 Thread David Sterba
On Thu, Dec 13, 2018 at 09:16:45PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > We are holding a transaction handle when creating a tree, therefore we can > not allocate the root using GFP_KERNEL, as we could deadlock if reclaim is > triggered by the allocation, therefore setup a n

Re: [PATCH 6/7] btrfs: Replace open-coded maths with DIV_ROUND_UP

2019-01-03 Thread Nikolay Borisov
On 3.01.19 г. 16:44 ч., David Sterba wrote: > On Thu, Jan 03, 2019 at 10:50:04AM +0200, Nikolay Borisov wrote: >> In a couple of places it's required to calculate the number of pages >> given a start and end offsets. Currently this is opencoded, unify the >> code base by replacing all such sites

Re: [PATCH v13] btrfs: introduce feature to forget a btrfs device

2019-01-03 Thread David Sterba
On Thu, Jan 03, 2019 at 04:01:37PM +0800, Anand Jain wrote: > Support for a new command 'btrfs dev forget [dev]' is proposed here > to undo the effects of 'btrfs dev scan [dev]'. For this purpose > this patch proposes to use ioctl #5 as it was empty. > IOW(BTRFS_IOCTL_MAGIC, 5, ..) > This pat

Re: [PATCH 6/7] btrfs: Replace open-coded maths with DIV_ROUND_UP

2019-01-03 Thread David Sterba
On Thu, Jan 03, 2019 at 10:50:04AM +0200, Nikolay Borisov wrote: > In a couple of places it's required to calculate the number of pages > given a start and end offsets. Currently this is opencoded, unify the > code base by replacing all such sites with the DIV_ROUND_UP macro. Also, > current open-c

Re: [PATCH RESEND v12] btrfs: introduce feature to forget a btrfs device

2019-01-03 Thread David Sterba
On Thu, Jan 03, 2019 at 03:54:26PM +0800, Anand Jain wrote: > > I think this should reflect the status of the operation. The ioctl > > caller has no information about success/error. Eg. an invalid device > > path passed could return -ENOENT, 0 if it was released and 1 if not. > > > > In case of al

Re: BTRFS corruption: open_ctree failed

2019-01-03 Thread b11g
I heard of the ext4 bug, but I didn't check my kernel more carefully - contrarily to what I reported previously, my kernel version was 4.14.79, NOT 4.19.12 (I think I installed the latter, but the system was still pending a reboot). I am sorry if this caused confusion. AFAIK, those are the flag

Re: BTRFS corruption: open_ctree failed

2019-01-03 Thread b11g
Responded in-line. ‐‐‐ Original Message ‐‐‐ On Thursday, 3 January 2019 05:52, Chris Murphy wrote: > On Wed, Jan 2, 2019 at 5:26 PM b11g b...@protonmail.com wrote: > > > Hi all, > > I have several BTRFS success-stories, and I've been an happy user for quite > > a long time now. I was th

Re: BTRFS corruption: open_ctree failed

2019-01-03 Thread Andrea Gelmini
My last email on this thread: I swear. I don't want to bother the mailing list about this more. On Thu, Jan 03, 2019 at 05:29:51PM +0900, Tomasz Chmielewski wrote: > I could see filesystem corruption on every system using with PPA 4.19 lower > than .8. Didn't do any kernel boot parameter changes

Re: [PATCH V7] Btrfs: enhance raid1/10 balance heuristic

2019-01-03 Thread Anand Jain
On 01/02/2019 02:39 AM, Timofey Titovets wrote: Oh, just forgot to answer. ср, 14 нояб. 2018 г. в 04:27, Anand Jain : I am ok with the least used path approach here for the IO routing that's probably most reasonable in generic configurations. It can be default read mirror policy as well. (

[PATCH 1/7] btrfs: Remove inode argument from async_cow_submit

2019-01-03 Thread Nikolay Borisov
We already pass the async_cow struct that holds a reference to the inode. Exploit this fact and remove the extra inode argument. No functional changes. Signed-off-by: Nikolay Borisov --- fs/btrfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/inode.c b

[PATCH 3/7] btrfs: Use ihold instead of igrab in cow_file_range_async

2019-01-03 Thread Nikolay Borisov
ihold is supposed to be used when the caller already has a reference to the inode. In the case of cow_file_range_async this invariants holds, since the 3 call chains leading to this function all take a reference: btrfs_writepage <--- does igrab extent_write_full_page __extent_writepage writ

[PATCH 0/7] More misc fixes

2019-01-03 Thread Nikolay Borisov
Here is an assortment of fixes, mainly around the async (compressed) cow path. Just removes some redundant arguments/local variables, makes shrink_delalloc a bit more readable by simplifying variable usage and giving more appropriate names. Also documents the ->inode null check in async_cow_subm

[PATCH 6/7] btrfs: Replace open-coded maths with DIV_ROUND_UP

2019-01-03 Thread Nikolay Borisov
In a couple of places it's required to calculate the number of pages given a start and end offsets. Currently this is opencoded, unify the code base by replacing all such sites with the DIV_ROUND_UP macro. Also, current open-coded sites were buggy in that they were adding 'PAGE_SIZE', rather than '

[PATCH 2/7] btrfs: Remove isize local variable in compress_file_range

2019-01-03 Thread Nikolay Borisov
It's used only once so just inline the call to i_size_read. Signed-off-by: Nikolay Borisov --- fs/btrfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 43baca50fba5..97ad494d0b3c 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs

[PATCH 5/7] btrfs: Document logic in async_cow_submit

2019-01-03 Thread Nikolay Borisov
Add a comment explaining when ->inode could be null and why we always perform the ->async_delalloc_pages modification. Signed-off-by: Nikolay Borisov --- fs/btrfs/inode.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1a7f790b68e8..41ad0d06b3d

[PATCH 4/7] btrfs: Remove WARN_ON in btrfs_alloc_delalloc_work

2019-01-03 Thread Nikolay Borisov
It can never trigger since before calling alloc_delalloc_work we have called igrab in start_delalloc_inodes. Signed-off-by: Nikolay Borisov --- fs/btrfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f023d2b5ef49..1a7f790b68e8 100644 --- a/fs

[PATCH 7/7] btrfs: Refactor shrink_delalloc

2019-01-03 Thread Nikolay Borisov
Add a couple of comments regarding the logic flow in shrink_delalloc. Then, cease using max_reclaim as a temporary variable when calculating nr_pages. Finally give max_reclaim a more becoming name, which uneqivocally shows at what this variable really holds. No functional changes. Signed-off-by: N

Re: BTRFS corruption: open_ctree failed

2019-01-03 Thread Tomasz Chmielewski
On 2019-01-03 17:22, Andrea Gelmini wrote: On Thu, Jan 03, 2019 at 04:43:20PM +0900, Tomasz Chmielewski wrote: > And it's not a default/usual configuration. Still - it is a default configuration for some distributions. I.e. Ubuntu "ppa" kernels[1] have this enabled by default (at least 4.19.x

Re: BTRFS corruption: open_ctree failed

2019-01-03 Thread Andrea Gelmini
On Thu, Jan 03, 2019 at 04:43:20PM +0900, Tomasz Chmielewski wrote: > > And it's not a default/usual configuration. > > Still - it is a default configuration for some distributions. I.e. Ubuntu > "ppa" kernels[1] have this enabled by default (at least 4.19.x and 4.20.x). a) he is not using Ubuntu

Re: [PATCH 1/1] btrfs: add kernel scrub log messages

2019-01-03 Thread Anand Jain
On 01/03/2019 01:20 AM, David Sterba wrote: On Mon, Dec 17, 2018 at 11:15:12AM +0800, Anand Jain wrote: scrub kernel messages helps debug and audit, add them to the log. Signed-off-by: Anand Jain --- fs/btrfs/scrub.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/scrub

[PATCH v2] btrfs: add kernel scrub log messages

2019-01-03 Thread Anand Jain
scrub kernel messages helps debug and audit, add them to the log. Signed-off-by: Anand Jain --- v1->v2: fix btrfs_info, using string directly. Add spacing. fs/btrfs/scrub.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 6dcd36d7b849..aadafc3e52

[PATCH v13] btrfs: introduce feature to forget a btrfs device

2019-01-03 Thread Anand Jain
Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty. IOW(BTRFS_IOCTL_MAGIC, 5, ..) This patch adds new ioctl BTRFS_IOC_FORGET_DEV which can be sent from the /d

[PATCH v13] Add cli and ioctl to forget scanned device(s)

2019-01-03 Thread Anand Jain
v13: Please ref individual patches. v12: Fixed coding style - leave space between " : ". v11: btrfs-progs: Bring the code into the else part of if(forget). Use strerror to print the erorr instead of ret. v10: Make btrfs-progs changes more readable. With an effort to keep the

[PATCH v13] btrfs-progs: add cli to forget one or all scanned devices

2019-01-03 Thread Anand Jain
This patch adds cli btrfs device forget [dev] to remove the given device structure in the kernel if the device is unmounted. If no argument is given it shall remove all stale (device which are not mounted) from the kernel. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- v12->v13: no