Re: [RFC PATCH] Btrfs: fix full backref problem when inserting shared block reference

2012-08-08 Thread David Sterba
On Thu, Aug 09, 2012 at 11:10:17AM +0800, Miao Xie wrote: > I chose the 1st way to fix it. The least I can say now is that it fixed the crash! The approach is minimalistic and I think we can take it for now. I didn't review it, only tested with reproducer you described plus modified the numbers up

Re: btrfs panic in 3.5.0

2012-08-08 Thread Jan Schmidt
On Thu, August 09, 2012 at 08:42 (+0200), Arne Jansen wrote: > On 09.08.2012 04:52, Marc MERLIN wrote: >> On Tue, Aug 07, 2012 at 11:47:36AM -0700, Marc MERLIN wrote: >>> On Tue, Aug 07, 2012 at 08:14:23PM +0200, Arne Jansen wrote: On 08/07/2012 07:40 PM, Marc MERLIN wrote: > Unfortunately

Re: btrfs panic in 3.5.0

2012-08-08 Thread Arne Jansen
On 09.08.2012 04:52, Marc MERLIN wrote: > On Tue, Aug 07, 2012 at 11:47:36AM -0700, Marc MERLIN wrote: >> On Tue, Aug 07, 2012 at 08:14:23PM +0200, Arne Jansen wrote: >>> On 08/07/2012 07:40 PM, Marc MERLIN wrote: Unfortunately I only have a screenshot. Apparently the panic was in >

[PATCH v2] Btrfs: fix race in run_clustered_refs

2012-08-08 Thread Arne Jansen
With commit commit d1270cd91f308c9d22b2804720c36ccd32dbc35e Author: Arne Jansen Date: Tue Sep 13 15:16:43 2011 +0200 Btrfs: put back delayed refs that are too new I added a window where the delayed_ref's head->ref_mod code can diverge from the sum of the remaining refs, because we re

[PATCH] Btrfs: fix wrong mtime and ctime when creating snapshots

2012-08-08 Thread Miao Xie
When we created a new snapshot, the mtime and ctime of its parent directory were not updated. Fix it. Signed-off-by: Miao Xie --- fs/btrfs/transaction.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 7ac7cdc..5a81982

Re: [PATCH V3 2/2] Btrfs: fix the snapshot that should not exist

2012-08-08 Thread Miao Xie
On Wed, 8 Aug 2012 15:38:41 +0200, David Sterba wrote: > On Sat, Aug 04, 2012 at 01:53:28PM +0800, Miao Xie wrote: >> But I'm not sure these two bugs is the same, so I need the test tool >> of David to look into it. > > Attached. It's a set of scripts and has a few assumptions hardcoded, > like wh

[RFC PATCH] Btrfs: fix full backref problem when inserting shared block reference

2012-08-08 Thread Miao Xie
If we create several snapshots at the same time, the following BUG_ON() will be triggered. kernel BUG at fs/btrfs/extent-tree.c:6047! Steps to reproduce: # mkfs.btrfs # mount # cd # for ((i=0;i<2400;i++)); do touch long_name_to_make_tree_more_deep$i; done # for ((i=0; i<4; i++))

Re: btrfs panic in 3.5.0

2012-08-08 Thread Marc MERLIN
On Tue, Aug 07, 2012 at 11:47:36AM -0700, Marc MERLIN wrote: > On Tue, Aug 07, 2012 at 08:14:23PM +0200, Arne Jansen wrote: > > On 08/07/2012 07:40 PM, Marc MERLIN wrote: > > > Unfortunately I only have a screenshot. > > > > > > Apparently the panic was in > > > btrfs_set_lock_blocking_rw > > > w

Re: [PATCH] Btrfs: fix race in run_clustered refs

2012-08-08 Thread Mitch Harder
On Wed, Aug 8, 2012 at 3:37 PM, Josef Bacik wrote: > On Wed, Aug 08, 2012 at 01:49:06PM -0600, Arne Jansen wrote: >> run_clustered_refs runs all delayed refs for one head one by one. During >> the runs, the delayed_refs->lock is released. In this window, the ref_mod >> from the head does not match

Re: [PATCH] Btrfs: fix race in run_clustered refs

2012-08-08 Thread Josef Bacik
On Wed, Aug 08, 2012 at 01:49:06PM -0600, Arne Jansen wrote: > run_clustered_refs runs all delayed refs for one head one by one. During > the runs, the delayed_refs->lock is released. In this window, the ref_mod > from the head does not match the sum of all refs below the head. When > btrfs_lookup_

[PATCH] Btrfs: fix race in run_clustered refs

2012-08-08 Thread Arne Jansen
run_clustered_refs runs all delayed refs for one head one by one. During the runs, the delayed_refs->lock is released. In this window, the ref_mod from the head does not match the sum of all refs below the head. When btrfs_lookup_extent_info is run in this window, it gives inconsistent results. The

[PATCH 2/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
Teach tree-log.c about extended inode refs. In particular, we have to adjust the behavior of inode ref replay as well as log tree recovery to account for the existence of extended refs. Signed-off-by: Mark Fasheh --- fs/btrfs/backref.c | 68 fs/btrfs/backref.h |5 + fs/btrfs

[PATCH 3/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
The iterate_irefs in backref.c is used to build path components from inode refs. This patch adds code to iterate extended refs as well. I had modify the callback function signature to abstract out some of the differences between ref structures. iref_to_path() also needed similar changes. Signed-o

[PATCH 1/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
This patch adds basic support for extended inode refs. This includes support for link and unlink of the refs, which basically gets us support for rename as well. Inode creation does not need changing - extended refs are only added after the ref array is full. Signed-off-by: Mark Fasheh --- fs/b

[PATCH 0/3] btrfs: extended inode refs

2012-08-08 Thread Mark Fasheh
Currently btrfs has a limitation on the maximum number of hard links an inode can have. Specifically, links are stored in an array of ref items: struct btrfs_inode_ref { __le64 index; __le16 name_len; /* name goes here */ } __attribute__ ((__packed__)); The ref arrays are

Re: BUG on 3.5.0

2012-08-08 Thread Chris Mason
On Wed, Aug 08, 2012 at 11:56:06AM -0600, Lluís Batlle i Rossell wrote: > On Wed, Aug 08, 2012 at 01:40:11PM -0400, Josef Bacik wrote: > > On Wed, Aug 08, 2012 at 11:36:45AM -0600, David Sterba wrote: > > > according to assembly, owner is in R15, BTRFS_FIRST_FREE_OBJECTID is > > > 256, so owner ==

Re: BUG on 3.5.0

2012-08-08 Thread Lluís Batlle i Rossell
On Wed, Aug 08, 2012 at 01:40:11PM -0400, Josef Bacik wrote: > On Wed, Aug 08, 2012 at 11:36:45AM -0600, David Sterba wrote: > > according to assembly, owner is in R15, BTRFS_FIRST_FREE_OBJECTID is > > 256, so owner == 1 > > This is fixed already in btrfs-next. Thanks, Ok, thank you. Does it me

Re: BUG on 3.5.0

2012-08-08 Thread Josef Bacik
On Wed, Aug 08, 2012 at 11:36:45AM -0600, David Sterba wrote: > Hi, > > On Wed, Aug 08, 2012 at 06:18:19PM +0200, Lluís Batlle i Rossell wrote: > > I attach dmesg.txt, and the disasm of insert_inline_extent_backref. That > > disasm > > was a bit tricky; my objdump does not seem to understand the

Re: BUG on 3.5.0

2012-08-08 Thread David Sterba
Hi, On Wed, Aug 08, 2012 at 06:18:19PM +0200, Lluís Batlle i Rossell wrote: > I attach dmesg.txt, and the disasm of insert_inline_extent_backref. That > disasm > was a bit tricky; my objdump does not seem to understand the btrfs.ko. thanks, added a few bits to the picture > [ 6095.255745] -

Re: [PATCH] Btrfs: fix enospc problems when deleting a subvol

2012-08-08 Thread David Sterba
On Wed, Aug 08, 2012 at 12:12:59PM -0400, Josef Bacik wrote: > Subvol delete is a special kind of awful where we use the global reserve to > cover the ENOSPC requirements. The problem is once we're done removing > everything we do a btrfs_update_inode(), which by default will try to do the > delay

BUG on 3.5.0

2012-08-08 Thread Lluís Batlle i Rossell
Hello, I was running "btrfs fi balance start -dusage=5 -musage=5 -v /" on 3.5.0, and soon these BUG happened. Then some fs syscalls started to block (in mutt, find, ...), and after a while the computer (remote) stopped responding by ssh. After rebooting, the balance continued fine. I attach dmesg

[PATCH] Btrfs: fix enospc problems when deleting a subvol

2012-08-08 Thread Josef Bacik
Subvol delete is a special kind of awful where we use the global reserve to cover the ENOSPC requirements. The problem is once we're done removing everything we do a btrfs_update_inode(), which by default will try to do the delayed update stuff which will use it's own reserve. There will be no sp

Re: kernel BUG at fs/btrfs/extent-tree.c:5038 (linux 3.4.7)

2012-08-08 Thread Stefan Behrens
On Wed, 8 Aug 2012 16:45:57 +0200, David Sterba wrote: > On Sun, Aug 05, 2012 at 04:11:47PM +0200, Olivier Bonvalet wrote: >> Aug 5 16:10:12 backup2 kernel: [ 58.674758] parent transid verify failed >> on 615015833600 wanted 110423 found 110424 1st mirror fails verify_parent_transid(). >> Aug

Re: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol

2012-08-08 Thread Chris Mason
On Wed, Aug 08, 2012 at 09:20:59AM -0600, David Sterba wrote: > On Sat, Aug 04, 2012 at 01:39:25AM +0200, Alexander Block wrote: > > On Fri, Aug 3, 2012 at 11:13 PM, Josef Bacik wrote: > > > I'm confused, this isn't here in btrfs-next, so is this a problem still? > > > > It's in linus current mast

Re: [PATCH] Btrfs: remove mnt_want_write call in btrfs_mksubvol

2012-08-08 Thread David Sterba
On Sat, Aug 04, 2012 at 01:39:25AM +0200, Alexander Block wrote: > On Fri, Aug 3, 2012 at 11:13 PM, Josef Bacik wrote: > > I'm confused, this isn't here in btrfs-next, so is this a problem still? > > It's in linus current master. Lio Bo moved the call out of > btrfs_mksubvol into the caller. Later

Re: [PATCH] Btrfs: don't allocate a seperate csums array for direct reads

2012-08-08 Thread David Sterba
On Fri, Aug 03, 2012 at 04:51:55PM -0400, Josef Bacik wrote: > We've been allocating a big array for csums instead of storing them in the > io_tree like we do for buffered reads because previously we were locking the > entire range, so we didn't have an extent state for each sector of the > range.

Re: kernel BUG at fs/btrfs/extent-tree.c:5038 (linux 3.4.7)

2012-08-08 Thread David Sterba
On Sun, Aug 05, 2012 at 04:11:47PM +0200, Olivier Bonvalet wrote: > On 05/08/2012 10:57, Chris Samuel wrote: > > On 08/04/2012 08:41 AM, Olivier Bonvalet wrote: > > > >> Is there something I can do to fix that ? (the mount > >> option "recovery" didn't help here) > > > > I've seen someone (perhap

Re: [RFC] [PATCH] Btrfs: manage metadata cache ourselves

2012-08-08 Thread David Sterba
On Wed, Aug 01, 2012 at 05:06:45PM -0400, Josef Bacik wrote: > === > PLEASE REVIEW AND TEST THIS CAREFULLY > > I've dug this patch out of the bin and cleaned it up but who knows what kind > of > crust I've missed. This makes the create empty files until the file s

Re: [PATCH V3 2/2] Btrfs: fix the snapshot that should not exist

2012-08-08 Thread David Sterba
On Sat, Aug 04, 2012 at 01:53:28PM +0800, Miao Xie wrote: > But I'm not sure these two bugs is the same, so I need the test tool > of David to look into it. Attached. It's a set of scripts and has a few assumptions hardcoded, like where the tar srouce is and the name of extracted directory, so it'

Re: severe hardlink bug

2012-08-08 Thread Chris Samuel
On 08/08/2012 04:37 PM, Konstantin Dmitriev wrote: Unfortunately I cannot afford to have unstable patched kernel on the production server. I'd suggest that using btrfs for production servers is probably a bit brave (no matter what Oracle say), and what you've found illustrates the point rath

[PATCH 2/3 V2] Btrfs-progs: enhance btrfs subvol list only to show read-only snapshots

2012-08-08 Thread zhoubo
From: Zhou Bo We want 'btrfs subvolume list' only to list readonly subvolumes, this patch set introduces a new option 'r' to implement it. You can use the command like that: btrfs subvolume list -r Signed-off-by: Zhou Bo --- btrfs-list.c | 68 ++

[PATCH 3/3 V2] Btrfs-progs: update the manpage entries for the btrfs subvolume list

2012-08-08 Thread zhoubo
From: Zhou Bo This patch adds the introduction of the new option '-r' into the man page of 'btrfs subvolume list' command. Signed-off-by: Zhou Bo --- man/btrfs.8.in |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/man/btrfs.8.in b/man/btrfs.8.in index 4b0a9f9..0845b

[PATCH 1/3 V2] Btrfs-progs: move the function declarations to a new head file

2012-08-08 Thread zhoubo
From: Zhou Bo Move the function declarations to a new head file. Signed-off-by: Zhou Bo --- btrfs-list.c |1 + btrfs-list.h | 21 + cmds-inspect.c |4 +--- cmds-subvolume.c |5 + 4 files changed, 24 insertions(+), 7 deletions(-) create mode 1006

[PATCH 0/3 V2] Btrfs-progs: enhance btrfs subvol list only to show read-only snapshots

2012-08-08 Thread zhoubo
From: Zhou Bo We want 'btrfs subvolume list' only to list readonly subvolumes, this patch set introduces a new option 'r' to implement it. You can use the command like that: btrfs subvolume list -r v1->v2: address the comments from Goffredo Baroncelli - change the changelog of the pat