Re: btrfs restore corrupt file

2017-11-22 Thread Qu Wenruo
On 2017年11月23日 13:25, Chris Murphy wrote: > On Wed, Nov 22, 2017 at 12:18 PM, Jorge Bastos > wrote: >> Hello, >> >> While doing btrfs checksum testing I purposely corrupted a file and >> got the expect I/O error when trying to copy it, I also tested btrfs >> restore to see if I could recover a

Re: WARNING: CPU: 3 PID: 20953 at /usr/src/linux/fs/btrfs/raid56.c:848 __free_raid_bio+0x8e/0xa0

2017-11-22 Thread Jérôme Carretero
Hi, On Wed, 22 Nov 2017 15:35:35 -0800 Liu Bo wrote: > On Mon, Nov 20, 2017 at 02:00:07AM -0500, Jérôme Carretero wrote: > > [ cut here ] [633254.461294] WARNING: CPU: > > 3 PID: 20953 at /usr/src/linux/fs/btrfs/raid56.c:848 > > __free_raid_bio+0x8e/0xa0 > > > The van

Re: btrfs restore corrupt file

2017-11-22 Thread Chris Murphy
On Wed, Nov 22, 2017 at 12:18 PM, Jorge Bastos wrote: > Hello, > > While doing btrfs checksum testing I purposely corrupted a file and > got the expect I/O error when trying to copy it, I also tested btrfs > restore to see if I could recover a known corrupt file and it did copy > it but there was

Re: btrfs-progs-4.13: cmds-inspect-tree-stats.h: No such file or directory

2017-11-22 Thread John L. Center
On 11/22/2017 11:15 PM, John L. Center wrote: On 09/09/2017 01:48 AM, Uli Heller wrote: I dowloaded the btrfs-progs-v4.13.tar.xz tarball and tried to build it. Unfortunately, I get an error about cmds-inspect-tree-stats.h. The file seems to be missing from the tarball, it used to exist in v4

Re: btrfs-progs-4.13: cmds-inspect-tree-stats.h: No such file or directory

2017-11-22 Thread John L. Center
On 09/09/2017 01:48 AM, Uli Heller wrote: I dowloaded the btrfs-progs-v4.13.tar.xz tarball and tried to build it. Unfortunately, I get an error about cmds-inspect-tree-stats.h. The file seems to be missing from the tarball, it used to exist in v4.12. ... true -g -Os -fstack-protector --param=

Re: misc/021-image-multi-devices fails on latest btrfs-devel/misc-next

2017-11-22 Thread Lakshmipathi.G
Quick update: It continues to fail: https://asciinema.org/a/8HAL3uZ4MG7eb5gXnlgq3jm7q Cheers, Lakshmipathi.G http://www.giis.co.in http://www.webminal.org On Sat, Nov 18, 2017 at 12:59 PM, Lakshmipathi.G wrote: > Hi. > > Few days back(Nov14th) this(misc/021-image-multi-devices) test script

Re: [PATCH v7 0/4] Add the ability to do BPF directed error injection

2017-11-22 Thread Alexei Starovoitov
On Wed, Nov 22, 2017 at 04:23:29PM -0500, Josef Bacik wrote: > This is hopefully the final version, I've addressed the comment by Igno and > added his Acks. > > v6->v7: > - moved the opt-in macro to bpf.h out of kprobes.h. Thanks Josef! All patches look great to me. We'll probably take them all i

Re: uncorrectable errors in Raid 10

2017-11-22 Thread Qu Wenruo
On 2017年11月23日 00:38, Steffen Sindzinski wrote: > Hello, > > I did btrfs check --readonly on both disk without finding any error. To > reconfirm I did a scrub again which still has found 2 uncorrectable Still metadata corruption? > errors. I had to boot into Arch Linux 4.13.12-1-ARCH > btrfs-p

Re: WARNING: CPU: 3 PID: 20953 at /usr/src/linux/fs/btrfs/raid56.c:848 __free_raid_bio+0x8e/0xa0

2017-11-22 Thread Liu Bo
On Mon, Nov 20, 2017 at 02:00:07AM -0500, Jérôme Carretero wrote: > Hi, > > > > This was while doing a "userspace scrub" with "tar c": > > [633250.707455] btrfs_print_data_csum_error: 14608 callbacks suppressed > [633250.707459] BTRFS warning (device dm-18): csum failed root 5 ino 1376 off > 3

[PATCH v7 0/4] Add the ability to do BPF directed error injection

2017-11-22 Thread Josef Bacik
This is hopefully the final version, I've addressed the comment by Igno and added his Acks. v6->v7: - moved the opt-in macro to bpf.h out of kprobes.h. v5->v6: - add BPF_ALLOW_ERROR_INJECTION() tagging for functions that will support this feature. This way only functions that opt-in will be al

[PATCH v7 5/5] btrfs: allow us to inject errors at io_ctl_init

2017-11-22 Thread Josef Bacik
From: Josef Bacik This was instrumental in reproducing a space cache bug. Signed-off-by: Josef Bacik Acked-by: Ingo Molnar --- fs/btrfs/free-space-cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index cdc9f4015ec3..daa98d

[PATCH v7 4/5] samples/bpf: add a test for bpf_override_return

2017-11-22 Thread Josef Bacik
From: Josef Bacik This adds a basic test for bpf_override_return to verify it works. We override the main function for mounting a btrfs fs so it'll return -ENOMEM and then make sure that trying to mount a btrfs fs will fail. Acked-by: Alexei Starovoitov Acked-by: Ingo Molnar Signed-off-by: Jo

[PATCH v7 3/5] bpf: add a bpf_override_function helper

2017-11-22 Thread Josef Bacik
From: Josef Bacik Error injection is sloppy and very ad-hoc. BPF could fill this niche perfectly with it's kprobe functionality. We could make sure errors are only triggered in specific call chains that we care about with very specific situations. Accomplish this with the bpf_override_funciton

[PATCH v7 2/5] btrfs: make open_ctree error injectable

2017-11-22 Thread Josef Bacik
From: Josef Bacik This allows us to do error injection with BPF for open_ctree. Signed-off-by: Josef Bacik Acked-by: Ingo Molnar --- fs/btrfs/disk-io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index dfdab849037b..69d17a640b94 100644 --- a/f

[PATCH v7 1/5] add infrastructure for tagging functions as error injectable

2017-11-22 Thread Josef Bacik
From: Josef Bacik Using BPF we can override kprob'ed functions and return arbitrary values. Obviously this can be a bit unsafe, so make this feature opt-in for functions. Simply tag a function with KPROBE_ERROR_INJECT_SYMBOL in order to give BPF access to that function for error injection purpo

[PATCH v2 04/11] lib: add a __fprop_add_percpu_max

2017-11-22 Thread Josef Bacik
From: Josef Bacik This helper allows us to add an arbitrary amount to the fprop structures. Signed-off-by: Josef Bacik --- include/linux/flex_proportions.h | 11 +-- lib/flex_proportions.c | 9 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include

[PATCH v2 06/11] writeback: add counters for metadata usage

2017-11-22 Thread Josef Bacik
From: Josef Bacik Btrfs has no bounds except memory on the amount of dirty memory that we have in use for metadata. Historically we have used a special inode so we could take advantage of the balance_dirty_pages throttling that comes with using pagecache. However as we'd like to support differen

[PATCH v2 10/11] btrfs: rework end io for extent buffer reads

2017-11-22 Thread Josef Bacik
From: Josef Bacik Now that the only thing that keeps eb's alive is io_pages and it's refcount we need to hold the eb ref for the entire end io call so we don't get it removed out from underneath us. Also the hooks make no sense for us now, so rework this to be cleaner. Signed-off-by: Josef Baci

[PATCH v2 08/11] export radix_tree_iter_tag_set

2017-11-22 Thread Josef Bacik
From: Josef Bacik We use this in btrfs for metadata writeback. Acked-by: Matthew Wilcox Signed-off-by: Josef Bacik --- lib/radix-tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 8b1feca1230a..0c1cde9fcb69 100644 --- a/lib/radix-tree.c +++ b/

[PATCH v2 09/11] Btrfs: kill the btree_inode

2017-11-22 Thread Josef Bacik
From: Josef Bacik In order to more efficiently support sub-page blocksizes we need to stop allocating pages from pagecache for our metadata. Instead switch to using the account_metadata* counters for making sure we are keeping the system aware of how much dirty metadata we have, and use the ->fr

[PATCH v2 03/11] lib: make the fprop batch size a multiple of PAGE_SIZE

2017-11-22 Thread Josef Bacik
From: Josef Bacik We are converting the writeback counters to use bytes instead of pages, so we need to make the batch size for the percpu modifications align properly with the new units. Since we used pages before, just multiply by PAGE_SIZE to get the equivalent bytes for the batch size. Sign

[PATCH v2 01/11] remove mapping from balance_dirty_pages*()

2017-11-22 Thread Josef Bacik
From: Josef Bacik The only reason we pass in the mapping is to get the inode in order to see if writeback cgroups is enabled, and even then it only checks the bdi and a super block flag. balance_dirty_pages() doesn't even use the mapping. Since balance_dirty_pages*() works on a bdi level, just

[PATCH v2 00/11] Metadata specific accouting and dirty writeout

2017-11-22 Thread Josef Bacik
These patches are to support having metadata accounting and dirty handling in a generic way. For dirty metadata ext4 and xfs currently are limited by their journal size, which allows them to handle dirty metadata flushing in a relatively easy way. Btrfs does not have this limiting factor, we can

[PATCH v2 02/11] writeback: convert WB_WRITTEN/WB_DIRITED counters to bytes

2017-11-22 Thread Josef Bacik
From: Josef Bacik These are counters that constantly go up in order to do bandwidth calculations. It isn't important what the units are in, as long as they are consistent between the two of them, so convert them to count bytes written/dirtied, and allow the metadata accounting stuff to change the

[PATCH v2 05/11] writeback: convert the flexible prop stuff to bytes

2017-11-22 Thread Josef Bacik
From: Josef Bacik The flexible proportions were all page based, but now that we are doing metadata writeout that can be smaller or larger than page size we need to account for this in bytes instead of number of pages. Signed-off-by: Josef Bacik --- mm/page-writeback.c | 10 +- 1 file c

[PATCH v2 07/11] writeback: introduce super_operations->write_metadata

2017-11-22 Thread Josef Bacik
From: Josef Bacik Now that we have metadata counters in the VM, we need to provide a way to kick writeback on dirty metadata. Introduce super_operations->write_metadata. This allows file systems to deal with writing back any dirty metadata we need based on the writeback needs of the system. Si

[PATCH v2 11/11] btrfs: add NR_METADATA_BYTES accounting

2017-11-22 Thread Josef Bacik
From: Josef Bacik Now that we have these counters, account for the private pages we allocate in NR_METADATA_BYTES. Signed-off-by: Josef Bacik --- fs/btrfs/extent_io.c | 4 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index e11372455fb0..7536352

notification about corrupt files from "btrfs scrub" in cron

2017-11-22 Thread ST
Hello, I have following cron job to scrub entire root filesystem (total ca. 7.2TB and 2.3TB of them used) once a week: /bin/btrfs scrub start -r / > /dev/null Such scrubbing takes ca. 2 hours. How should I get notified that a corrupt file was discovered? Does this command return some error code b

Re: [PATCH] btrfs: switch uuid tree semaphore to mutex

2017-11-22 Thread David Sterba
On Mon, Nov 06, 2017 at 07:24:02PM +0100, David Sterba wrote: > The uuid_tree_rescan_sem is used as a mutex (initialized with value 1 > and with at most one active user), no reason to obscure that as a > semaphore. > > Signed-off-by: David Sterba [ 136.287143] [ cut here ]--

[josef-btrfs:kill-btree-inode 33/33] fs/btrfs/extent_io.c:4806:9: warning: overflow in implicit constant conversion

2017-11-22 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git kill-btree-inode head: 6dbc29989846e20ef73ae6b9abedad570706c019 commit: 6dbc29989846e20ef73ae6b9abedad570706c019 [33/33] btrfs: add NR_METADATA_BYTES accounting config: x86_64-randconfig-x000-201747 (attached as .confi

btrfs restore corrupt file

2017-11-22 Thread Jorge Bastos
Hello, While doing btrfs checksum testing I purposely corrupted a file and got the expect I/O error when trying to copy it, I also tested btrfs restore to see if I could recover a known corrupt file and it did copy it but there was no checksum error or warning. I used btrfs restore -v Is this exp

btrfs restore corrupt file

2017-11-22 Thread Jorge Bastos
Hello, While doing btrfs checksum testing I purposely corrupted a file and got the expect I/O error when trying to copy it, I also tested btrfs restore to see if I could recover a known corrupt file and it did copy it and there was no checksum error or warning, is this expect behavior or should re

Re: uncorrectable errors in Raid 10

2017-11-22 Thread Chris Murphy
On Wed, Nov 22, 2017 at 9:38 AM, Steffen Sindzinski wrote: > Hello, > > I did btrfs check --readonly on both disk without finding any error. To > reconfirm I did a scrub again which still has found 2 uncorrectable errors. Try --mode=lowmem option with btrfs-progs 4.3.3 or better 4.14. This is a n

Re: mail notifications to root once quota limit reached

2017-11-22 Thread Chris Murphy
On Wed, Nov 22, 2017 at 8:36 AM, ST wrote: > Hello, > > is it possible to get mail notifications to root once quota limit is > reached? If not should I file a feature request? You should look at Nagios or OpenNMS, etc. That's where such functionality belongs. -- Chris Murphy -- To unsubscribe f

mail notifications to root once quota limit reached

2017-11-22 Thread ST
Hello, is it possible to get mail notifications to root once quota limit is reached? If not should I file a feature request? Thank you! -- 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 at http://v

Re: [PATCH 3/7] Btrfs: retry write for non-raid56

2017-11-22 Thread Nikolay Borisov
On 22.11.2017 02:35, Liu Bo wrote: > If the underlying protocal doesn't support retry and there are some > transient errors happening somewhere in our IO stack, we'd like to > give an extra chance for IO. > > In btrfs, read retry is handled in bio_readpage_error() with the retry > unit being pag

Re: Kernel 4.14 RAID5 multi disk array on bcache not mounting

2017-11-22 Thread Holger Hoffstätte
On 11/21/17 23:22, Lionel Bouton wrote: > Le 21/11/2017 à 23:04, Andy Leadbetter a écrit : >> I have a 4 disk array on top of 120GB bcache setup, arranged as follows > [...] >> Upgraded today to 4.14.1 from their PPA and the > > 4.14 and 4.14.1 have a nasty bug affecting bcache users. See for exam

Re: [PATCH 06/10] writeback: add counters for metadata usage

2017-11-22 Thread Jan Kara
On Tue 14-11-17 16:56:52, Josef Bacik wrote: > From: Josef Bacik > > Btrfs has no bounds except memory on the amount of dirty memory that we have > in > use for metadata. Historically we have used a special inode so we could take > advantage of the balance_dirty_pages throttling that comes with

Re: [PATCH] btrfs: handle errors while updating refcounts in update_ref_for_cow

2017-11-22 Thread Qu Wenruo
On 2017年11月22日 02:58, je...@suse.com wrote: > From: Jeff Mahoney > > Since commit fb235dc06fa (btrfs: qgroup: Move half of the qgroup > accounting time out of commit trans) the assumption that > btrfs_add_delayed_{data,tree}_ref can only return 0 or -ENOMEM has > been false. The qgroup operati

[PATCH 11/11] btrfs-progs: fsck-tests: Introduce test case with keyed data backref with shared tree blocks

2017-11-22 Thread Qu Wenruo
For snapshot shared tree blocks with source subvolume, the keyed backref counter only counts the exclusive owned references. In the following case, 258 is a snapshot of 257, which inherits all the reference to this data extent. -- item 4 key (12582912 EXTENT_ITEM 524288) itemoff 3741 i

[PATCH 04/11] btrfs-progs: lowmem check: Fix false backref lost warning for keyed extent data ref

2017-11-22 Thread Qu Wenruo
For keyed extent ref, its offset is calculated offset (file offset - file extent offset), just like inlined extent data ref. However the code is using file offset to hash extent data ref offset, causing false backref lost warning like: -- ERROR: data extent[16913485824 7577600] backref lost --

[PATCH 03/11] btrfs-progs: lowmem check: Fix inlined data extent ref lookup

2017-11-22 Thread Qu Wenruo
When lowmem fsck tries to find backref of a specified file extent, it searches inlined data ref first. However, extent data ref contains both owner root objectid, inode number and calculated offset (file offset - extent offset). The code only checks owner root objectid, not checking inode number

[PATCH 00/11] Lowmem mode btrfs fixes exposed by complex tree

2017-11-22 Thread Qu Wenruo
The patchset can be fetched from github: https://github.com/adam900710/btrfs-progs/tree/lowmem_fix The patchset is mostly rebased to v4.14, since there is some conflicts with lowmem repair enhancement from Su Yue. However the lowmem repair enhancement from Su Yue caused one regression, and the or

[PATCH 01/11] btrfs-progs: lowmem check: Fix regression which screws up extent allocator

2017-11-22 Thread Qu Wenruo
[BUG] Commit 723427d7e6b7 ("btrfs-progs: check: change the way lowmem mode traverses metadata") introduces a regression which could make some fsck self test case to fail. For fsck test case 004-no-dir-item, btrfs check --mode=lowmem --repair can cause BUG_ON() with ret = -17 (-EEXIST) when committ

[PATCH 02/11] btrfs-progs: lowmem check: Fix NULL pointer access caused by large tree reloc tree

2017-11-22 Thread Qu Wenruo
[BUG] v4.14 btrfs-progs can't pass new self test image with large tree reloc trees. It will fail with later "shared_block_ref_only.raw.xz" test image with NULL pointer access. [CAUSE] For image with higher (level >= 2) tree reloc tree, for function need_check() its ulist will be empty as tree relo

[PATCH 06/11] btrfs-progs: backref: Allow backref walk to handle direct parent ref

2017-11-22 Thread Qu Wenruo
[BUG] Btrfs lowmem mode fails with the following ASSERT() on certain valid image. -- backref.c:466: __add_missing_keys: Assertion `ref->root_id` failed, value 0 -- [REASON] Lowmem mode uses btrfs_find_all_roots() when walking down fs trees. However if a tree block with only shared parent

[PATCH 07/11] btrfs-progs: lowmem check: Fix function call stack overflow caused by wrong tree reloc tree detection

2017-11-22 Thread Qu Wenruo
For tree reloc tree root, its backref points to it self. So for such case, we should finish the lookup. Previous end condition is to ensure it's tree reloc tree *and* needs its root bytenr to match the bytenr passed in. However the @root passed in can be other tree, e.g. other tree reloc tree whi

[PATCH 08/11] btrfs-progs: lowmem check: Fix false alerts for image with shared block ref only backref

2017-11-22 Thread Qu Wenruo
[BUG] For image with shared block ref only metadata item like: -- item 66 key (21573632 METADATA_ITEM 0) itemoff 3971 itemsize 24 refs 66 gen 9 flags TREE_BLOCK|FULL_BACKREF tree block skinny level 0 item 0 key (21573632 SHARED_BLOCK_REF 21676032)

[PATCH 05/11] btrfs-progs: fsck-test: Introduce test case for false data extent backref lost

2017-11-22 Thread Qu Wenruo
Introduce a new test image, which has an extent item with no inlined extent data ref, but all keyed extent data ref. Only in this case we can trigger fase data extent backref lost bug in lowmem mode. Signed-off-by: Qu Wenruo --- .../020-extent-ref-cases/keyed_data_ref_only.img | Bin 0 -

[PATCH 10/11] btrfs-progs: lowmem check: Fix false alerts of referencer count mismatch for snapshot

2017-11-22 Thread Qu Wenruo
Btrfs lowmem check reports such false alerts: -- ERROR: extent[366498091008, 134217728] referencer count mismatch (root: 827, owner: 73782, offset: 134217728) wanted: 4, have: 26 ERROR: extent[366498091008, 134217728] referencer count mismatch (root: 818, owner: 73782, offset: 134217728) want

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-22 Thread Qu Wenruo
On 2017年11月22日 16:32, ST wrote: > > > > On Wed, 2017-11-22 at 08:39 +0800, Qu Wenruo wrote: >> >> On 2017年11月22日 05:00, ST wrote: >>> On Tue, 2017-11-21 at 11:33 -0700, Chris Murphy wrote: On Tue, Nov 21, 2017 at 8:29 AM, ST wrote: > I'm trying to use quotas for a simple chrooted

Re: [PATCH 03/10] lib: add a batch size to fprop_global

2017-11-22 Thread Jan Kara
On Wed 22-11-17 09:47:16, Jan Kara wrote: > On Tue 14-11-17 16:56:49, Josef Bacik wrote: > > From: Josef Bacik > > > > The flexible proportion stuff has been used to track how many pages we > > are writing out over a period of time, so counts everything in single > > increments. If we wanted to

Re: [PATCH 03/10] lib: add a batch size to fprop_global

2017-11-22 Thread Jan Kara
On Tue 14-11-17 16:56:49, Josef Bacik wrote: > From: Josef Bacik > > The flexible proportion stuff has been used to track how many pages we > are writing out over a period of time, so counts everything in single > increments. If we wanted to use another base value we need to be able > to adjust

Re: [PATCH 2/6] btrfs-progs: check: change traversal way of lowmem mode

2017-11-22 Thread Su Yue
On 11/22/2017 04:15 PM, Qu Wenruo wrote: Well, David changed the title so it takes me some time to locate the patch. Although it's too late to point out problems in this patch after being merged. But I still think it's worth mention some problems in this patch, especially considering how it's

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-22 Thread ST
On Wed, 2017-11-22 at 08:39 +0800, Qu Wenruo wrote: > > On 2017年11月22日 05:00, ST wrote: > > On Tue, 2017-11-21 at 11:33 -0700, Chris Murphy wrote: > >> On Tue, Nov 21, 2017 at 8:29 AM, ST wrote: > >>> I'm trying to use quotas for a simple chrooted sftp setup, limiting > >>> space for e

Re: [PATCH 2/6] btrfs-progs: check: change traversal way of lowmem mode

2017-11-22 Thread Qu Wenruo
Well, David changed the title so it takes me some time to locate the patch. Although it's too late to point out problems in this patch after being merged. But I still think it's worth mention some problems in this patch, especially considering how it's causing problems. On 2017年08月23日 10:33, Lu F