[PATCH] Btrfs: pass delayed_refs directly to btrfs_find_delayed_ref_head

2017-01-30 Thread Liu Bo
All we need is @delayed_refs, all callers have get it ahead of calling btrfs_find_delayed_ref_head since lock needs to be acquired firstly, there is no reason to deference it again inside the function. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/backref.c | 2 +- fs

[PATCH] Btrfs: remove unused trans in read_block_for_search

2017-01-30 Thread Liu Bo
@trans is not used at all, this removes it. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ctree.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index a426dc8..dd8014a 100644 --- a/fs/btrfs/ctree.c ++

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2017-01-30 Thread Liu Bo
.) I think its caller, "__extent_writepage", has covered the above case by setting page writeback again. Thanks, -liubo > > Sincerely, > > On 2016/12/22 15:20, Liu Bo wrote: > > On Fri, Dec 16, 2016 at 03:41:50PM +0900, Takafumi Kubota wrote: &g

[PATCH] Btrfs: cleanup unused cached_state in __extent_writepage_io

2017-01-25 Thread Liu Bo
@cached_state is no more required in __extent_writepage_io, also remove the goto label. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent_io.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 4

Re: [PATCH] fstests: generic: splitted large dio write could trigger assertion on btrfs

2017-01-25 Thread Liu Bo
On Mon, Jan 16, 2017 at 12:30:59PM +0800, Eryu Guan wrote: > On Thu, Jan 12, 2017 at 02:22:06PM -0800, Liu Bo wrote: > > On btrfs, if a large dio write (>=128MB) got splitted, the > > outstanding_extents > > assertion would complain. Note that CONFIG_BTRFS_ASSERT is requi

[PATCH v2] fstests: generic: splitted large dio write could trigger assertion on btrfs

2017-01-25 Thread Liu Bo
On btrfs, if a large dio write (>=128MB) got splitted, the outstanding_extents assertion would complain. Note that CONFIG_BTRFS_ASSERT is required. Regression test for Btrfs: adjust outstanding_extents counter properly when dio write is split Signed-off-by: Liu Bo <bo.li@orac

Re: Hard crash on 4.9.5

2017-01-25 Thread Liu Bo
On Mon, Jan 23, 2017 at 03:03:55PM -0500, Matt McKinnon wrote: > Wondering what to do about this error which says 'reboot needed'. Has > happened a three times in the past week: > Well, I don't think btrfs's logic here is wrong, the following stack shows that a nfs client has sent a second

Re: Hard crash on 4.9.5

2017-01-25 Thread Liu Bo
On Mon, Jan 23, 2017 at 09:27:22PM +0100, Hans van Kranenburg wrote: > On 01/23/2017 09:03 PM, Matt McKinnon wrote: > > Wondering what to do about this error which says 'reboot needed'. Has > > happened a three times in the past week: > > > > Jan 23 14:16:17 my_machine kernel: [ 2568.595648]

Re: NULL pointer dereference in btrfs_async_reclaim_metadata_space

2017-01-25 Thread Liu Bo
On Wed, Jan 25, 2017 at 10:31:32AM +0100, Marc Kleine-Budde wrote: > Hello, > > I'm using debian's latest 4.9 Kernel on a 32bit armhf SMP board. The > filesystem is in raid1 mode using two harddrives. After the system > crashed (for yet unknown reason) the mounting of the raid1 failed > with the

Re: [PATCH] Btrfs: fix wrong argument for btrfs_lookup_ordered_range

2017-01-25 Thread Liu Bo
On Wed, Jan 25, 2017 at 01:49:09PM +0530, Chandan Rajendra wrote: > On Tuesday, January 24, 2017 03:58:51 PM Liu Bo wrote: > > Commit "d0b7da88 Btrfs: btrfs_page_mkwrite: Reserve space in sectorsized > > units" > > did this, but btrfs_lookup_ordered_range

[PATCH] Btrfs: fix wrong argument for btrfs_lookup_ordered_range

2017-01-24 Thread Liu Bo
Commit "d0b7da88 Btrfs: btrfs_page_mkwrite: Reserve space in sectorsized units" did this, but btrfs_lookup_ordered_range expects a 'length' rather than a 'page_end'. Signed-off-by: Liu Bo <bo.li@oracle.com> --- Is this a candidate for stable? fs/btrfs/inode.c | 2 +- 1

Re: [PATCH] Btrfs: adjust outstanding_extents counter properly when dio write is split

2017-01-12 Thread Liu Bo
On Fri, Jan 06, 2017 at 11:28:06AM +, Filipe Manana wrote: > On Fri, Dec 23, 2016 at 1:13 AM, Liu Bo <bo.li@oracle.com> wrote: > > Currently how btrfs dio deals with split dio write is not good > > enough if dio write is split into several segments due to the > &g

[PATCH] fstests: generic: splitted large dio write could trigger assertion on btrfs

2017-01-12 Thread Liu Bo
On btrfs, if a large dio write (>=128MB) got splitted, the outstanding_extents assertion would complain. Note that CONFIG_BTRFS_ASSERT is required. Regression test for Btrfs: adjust outstanding_extents counter properly when dio write is split Signed-off-by: Liu Bo <bo.li@oracle.com&

Re: master - btrfs lockdep splat

2017-01-12 Thread Liu Bo
On Thu, Jan 12, 2017 at 07:12:12PM +0100, Mike Galbraith wrote: > Greetings, > > I wanted to do some -rt testing, but seems non-rt kernels aren't > lockdep clean with btrfs /, making -rt testing a bit premature. > > (hm, 28a235931 Btrfs: fix lockdep warning on deadlock against an inode's log >

[PATCH v2] Btrfs: clean up btrfs_ordered_update_i_size

2017-01-12 Thread Liu Bo
Since we have a good helper entry_end, use it for ordered extent. Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: Remove 'ASSERT' that is not true anymore after patch "Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly" fs/btrfs/ord

[PATCH v2] Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly

2017-01-12 Thread Liu Bo
size. Besides fixing the above issue, add an assertion for last_size to double check we truncate down to the desired size. Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: add comments to clarify why we should update disk_i_size in the truncate case. fs/btrfs/inode.c

Re: [GIT PULL] btrfs fixes and cleanups

2017-01-12 Thread Liu Bo
Hi, On Wed, Dec 28, 2016 at 05:30:59PM +0800, Qu Wenruo wrote: > Hi Liu, > > At 12/15/2016 03:13 PM, Liu Bo wrote: > > Hi David, > > > > This is the collection of my patches targetting 4.10, I've > > dropped patch "Btrfs: adjust len of writes if follow

Re: [PATCH 1/3] btrfs: improve inode's outstanding_extents computation

2017-01-03 Thread Liu Bo
(Resend this reply due to a message that there is an invalid email address.) On Tue, Jan 03, 2017 at 01:00:45PM -0800, Liu Bo wrote: > On Fri, Nov 11, 2016 at 04:39:45PM +0800, Wang Xiaoguang wrote: > > This issue was revealed by modifying BTRFS_MAX_EXTENT_SIZE(128MB) to 64KB, > >

Re: [PATCH 1/3] btrfs: improve inode's outstanding_extents computation

2017-01-03 Thread Liu Bo
On Fri, Nov 11, 2016 at 04:39:45PM +0800, Wang Xiaoguang wrote: > This issue was revealed by modifying BTRFS_MAX_EXTENT_SIZE(128MB) to 64KB, > When modifying BTRFS_MAX_EXTENT_SIZE(128MB) to 64KB, fsstress test often > gets these warnings from btrfs_destroy_inode(): >

Re: [PATCH] Btrfs: Fix deadlock between direct IO and fast fsync

2016-12-23 Thread Liu Bo
On Fri, Dec 23, 2016 at 05:27:55PM +0530, Chandan Rajendra wrote: > On Friday, December 23, 2016 03:57:40 PM Chandan Rajendra wrote: > > On Friday, December 23, 2016 03:00:18 PM Chandan Rajendra wrote: > > > The following deadlock is seen when executing generic/113 test, > > > > > > > > >

[PATCH] Btrfs: adjust outstanding_extents counter properly when dio write is split

2016-12-22 Thread Liu Bo
. This fixes the problem by compensating the outstanding_extents counter in inode if a large dio write gets split. Reported-by: Anand Jain <anand.j...@oracle.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 11 +-- 1 file changed, 9 insertions(+),

Re: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure

2016-12-21 Thread Liu Bo
On Fri, Dec 16, 2016 at 03:41:50PM +0900, Takafumi Kubota wrote: > This is actually inspired by Filipe's patch(55e3bd2e0c2e1). > > When submit_extent_page() in __extent_writepage_io() fails, > Btrfs misses clearing a writeback bit of the failed page. > This causes the false under-writeback page.

Re: [PATCH 1/2 v2] btrfs: fix error handling when run_delayed_extent_op fails

2016-12-21 Thread Liu Bo
spin_lock(_refs->lock); > locked_ref->processing = 0; > + delayed_refs->num_heads_ready++; > + spin_unlock(_refs->lock); Looks good to m

Re: [PATCH 2/2] btrfs: fix locking when we put back a delayed ref that's too new

2016-12-21 Thread Liu Bo
s->lock); > locked_ref->processing = 0; > delayed_refs->num_heads_ready++; > spin_unlock(_refs->lock); > + btrfs_delayed_ref_unlock(locked_ref); I don't think that this would end up a deadlock

Re: resend: Re: Btrfs: adjust len of writes if following a preallocated extent

2016-12-16 Thread Liu Bo
On Fri, Dec 02, 2016 at 12:25:19PM +, Filipe Manana wrote: > On Fri, Dec 2, 2016 at 1:41 AM, Liu Bo <bo.li@oracle.com> wrote: > > On Thu, Nov 24, 2016 at 11:13:37AM +, Filipe Manana wrote: > >> On Wed, Nov 23, 2016 at 9:22 PM, Liu Bo <

Re: corrupt leaf on just-created filesystem

2016-12-16 Thread Liu Bo
On Fri, Dec 16, 2016 at 10:44:11AM -0500, Jeff Mahoney wrote: > On 12/16/16 4:18 AM, Adam Borowski wrote: > > Got a 100% reproducible splat on 4.9. > > > > So I plopped in a fresh 4TB disk: > > > > dd if=/dev/zero of=meow bs=1 seek=4000785104895 count=1 > > mkfs -t btrfs meow > > mount -onoatime

[GIT PULL] btrfs fixes and cleanups

2016-12-14 Thread Liu Bo
github.com/liubogithub/btrfs-work.git for-dave Thanks, liubo Liu Bo (9): Btrfs: add 'inode' for extent map tracepoint Btrfs: add truncated_len for ordered extent tracepoints Btrfs: use down_read_nested to make lockdep silent Btrfs: fix lockdep warning about log_mutex Btrfs: fix truncate down whe

[PATCH] Btrfs: fix another race between truncate and lockless dio write

2016-12-14 Thread Liu Bo
/299 with patch "Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly" applied. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index

Re: [PATCH] Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly

2016-12-14 Thread Liu Bo
On Thu, Dec 01, 2016 at 01:46:10PM -0800, Liu Bo wrote: > btrfs_ordered_update_i_size can be called by truncate and endio, but only > endio > takes ordered_extent which contains the completed IO. > > while truncating down a file, if there are some in-flight IOs, > btrfs_ord

[PATCH v2] Btrfs: fix lockdep warning about log_mutex

2016-12-13 Thread Liu Bo
. Reviewed-by: Filipe Manana <fdman...@suse.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: Use SINGLE_DEPTH_NESTING to avoid magic number. fs/btrfs/tree-log.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree

[PATCH v2] Btrfs: use down_read_nested to make lockdep silent

2016-12-13 Thread Liu Bo
If @block_group is not @used_bg, it'll try to get @used_bg's lock without droping @block_group 's lock and lockdep has throwed a scary deadlock warning about it. Fix it by using down_read_nested. Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: Use 'SINGLE_DEPTH_NESTING' to avoid magic

[PATCH v2] Btrfs: add 'inode' for extent map tracepoint

2016-12-13 Thread Liu Bo
'inode' is an important field for btrfs_get_extent, lets trace it. Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: add 'unsigned long long' for consistence. fs/btrfs/inode.c | 2 +- include/trace/events/btrfs.h | 12 2 files changed, 9 insertions(+), 5 del

[PATCH] Btrfs: fix comment in btrfs_page_mkwrite

2016-12-13 Thread Liu Bo
oper logic is to check if delalloc bits has been set and if so, go free reserved space, if not, set the delalloc bits for dirty page range. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/in

Re: [PATCH 1/6] Btrfs: add mount option for dax

2016-12-09 Thread Liu Bo
On Fri, Dec 09, 2016 at 03:47:20PM +1100, Dave Chinner wrote: > On Wed, Dec 07, 2016 at 01:45:05PM -0800, Liu Bo wrote: > > Signed-off-by: Liu Bo <bo.li@oracle.com> > > --- > > fs/btrfs/ctree.h | 1 + > > fs/btrfs/super.c | 40

Re: [PATCH 4/6] Btrfs: add DAX support for nocow btrfs

2016-12-09 Thread Liu Bo
On Fri, Dec 09, 2016 at 01:31:03PM +0100, Jan Kara wrote: > On Thu 08-12-16 08:45:39, Liu Bo wrote: > > On Thu, Dec 08, 2016 at 11:47:41AM +0100, Jan Kara wrote: > > > On Wed 07-12-16 17:15:42, Chris Mason wrote: > > > > On 12/07/2016 04:45 PM, Liu Bo wrote: >

Re: [PATCH 0/6] btrfs dax IO

2016-12-08 Thread Liu Bo
hot to be taken. COW is disabled by letting the dax mount option imply the "nodatacow" option. Thanks for spotting this! Thanks, -liubo > > I experienced some similar system but am a bit new to the brtfs code. >   > Thanks,  > Xin >   >   > > Subj

Re: [PATCH 4/6] Btrfs: add DAX support for nocow btrfs

2016-12-08 Thread Liu Bo
On Thu, Dec 08, 2016 at 11:47:41AM +0100, Jan Kara wrote: > On Wed 07-12-16 17:15:42, Chris Mason wrote: > > On 12/07/2016 04:45 PM, Liu Bo wrote: > > >This has implemented DAX support for btrfs with nocow and single-device. > > > > > >DAX is developed fo

Re: [PATCH 2/6] Btrfs: set single device limit for dax usecase

2016-12-08 Thread Liu Bo
On Thu, Dec 08, 2016 at 02:35:59PM +0100, David Sterba wrote: > On Wed, Dec 07, 2016 at 01:45:06PM -0800, Liu Bo wrote: > > Dax on btrfs is not ready for multiple device. > > How about DUP? Technically it's not multi-device but still stores > multiple copies, so I don't know if

Re: [PATCH 4/6] Btrfs: add DAX support for nocow btrfs

2016-12-07 Thread Liu Bo
On Wed, Dec 07, 2016 at 05:15:42PM -0500, Chris Mason wrote: > > > On 12/07/2016 04:45 PM, Liu Bo wrote: > > This has implemented DAX support for btrfs with nocow and single-device. > > > > DAX is developed for block devices that are memory-like in order to avoid >

Re: [bug]: possible recursive locking detected

2016-12-07 Thread Liu Bo
Hi, On Wed, Dec 07, 2016 at 11:11:41AM -0500, Yclept Nemo wrote: > kernel version: drm-next x86_64 > abrt (fedora) bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1402453 I believe the patch [1] can address this warning. [1]: https://patchwork.kernel.org/patch/9457035/ Thanks, -liubo

[PATCH 6/6] Btrfs: add tracepoint for btrfs_get_blocks_dax_fault

2016-12-07 Thread Liu Bo
These TPs can help us monitor iomap content for dax reads and writes. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 9 include/trace/events/btrfs.h | 106 +++ 2 files changed, 115 insertions(+) diff --gi

[PATCH 2/6] Btrfs: set single device limit for dax usecase

2016-12-07 Thread Liu Bo
Dax on btrfs is not ready for multiple device. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ioctl.c | 6 ++ fs/btrfs/super.c | 7 +++ 2 files changed, 13 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7acbd2c..ab30d88 100644 --- a/fs/btrfs/i

[PATCH 3/6] Btrfs: refactor btrfs_file_write_iter

2016-12-07 Thread Liu Bo
This adds a helper function btrfs_file_write_check for file checks, permission check and necessary time and size extention. With this, we simplify btrfs_file_write_iter by putting details into seperated buffered_write and direct_write callback. Signed-off-by: Liu Bo <bo.li@oracle.

[PATCH 1/6] Btrfs: add mount option for dax

2016-12-07 Thread Liu Bo
Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ctree.h | 1 + fs/btrfs/super.c | 40 +++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0b8ce2b..e54c6e6 100644 --- a/fs/btrfs/ctree.h

[PATCH 4/6] Btrfs: add DAX support for nocow btrfs

2016-12-07 Thread Liu Bo
, this is limited to nocow case. I made this by setting nodatacow in dax mount option. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/Kconfig | 1 + fs/btrfs/ctree.h | 5 + fs/btrfs/file.c | 214 ++--- fs/btrfs/inode.c

[PATCH 0/6] btrfs dax IO

2016-12-07 Thread Liu Bo
patch set tested with fstests, except those issues caused by failure of creating snapshot/reflink and requirement for mutliple device, fstests said OK. To test it, simply use kernel cmd option "memmap=", mkfs.btrfs and mount -odax, then you're ready to go run anything upon dax-version btrfs.

[PATCH 5/6] Btrfs: add mmap_sem to avoid race between page faults and truncate/hole_punch

2016-12-07 Thread Liu Bo
to understand how they do that. This adds a new rw_semaphore mmap_sem in inode and grab it for writing over truncate, hole punching and for reading over page faults. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/btrfs_inode.h | 7 +++ fs/btrfs/file.c

Re: resend: Re: Btrfs: adjust len of writes if following a preallocated extent

2016-12-01 Thread Liu Bo
On Thu, Nov 24, 2016 at 11:13:37AM +, Filipe Manana wrote: > On Wed, Nov 23, 2016 at 9:22 PM, Liu Bo <bo.li@oracle.com> wrote: > > Hi, > > > > On Wed, Nov 23, 2016 at 06:21:35PM +0100, Stefan Priebe - Profihost AG > > wrote: > >> Hi, > &

[PATCH] Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly

2016-12-01 Thread Liu Bo
size. Besides fixing the above issue, add an assertion for last_size to double check we truncate down to the desired size. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c| 14 ++ fs/btrfs/ordered-data.c | 9 +++-- 2 files changed, 21 insertions

[PATCH] Btrfs: fix lockdep warning about log_mutex

2016-12-01 Thread Liu Bo
. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/tree-log.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 3d33c4e..e961451 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -37,6

[PATCH] Btrfs: add truncated_len for ordered extent tracepoints

2016-12-01 Thread Liu Bo
This can help us monitor truncated ordered extents. Signed-off-by: Liu Bo <bo.li@oracle.com> --- include/trace/events/btrfs.h | 4 1 file changed, 4 insertions(+) diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index e030d6f..1dc1197 100644 --- a/include

[PATCH] Btrfs: use down_read_nested to make lockdep silent

2016-12-01 Thread Liu Bo
If @block_group is not @used_bg, it'll try to get @used_bg's lock without droping @block_group 's lock and lockdep has throwed a scary deadlock warning about it. Fix it by using down_read_nested. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent-tree.c | 3 ++- 1 file chan

[PATCH] Btrfs: add 'inode' for extent map tracepoint

2016-12-01 Thread Liu Bo
'inode' is an important field for btrfs_get_extent, lets trace it. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 2 +- include/trace/events/btrfs.h | 13 - 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/inode.c b/fs

[PATCH v2] Btrfs: fix truncate down when no_holes feature is enabled

2016-12-01 Thread Liu Bo
ever, even if data has been flushed, we can still have trouble in updating disk isize since we updated disk isize to 'start' of the last evicted extent. Reviewed-by: Chris Mason <c...@fb.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: Remove the assertion. fs/btrfs/inode.c | 13

Re: btrfs: still lockdep splat for 4.9-rc5+ (btrfs_log_inode)

2016-11-28 Thread Liu Bo
On Sat, Nov 26, 2016 at 08:46:38AM -0500, Chris Mason wrote: > On Fri, Nov 25, 2016 at 10:03:25AM +0100, Christian Borntraeger wrote: > > FWIW, I still see the lockdep splat in btrfs in 4.9-rc5+ > > Filipe reworked the code to avoid taking the same lock twice. As far as I > can tell, this just

Re: [PATCH v2 1/2] Btrfs: add more valid checks for superblock

2016-11-28 Thread Liu Bo
On Fri, Nov 25, 2016 at 05:50:19PM +0100, David Sterba wrote: > On Fri, Jun 03, 2016 at 12:05:14PM -0700, Liu Bo wrote: > > @@ -6648,6 +6648,7 @@ int btrfs_read_chunk_tree(struct btrfs_root *root) > > struct btrfs_key found_key; > > int ret; > > int slot

[PATCH v2] Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

2016-11-23 Thread Liu Bo
orruption when non-root leaf has zero item) Cc: sta...@vger.kernel.org # 4.8+ Reported-by: Jeff Mahoney <je...@suse.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: Tag itself for stable. fs/btrfs/disk-io.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) d

Re: [PATCH] Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

2016-11-23 Thread Liu Bo
On Wed, Nov 23, 2016 at 05:48:45PM +, Filipe Manana wrote: > On Wed, Nov 23, 2016 at 1:15 PM, Filipe Manana <fdman...@gmail.com> wrote: > > On Mon, Oct 17, 2016 at 4:44 PM, Liu Bo <bo.li@oracle.com> wrote: > >> On Mon, Oct 17, 2016 at 03:00:25PM +0200, David S

Re: [PATCH] Btrfs: fix emptiness check for dirtied extent buffers at check_leaf()

2016-11-23 Thread Liu Bo
* buffer corresponds to the root of the relocation tree or not. So skip > + * this check for relocation trees. > + */ > + if (nritems == 0 && !btrfs_header_flag(leaf, BTRFS_HEADER_FLAG_RELOC)) { Hmm, it seems that we're not able to fetch a reloc r

Re: resend: Re: Btrfs: adjust len of writes if following a preallocated extent

2016-11-23 Thread Liu Bo
Hi, On Wed, Nov 23, 2016 at 06:21:35PM +0100, Stefan Priebe - Profihost AG wrote: > Hi, > > sorry last mail was from the wrong box. > > Am 04.11.2016 um 20:20 schrieb Liu Bo: > > If we have > > > > |0--hole--4095||4096--preallocate--12287| > > > &

Re: [PATCH 1/9] btrfs: use bio iterators for the decompression handlers

2016-11-22 Thread Liu Bo
On Tue, Nov 22, 2016 at 01:38:46AM -0800, Christoph Hellwig wrote: > On Fri, Nov 18, 2016 at 05:29:06PM -0800, Liu Bo wrote: > > On Wed, Nov 16, 2016 at 01:52:08PM +0100, Christoph Hellwig wrote: > > > Pass the full bio to the decompression routines and use bio iterators >

Re: [PATCH] Btrfs: fix truncate down when no_holes feature is enabled

2016-11-22 Thread Liu Bo
On Tue, Nov 22, 2016 at 02:13:21PM -0500, Chris Mason wrote: > On 11/11/2016 05:27 PM, Liu Bo wrote: > > For such a file mapping, > > > > [0-4k][hole][8k-12k] > > > > In NO_HOLES mode, we don't have the [hole] extent any more. > > Commit c1aa45759e

Re: [PATCH] btrfs: Ensure proper sector alignment for btrfs_free_reserved_data_space

2016-11-20 Thread Liu Bo
On Fri, Nov 18, 2016 at 09:52:40PM -0500, Jeff Mahoney wrote: > From: Jeff Mahoney > Subject: btrfs: Ensure proper sector alignment for > btrfs_free_reserved_data_space > References: bsc#1005666 > Patch-mainline: Submitted 18 Nov 2016, linux-btrfs > > This fixes the WARN_ON on

Re: [PATCH 1/9] btrfs: use bio iterators for the decompression handlers

2016-11-18 Thread Liu Bo
On Wed, Nov 16, 2016 at 01:52:08PM +0100, Christoph Hellwig wrote: > Pass the full bio to the decompression routines and use bio iterators > to iterate over the data in the bio. One question below, > > Signed-off-by: Christoph Hellwig > --- > fs/btrfs/compression.c | 122 >

[PATCH v2] fstests: generic/098 update test for truncating a file into the middle of a hole

2016-11-16 Thread Liu Bo
This updates generic/098 by adding a sync option, i.e. 'sync' after the second write, and with btrfs's NO_HOLES, we could still get wrong isize after remount. This gets fixed by the patch 'Btrfs: fix truncate down when no_holes feature is enabled' Signed-off-by: Liu Bo <bo.li@oracle.

Re: [PATCH] fstests: generic/098 update test for truncating a file into the middle of a hole

2016-11-16 Thread Liu Bo
On Tue, Nov 15, 2016 at 02:53:12PM +0800, Eryu Guan wrote: > On Fri, Nov 11, 2016 at 02:30:04PM -0800, Liu Bo wrote: > > This updates generic/098 by adding a sync option, i.e. 'sync' after the > > second > > write, and with btrfs's NO_HOLES, we could still get wrong isi

Re: [PATCH 1/2] Btrfs: fix file extent corruption

2016-11-14 Thread Liu Bo
On Mon, Nov 14, 2016 at 02:06:21PM -0500, Josef Bacik wrote: > In order to do hole punching we have a block reserve to hold the reservation > we > need to drop the extents in our range. Since we could end up dropping a lot > of > extents we set rsv->failfast so we can just loop around again and

Re: spinning kworker with space_cache=v2 searching for free space

2016-11-11 Thread Liu Bo
On Wed, Nov 09, 2016 at 09:19:21PM +0100, Stefan Priebe - Profihost AG wrote: > Hello, > > found this one from 2014: > https://patchwork.kernel.org/patch/5551651/ > > it this still valid? The space cache code doesn't change a lot, so I think the patch is still valid to apply(there might be some

[PATCH] fstests: generic/098 update test for truncating a file into the middle of a hole

2016-11-11 Thread Liu Bo
This updates generic/098 by adding a sync option, i.e. 'sync' after the second write, and with btrfs's NO_HOLES, we could still get wrong isize after remount. This gets fixed by the patch 'Btrfs: fix truncate down when no_holes feature is enabled' Signed-off-by: Liu Bo <bo.li@oracle.

[PATCH] Btrfs: fix truncate down when no_holes feature is enabled

2016-11-11 Thread Liu Bo
ever, even if data has been flushed, we can still have trouble in updating disk isize since we updated disk isize to 'start' of the last evicted extent. Also add a ASSERT for better catching (for developers only). Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 16

Re: [RFC] btrfs: make max inline data can be equal to sectorsize

2016-11-11 Thread Liu Bo
On Tue, Oct 11, 2016 at 02:47:42PM +0800, Wang Xiaoguang wrote: > If we use mount option "-o max_inline=sectorsize", say 4096, indeed > even for a fresh fs, say nodesize is 16k, we can not make the first > 4k data completely inline, I found this conditon causing this issue: > !compressed_size &&

Re: bi_vcnt checks for repair

2016-11-11 Thread Liu Bo
On Thu, Nov 10, 2016 at 12:06:01PM -0800, Christoph Hellwig wrote: > Hi all, > > btrfs_check_repairable and bio_readpage_error have somewhat odd > looking check for bi_vcnt, checking on how to proceed based on that. > > Does anyone remember what they actually are checking for? Depending > on

Re: [PATCH] Btrfs: deal with existing encompassing extent map in btrfs_get_extent()

2016-11-10 Thread Liu Bo
thmetic overflows because there is no such thing. We then end > > up trying to add a bogus em to the em_tree, which results in a EEXIST > > that can bubble all the way up to userspace. > > Is this possibly the same bug that Liu Bo fixes in > https://patchwork.kernel.org/patch/

Re: [PATCH] Btrfs: deal with existing encompassing extent map in btrfs_get_extent()

2016-11-10 Thread Liu Bo
On Thu, Nov 10, 2016 at 12:24:13PM -0800, Omar Sandoval wrote: > On Thu, Nov 10, 2016 at 12:09:06PM -0800, Omar Sandoval wrote: > > On Thu, Nov 10, 2016 at 12:01:20PM -0800, Liu Bo wrote: > > > On Wed, Nov 09, 2016 at 03:26:50PM -0800, Omar Sandoval wrote: > > >

Re: [PATCH] Btrfs: deal with existing encompassing extent map in btrfs_get_extent()

2016-11-10 Thread Liu Bo
On Wed, Nov 09, 2016 at 03:26:50PM -0800, Omar Sandoval wrote: > From: Omar Sandoval > > My QEMU VM was seeing inexplicable I/O errors that I tracked down to > errors coming from the qcow2 virtual drive in the host system. The qcow2 > file is a nocow file on my Btrfs drive, which

[PATCH] Btrfs: adjust len of writes if following a preallocated extent

2016-11-04 Thread Liu Bo
without adjusting @len. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/inode.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2b790bd..48e9356 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7783,10 +7

Re: [PATCH] btrfs: imporve delayed refs iterations

2016-10-24 Thread Liu Bo
erences >* to add, which would fail because they would not find the extent item. >*/ > - list_for_each_entry(ref, >ref_list, list) { > - if (ref->action == BTRFS_ADD_DELAYED_REF) > - return ref; > - } > +

Re: [PATCH] Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

2016-10-17 Thread Liu Bo
On Mon, Oct 17, 2016 at 03:00:25PM +0200, David Sterba wrote: > On Thu, Oct 13, 2016 at 09:47:11AM +0100, Filipe Manana wrote: > > > Since the crash is similar to the call chains from Jeff's report, > > > ie. > > > btrfs_del_csums > > > -> btrfs_search_slot > > > -> btrfs_cow_block > > >

Re: [PATCH] Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

2016-10-12 Thread Liu Bo
On Wed, Oct 12, 2016 at 10:23:52PM +0100, Filipe Manana wrote: > On Tue, Sep 6, 2016 at 10:51 PM, Liu Bo <bo.li@oracle.com> wrote: > > Hi Filipe, > > > > On Mon, Sep 05, 2016 at 04:28:09PM +0100, Filipe Manana wrote: > >> On Fri, Sep 2, 2016 at 8:35 PM,

Re: [PATCH 1/7] Btrfs: replace BUG() with WARN_ONCE in raid56

2016-10-12 Thread Liu Bo
On Wed, Oct 12, 2016 at 05:06:55PM +0200, David Sterba wrote: > On Mon, May 16, 2016 at 10:32:48AM +0200, David Sterba wrote: > > On Sun, May 15, 2016 at 04:19:28PM +0200, Holger Hoffstätte wrote: > > > On 05/14/16 02:06, Liu Bo wrote: > > > > This BUG() has been tri

Re: corrupt leaf, slot offset bad

2016-10-11 Thread Liu Bo
On Tue, Oct 11, 2016 at 02:48:09PM +0200, David Sterba wrote: > Hi, > > looks like a lot of random bitflips. > > On Mon, Oct 10, 2016 at 11:50:14PM +0200, a...@aron.ws wrote: > > item 109 has a few strange chars in its name (and it's truncated): > > 1-x86_64.pkg.tar.xz 0x62 0x14 0x0a 0x0a > >

Re: corrupt leaf, slot offset bad

2016-10-10 Thread Liu Bo
On Mon, Oct 10, 2016 at 08:57:19PM +0200, a...@aron.ws wrote: > Hi all, > > I've been using btrfs for a few months now, without any problems. During > work, I've noticed segfaults, when accessing my root directory. As my home > directory contents was readable, I've decided to reboot. That was the

Re: Post ext3 conversion problems

2016-09-16 Thread Liu Bo
On Fri, Sep 16, 2016 at 03:25:00PM -0400, Sean Greenslade wrote: > Hi, all. I've been playing around with an old laptop of mine, and I > figured I'd use it as a learning / bugfinding opportunity. Its /home > partition was originally ext3. I have a full partition image of this > drive as a backup,

Re: [PATCH] Btrfs: kill BUG_ON in do_relocation

2016-09-15 Thread Liu Bo
On Wed, Sep 14, 2016 at 11:19:04AM -0700, Liu Bo wrote: > On Wed, Sep 14, 2016 at 01:31:31PM -0400, Josef Bacik wrote: > > On 09/14/2016 01:29 PM, Chris Mason wrote: > > > > > > > > > On 09/14/2016 01:13 PM, Josef Bacik wrote: > > > > On 09

[PATCH] Btrfs: kill BUG_ON in run_delayed_tree_ref

2016-09-14 Thread Liu Bo
In a corrupted btrfs image, we can come across this BUG_ON and get an unreponsive system, but if we return errors instead, its caller can handle everything gracefully by aborting the current transaction. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent-tree.c | 8 +++-

[PATCH] Btrfs: add error handling for extent buffer in print tree

2016-09-14 Thread Liu Bo
Somehow we missed btrfs_print_tree when last time we updated error handling for read_extent_block(). This keeps us from getting a NULL pointer panic when btrfs_print_tree's read_extent_block() fails. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/print-tree.c | 7 +++

[PATCH] Btrfs: memset to avoid stale content in btree node block

2016-09-14 Thread Liu Bo
@nritems as the correct one and gets to memset the unused part of a btree node. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent_io.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index c2325c3..56c9dee 100644 --- a/fs

[PATCH] Btrfs: improve check_node to avoid reading corrupted nodes

2016-09-14 Thread Liu Bo
We need to check items in a node to make sure that we're reading a valid one, otherwise we could get various crashes while processing delayed_refs. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/disk-io.c | 32 1 file changed, 28 insertions

Re: [PATCH] Btrfs: kill BUG_ON in do_relocation

2016-09-14 Thread Liu Bo
On Wed, Sep 14, 2016 at 01:31:31PM -0400, Josef Bacik wrote: > On 09/14/2016 01:29 PM, Chris Mason wrote: > > > > > > On 09/14/2016 01:13 PM, Josef Bacik wrote: > > > On 09/14/2016 12:27 PM, Liu Bo wrote: > > > > While updating btree, we try to push

Re: [PATCH] Btrfs: kill BUG_ON in do_relocation

2016-09-14 Thread Liu Bo
On Wed, Sep 14, 2016 at 01:13:34PM -0400, Josef Bacik wrote: > On 09/14/2016 12:27 PM, Liu Bo wrote: > > While updating btree, we try to push items between sibling > > nodes/leaves in order to keep height as low as possible. > > But we don't memset the original places with

[PATCH] Btrfs: kill BUG_ON in do_relocation

2016-09-14 Thread Liu Bo
e new bytenr of A, but with the same @key, we get the same path again, and get panic by BUG_ON. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/relocation.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c inde

[PATCH] Btrfs: return gracefully from balance if fs tree is corrupted

2016-09-14 Thread Liu Bo
us print some error messages and return gracefully from balance. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/relocation.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index c0c13dc..6

[PATCH] Btrfs: remove BUG_ON in start_transaction

2016-09-13 Thread Liu Bo
ted.) -> BUG_ON(type == TRANS_JOIN_NOLOCK); Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/transaction.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 95d4191..6d06365 100644 --- a/fs/btrfs/transac

[PATCH] Btrfs: fix memory leak in do_walk_down

2016-09-13 Thread Liu Bo
The extent buffer 'next' needs to be free'd conditionally. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5a940ab..779fd72 100644 --- a/fs/btrfs/extent-tree.c

Re: segfault btrfs scrub

2016-09-09 Thread Liu Bo
On Fri, Sep 09, 2016 at 02:41:45PM +0200, Jan Koester wrote: > >   >   > Hi, > > i got from btrfs scrub command segfault. I use btrfs tools 4.7.2. >   > root@dibsi:/home/jan# btrfs scrub status /local > Speicherzugriffsfehler > root@dibsi:/home/jan# dmesg > [78294.556713] BTRFS error (device

Re: [PATCH] Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

2016-09-07 Thread Liu Bo
Hi Jeff, On Wed, Sep 07, 2016 at 10:25:54AM -0400, Jeff Mahoney wrote: > On 9/6/16 5:51 PM, Liu Bo wrote: > > Hi Filipe, > > > > On Mon, Sep 05, 2016 at 04:28:09PM +0100, Filipe Manana wrote: > >> On Fri, Sep 2, 2016 at 8:35 PM, Liu Bo <bo.li@oracle.com&g

Re: [PATCH 7/7] Btrfs: fix memory leak due to invalid btree height

2016-09-06 Thread Liu Bo
On Tue, Sep 06, 2016 at 06:50:19PM +0200, David Sterba wrote: > On Fri, May 13, 2016 at 05:07:02PM -0700, Liu Bo wrote: > > Thanks to fuzz testing, we can have invalid btree root node height. > > Shouldn't we do this kind of sanity checks earlier? Not at the search > slot time

Re: [PATCH] Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

2016-09-06 Thread Liu Bo
Hi Filipe, On Mon, Sep 05, 2016 at 04:28:09PM +0100, Filipe Manana wrote: > On Fri, Sep 2, 2016 at 8:35 PM, Liu Bo <bo.li@oracle.com> wrote: > > This can only happen with CONFIG_BTRFS_FS_CHECK_INTEGRITY=y. > > > > Commit 1ba98d0 ("Btrfs: detect corruption

Re: [PATCH] Btrfs: don't leak reloc root nodes on errorg

2016-09-06 Thread Liu Bo
On Mon, Sep 05, 2016 at 05:20:53PM +0200, David Sterba wrote: > On Fri, Sep 02, 2016 at 06:08:35PM -0700, Liu Bo wrote: > > On Fri, Sep 02, 2016 at 03:25:43PM -0400, Josef Bacik wrote: > > > We don't track the reloc roots in any sort of normal way, so the only way > > >

Re: [PATCH] Btrfs: don't leak reloc root nodes on error

2016-09-02 Thread Liu Bo
On Fri, Sep 02, 2016 at 03:25:43PM -0400, Josef Bacik wrote: > We don't track the reloc roots in any sort of normal way, so the only way the > root/commit_root nodes get free'd is if the relocation finishes successfully > and > the reloc root is deleted. Fix this by free'ing them in

<    4   5   6   7   8   9   10   11   12   13   >