Re: btrfs send -p failing: chown o257-1571-0 failed: No such file or directory

2020-12-17 Thread Massimo B.
On Mon, 2020-12-14 at 09:46 +, Filipe Manana wrote: > clone mb/Documents.AZ/0.SYNC/pdf - source=mb/Documents.AZ/0.SYNC/pdf > > source offset=20705280 offset=20709376 length=4096 > > clone mb/Documents.AZ/0.SYNC/pdf - source=mb/Documents.AZ/0.SYNC/pdf > > source offset=20713472

Re: Antw: [EXT] Re: Unrecoverable filesystem (ERROR: child eb corrupted: parent bytenr=1106952192 item=75 parent level=1 child level=1)

2020-12-17 Thread Ulrich Windl
>>> Zygo Blaxell schrieb am 18.12.2020 um 02:51 in Nachricht <20201218015114.ge28...@hungrycats.org>: > On Thu, Dec 17, 2020 at 02:48:00PM +0100, Ulrich Windl wrote: >> >>> Zygo Blaxell schrieb am 15.12.2020 um >> 19:18 in >> Nachricht <20201215181828.gn31...@hungrycats.org>: >> > On Fri, Dec 11,

[PATCH 1/2] btrfs: make btrfs_dio_private::bytes to be u32

2020-12-17 Thread Qu Wenruo
btrfs_dio_private::bytes is only assigned from bio::bi_iter::bi_size, which is no larger than U32. Signed-off-by: Qu Wenruo --- fs/btrfs/btrfs_inode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index d9bf53d9ff90..fbd65807f

[PATCH 2/2] btrfs: refactor btrfs_dec_test_* functions for ordered extents

2020-12-17 Thread Qu Wenruo
The refactors involves the following modifications: - Return bool instead of int - Reduce the width of @io_size for btrfs_dec_test_ordered_pending() Function btrfs_dec_test_ordered_pending() is only supposed to handle at most one page, thus u32 for @io_size is enough. Also added ASSERT()s fo

[PATCH 0/2] btrfs: btrfs_dec_test_*_ordered_extent() refactor

2020-12-17 Thread Qu Wenruo
This small patchset is btrfs_dec_test_*_ordered_extent() refactor during subpage RW support development. This is mostly to make btrfs_dev_test_* functions more human readable and prepare it for calling btrfs_dec_test_first_ordered_extent() in btrfs_writepage_endio_finish_ordered() where we can hav

Re: Antw: [EXT] Re: Unrecoverable filesystem (ERROR: child eb corrupted: parent bytenr=1106952192 item=75 parent level=1 child level=1)

2020-12-17 Thread Zygo Blaxell
On Thu, Dec 17, 2020 at 02:48:00PM +0100, Ulrich Windl wrote: > >>> Zygo Blaxell schrieb am 15.12.2020 um > 19:18 in > Nachricht <20201215181828.gn31...@hungrycats.org>: > > On Fri, Dec 11, 2020 at 03:25:47PM +0100, Ulrich Windl wrote: > >> Hi! > >> > >> While configuring a VM environment in a cl

Re: [PATCH v2 07/18] btrfs: extent_io: make grab_extent_buffer_from_page() to handle subpage case

2020-12-17 Thread Qu Wenruo
On 2020/12/18 上午12:02, Josef Bacik wrote: On 12/10/20 1:38 AM, Qu Wenruo wrote: For subpage case, grab_extent_buffer_from_page() can't really get an extent buffer just from btrfs_subpage. Although we have btrfs_subpage::tree_block_bitmap, which can be used to grab the bytenr of an existing e

Re: [PATCH v2 06/18] btrfs: extent_io: make attach_extent_buffer_page() to handle subpage case

2020-12-17 Thread Qu Wenruo
On 2020/12/18 上午12:00, Josef Bacik wrote: On 12/10/20 1:38 AM, Qu Wenruo wrote: For subpage case, we need to allocate new memory for each metadata page. So we need to: - Allow attach_extent_buffer_page() to return int    To indicate allocation failure - Prealloc page->private for alloc_exten

Re: [PATCH RFC 4/4] btrfs: inode: make btrfs_invalidatepage() to be subpage compatible

2020-12-17 Thread Qu Wenruo
On 2020/12/17 下午10:51, Josef Bacik wrote: On 12/16/20 11:57 PM, Qu Wenruo wrote: [BUG] With current subpage RW patchset, the following script can lead to filesystem hang:    # mkfs.btrfs -f -s 4k $dev    # mount $dev -o nospace_cache $mnt    # fsstress -w -n 100 -p 1 -s 1608140256 -v -d $mnt

Re: [PATCH 1/5] btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan

2020-12-17 Thread Filipe Manana
On Thu, Dec 17, 2020 at 5:45 PM David Sterba wrote: > > On Mon, Dec 14, 2020 at 10:10:45AM +, fdman...@kernel.org wrote: > > +static bool rescan_should_stop(struct btrfs_fs_info *fs_info) > > +{ > > + return btrfs_fs_closing(fs_info) || > > + test_bit(BTRFS_FS_STATE_REMOUNTING,

Re: [PATCH 0/5] btrfs: fix transaction leaks and crashes during unmount

2020-12-17 Thread David Sterba
On Mon, Dec 14, 2020 at 10:10:44AM +, fdman...@kernel.org wrote: > From: Filipe Manana > > There are some cases where we can leak a transaction and crash during unmount > after remounting the filesystem in RO mode or mounting RO. These issues were > actually being hit by automated tests from

Re: [PATCH 1/5] btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan

2020-12-17 Thread David Sterba
On Mon, Dec 14, 2020 at 10:10:45AM +, fdman...@kernel.org wrote: > +static bool rescan_should_stop(struct btrfs_fs_info *fs_info) > +{ > + return btrfs_fs_closing(fs_info) || > + test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); > +} > + > static void btrfs_qgroup_rescan

Re: [PATCH v2 2/2] btrfs: account for new extents being deleted in total_bytes_pinned

2020-12-17 Thread David Sterba
On Wed, Dec 16, 2020 at 11:46:54AM -0500, Josef Bacik wrote: > My recent set of patches to reduce lock contention on the extent root by > running delayed refs resulted in a regression in generic/371. As you write that often in patches, I want to point out that references to 'my recent patches doin

Re: [PATCH] btrfs: test incremental send after removing a directory and all its files

2020-12-17 Thread Josef Bacik
On 12/10/20 7:09 AM, fdman...@kernel.org wrote: From: Filipe Manana Test that an incremental send operation succeeds, and produces the correct results, after removing a directory and all its files, unmounting the filesystem, mounting the filesystem again and creating a new file (or directory).

Re: [PATCH 0/5] btrfs: fix transaction leaks and crashes during unmount

2020-12-17 Thread Josef Bacik
On 12/14/20 5:10 AM, fdman...@kernel.org wrote: From: Filipe Manana There are some cases where we can leak a transaction and crash during unmount after remounting the filesystem in RO mode or mounting RO. These issues were actually being hit by automated tests from the openQA for openSUSE Tumbl

Re: [PATCH 0/2] btrfs: fix races between clone, fallocate and memory mapped writes

2020-12-17 Thread David Sterba
On Thu, Dec 17, 2020 at 03:11:46PM +, Filipe Manana wrote: > On Thu, Dec 17, 2020 at 3:03 PM David Sterba wrote: > > > > On Mon, Dec 14, 2020 at 09:56:40AM +, fdman...@kernel.org wrote: > > > From: Filipe Manana > > > > > > For a very long time there's been a race between clone/dedupe and

Re: [PATCH v2 07/18] btrfs: extent_io: make grab_extent_buffer_from_page() to handle subpage case

2020-12-17 Thread Josef Bacik
On 12/10/20 1:38 AM, Qu Wenruo wrote: For subpage case, grab_extent_buffer_from_page() can't really get an extent buffer just from btrfs_subpage. Although we have btrfs_subpage::tree_block_bitmap, which can be used to grab the bytenr of an existing extent buffer, and can then go radix tree searc

Re: [PATCH v2 06/18] btrfs: extent_io: make attach_extent_buffer_page() to handle subpage case

2020-12-17 Thread Josef Bacik
On 12/10/20 1:38 AM, Qu Wenruo wrote: For subpage case, we need to allocate new memory for each metadata page. So we need to: - Allow attach_extent_buffer_page() to return int To indicate allocation failure - Prealloc page->private for alloc_extent_buffer() We don't want to call memory al

Re: [PATCH v2 05/18] btrfs: extent_io: introduce the skeleton of btrfs_subpage structure

2020-12-17 Thread Josef Bacik
On 12/10/20 1:38 AM, Qu Wenruo wrote: For btrfs subpage support, we need a structure to record extra info for the status of each sectors of a page. This patch will introduce the skeleton structure for future btrfs subpage support. All subpage related code would go to subpage.[ch] to avoid popula

Re: [PATCH v2 04/18] btrfs: extent_io: introduce a helper to grab an existing extent buffer from a page

2020-12-17 Thread Josef Bacik
On 12/10/20 1:38 AM, Qu Wenruo wrote: This patch will extract the code to grab an extent buffer from a page into a helper, grab_extent_buffer_from_page(). This reduces one indent level, and provides the work place for later expansion for subapge support. Reviewed-by: Johannes Thumshirn Signed-

Re: [PATCH v2 01/18] btrfs: extent_io: rename @offset parameter to @disk_bytenr for submit_extent_page()

2020-12-17 Thread Josef Bacik
On 12/10/20 1:38 AM, Qu Wenruo wrote: The parameter @offset can't be more confusing. In fact that parameter is the disk bytenr for metadata/data. Rename it to @disk_bytenr and update the comment to reduce confusion. Since we're here, also rename all @offset passed into submit_extent_page() to @

Re: [PATCH v2 02/18] btrfs: extent_io: refactor __extent_writepage_io() to improve readability

2020-12-17 Thread Josef Bacik
On 12/10/20 1:38 AM, Qu Wenruo wrote: The refactor involves the following modifications: - iosize alignment In fact we don't really need to manually do alignment at all. All extent maps should already be aligned, thus basic ASSERT() check would be enough. - redundant variables We hav

Re: [PATCH 0/2] btrfs: fix races between clone, fallocate and memory mapped writes

2020-12-17 Thread Filipe Manana
On Thu, Dec 17, 2020 at 3:03 PM David Sterba wrote: > > On Mon, Dec 14, 2020 at 09:56:40AM +, fdman...@kernel.org wrote: > > From: Filipe Manana > > > > For a very long time there's been a race between clone/dedupe and memory > > mapped writes as well as between fallocate and memory mapped wr

Re: [PATCH 0/2] btrfs: fix races between clone, fallocate and memory mapped writes

2020-12-17 Thread David Sterba
On Mon, Dec 14, 2020 at 09:56:40AM +, fdman...@kernel.org wrote: > From: Filipe Manana > > For a very long time there's been a race between clone/dedupe and memory > mapped writes as well as between fallocate and memory mapped writes. For > both cases the consequence of the race is that it ca

Re: [PATCH RFC 4/4] btrfs: inode: make btrfs_invalidatepage() to be subpage compatible

2020-12-17 Thread Josef Bacik
On 12/16/20 11:57 PM, Qu Wenruo wrote: [BUG] With current subpage RW patchset, the following script can lead to filesystem hang: # mkfs.btrfs -f -s 4k $dev # mount $dev -o nospace_cache $mnt # fsstress -w -n 100 -p 1 -s 1608140256 -v -d $mnt The file system will hang at wait_event() of

Re: [PATCH] btrfs: Consolidate btrfs_previous_item ret val handling in btrfs_shrink_device

2020-12-17 Thread Josef Bacik
On 12/17/20 8:21 AM, Nikolay Borisov wrote: Instead of having 3 'if' to handle non-null return value consolidate this in 1 'if (ret)'. That way the code is more obvious: - Always drop dlete_unused_bgs_mutex if ret is non null - If ret is negative -> goto done - If it's 1 -> reset ret to 0,

Re: [PATCH] btrfs: initialize test inodes location

2020-12-17 Thread David Sterba
On Thu, Dec 17, 2020 at 09:39:18AM -0500, Josef Bacik wrote: > On 12/17/20 7:41 AM, David Sterba wrote: > > On Tue, Dec 15, 2020 at 12:00:26PM -0500, Josef Bacik wrote: > >> While testing other things I was noticing that sometimes my VM would > >> fail to load the btrfs module because the self test

Re: [PATCH] btrfs: initialize test inodes location

2020-12-17 Thread Josef Bacik
On 12/17/20 7:41 AM, David Sterba wrote: On Tue, Dec 15, 2020 at 12:00:26PM -0500, Josef Bacik wrote: While testing other things I was noticing that sometimes my VM would fail to load the btrfs module because the self test failed like this BTRFS: selftest: fs/btrfs/tests/inode-tests.c:963 misco

[PATCH v4 5/6] btrfs: stop running all delayed refs during snapshot

2020-12-17 Thread Josef Bacik
This was added a very long time ago to work around issues with delayed refs and with qgroups. Both of these issues have since been properly fixed, so all this does is cause a lot of lock contention with anybody else who is running delayed refs. Signed-off-by: Josef Bacik --- fs/btrfs/transactio

[PATCH v4 6/6] btrfs: run delayed refs less often in commit_cowonly_roots

2020-12-17 Thread Josef Bacik
We love running delayed refs in commit_cowonly_roots, but it is a bit excessive. I was seeing cases of running 3 or 4 refs a few times in a row during this time. Instead simply update all of the roots first, then run delayed refs, then handle the empty block groups case, and then if we have any m

[PATCH v4 3/6] btrfs: delayed refs pre-flushing should only run the heads we have

2020-12-17 Thread Josef Bacik
Previously our delayed ref running used the total number of items as the items to run. However we changed that to number of heads to run with the delayed_refs_rsv, as generally we want to run all of the operations for one bytenr. But with btrfs_run_delayed_refs(trans, 0) we set our count to 2x th

[PATCH v4 2/6] btrfs: only let one thread pre-flush delayed refs in commit

2020-12-17 Thread Josef Bacik
I've been running a stress test that runs 20 workers in their own subvolume, which are running an fsstress instance with 4 threads per worker, which is 80 total fsstress threads. In addition to this I'm running balance in the background as well as creating and deleting snapshots. This test takes

[PATCH v4 4/6] btrfs: only run delayed refs once before committing

2020-12-17 Thread Josef Bacik
We try to pre-flush the delayed refs when committing, because we want to do as little work as possible in the critical section of the transaction commit. However doing this twice can lead to very long transaction commit delays as other threads are allowed to continue to generate more delayed refs,

[PATCH v4 1/6] btrfs: do not block on deleted bgs mutex in the cleaner

2020-12-17 Thread Josef Bacik
While running some stress tests I started getting hung task messages. This is because the delete unused bg's code has to take the delete_unused_bgs_mutex to do it's work, which is taken by balance to make sure we don't delete block groups while we're balancing. The problem is a balance can take a

[PATCH v4 0/6] A variety of lock contention fixes

2020-12-17 Thread Josef Bacik
v3->v4: - I accidentally sent out the v1 version of these patches, because I had fixed them on another machine. This is the proper set with the changes from v2 that are properly rebased onto misc-next. v2->v3: - Added Nikolay's reviewed by for the second patch. - Rebased onto the latest misc-

[bug report] btrfs: do an allocation earlier during snapshot creation

2020-12-17 Thread Dan Carpenter
[ Sorry David, the complain script uses git blame and it just picked you. And then I decided to keep the address because your email is still active and you seem like an expert. -dan ] Hello David Sterba, The patch a1ee73626844: "btrfs: do an allocation earlier during snapshot creation" from

Re: how to extend a btrfs disk image?

2020-12-17 Thread Roman Mamedov
On Thu, 17 Dec 2020 13:30:08 +0100 Ulli Horlacher wrote: > root@fextest:/nfs/rusnas/fex# mount disk1.btrfs /mnt/tmp > root@fextest:/nfs/rusnas/fex# df -TH /mnt/tmp > Filesystem Type Size Used Avail Use% Mounted on > /dev/loop2 btrfs 16T 3.7M 16T 1% /mnt/tmp You see here 'mount'

Antw: [EXT] Re: Unrecoverable filesystem (ERROR: child eb corrupted: parent bytenr=1106952192 item=75 parent level=1 child level=1)

2020-12-17 Thread Ulrich Windl
>>> Zygo Blaxell schrieb am 15.12.2020 um 19:18 in Nachricht <20201215181828.gn31...@hungrycats.org>: > On Fri, Dec 11, 2020 at 03:25:47PM +0100, Ulrich Windl wrote: >> Hi! >> >> While configuring a VM environment in a cluster I had setup an SLES15 SP2 > test VM using BtrFS. Due to some problem

[PATCH] btrfs: Consolidate btrfs_previous_item ret val handling in btrfs_shrink_device

2020-12-17 Thread Nikolay Borisov
Instead of having 3 'if' to handle non-null return value consolidate this in 1 'if (ret)'. That way the code is more obvious: - Always drop dlete_unused_bgs_mutex if ret is non null - If ret is negative -> goto done - If it's 1 -> reset ret to 0, release the path and finish the loop. Signed-of

Re: [PATCH 0/5] Fixes and tweaks around error handling

2020-12-17 Thread Nikolay Borisov
On 16.12.20 г. 18:18 ч., Josef Bacik wrote: > Hello, > > These patches were originally in my reloc error handling patches that have > been > broken out on their own. They stand on their own and are simple and don't > affect the code in a real way. Simply fixing some cosmetic stuff, or allowi

Re: [PATCH v2 2/2] btrfs: account for new extents being deleted in total_bytes_pinned

2020-12-17 Thread Nikolay Borisov
On 16.12.20 г. 18:46 ч., Josef Bacik wrote: > My recent set of patches to reduce lock contention on the extent root by > running delayed refs resulted in a regression in generic/371. This test > fallocate()'s the fs until it's full, deletes all the files, and then > tries to fallocate() until f

Re: [PATCH] btrfs: initialize test inodes location

2020-12-17 Thread David Sterba
On Tue, Dec 15, 2020 at 12:00:26PM -0500, Josef Bacik wrote: > While testing other things I was noticing that sometimes my VM would > fail to load the btrfs module because the self test failed like this > > BTRFS: selftest: fs/btrfs/tests/inode-tests.c:963 miscount, wanted 1, got 0 > > This turne

how to extend a btrfs disk image?

2020-12-17 Thread Ulli Horlacher
How can I add a second disk-image to an existing btrfs filesystem? I have to use btrfs via a disk image on a nfs Netapp storage system with a 16 TB file size limit. One cannot use bigger files. I have set up sucessfully: root@fextest:/nfs/rusnas/fex# touch disk1.btrfs root@fextest:/nfs/rusnas/

Re: [PATCH 2/4] btrfs: inode: remove variable shadowing in btrfs_invalidatepage()

2020-12-17 Thread David Sterba
On Thu, Dec 17, 2020 at 02:13:37PM +0800, Qu Wenruo wrote: > > > On 2020/12/17 下午1:59, Nikolay Borisov wrote: > > > > > > On 17.12.20 г. 7:55 ч., Nikolay Borisov wrote: > >> > >> > >> On 17.12.20 г. 6:57 ч., Qu Wenruo wrote: > >>> In btrfs_invalidatepage() we re-declare @tree variable as > >>>

Re: [PATCH v2] btrfs: test if rename handles dir item collision correctly

2020-12-17 Thread Filipe Manana
On Tue, Dec 15, 2020 at 4:16 AM ethanwu wrote: > > This is a regression test for the issue fixed by the kernel commit titled > "btrfs: correctly calculate item size used when item key collision happens" > > In this case, we'll simply rename many forged filename that cause collision > under a direc

Re: [PATCH RFC 4/4] btrfs: inode: make btrfs_invalidatepage() to be subpage compatible

2020-12-17 Thread Filipe Manana
On Thu, Dec 17, 2020 at 5:03 AM Qu Wenruo wrote: > > [BUG] > With current subpage RW patchset, the following script can lead to > filesystem hang: > # mkfs.btrfs -f -s 4k $dev > # mount $dev -o nospace_cache $mnt > # fsstress -w -n 100 -p 1 -s 1608140256 -v -d $mnt > > The file system will h