All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Clemens Eisserer <linuxhippy@gmail.com>
Cc: linux-btrfs@vger.kernel.org,
	Jon Nelson <jnelson+btrfs@jamponi.net>,
	Chris Mason <chris.mason@fusionio.com>
Subject: Re: hang on 3.9, 3.10-rc5
Date: Tue, 25 Jun 2013 23:52:35 +0800	[thread overview]
Message-ID: <20130625155234.GA11866@localhost.localdomain> (raw)
In-Reply-To: <CAFvQSYSq9M5bTLeO-EfrEy_LKKFq7rWsc8T25_Nj2kOSRmoCFg@mail.gmail.com>

On Fri, Jun 21, 2013 at 08:42:55AM +0200, Clemens Eisserer wrote:
> Hi Jon,
> 
> > Is this what you are looking for?
> > After this, the CPU gets "stuck" and I have to reboot.
> 
> This issue has already been reported:
> https://bugzilla.kernel.org/show_bug.cgi?id=59451

Hi,

Could you please try this patch?

(at least it addresses my ulist_add_merge crash :))

thanks,
liubo

diff --git a/fs/btrfs/ulist.c b/fs/btrfs/ulist.c
index 7b417e2..69a9c32 100644
--- a/fs/btrfs/ulist.c
+++ b/fs/btrfs/ulist.c
@@ -73,7 +73,6 @@ void ulist_fini(struct ulist *ulist)
 	if (ulist->nodes_alloced > ULIST_SIZE)
 		kfree(ulist->nodes);
 	ulist->nodes_alloced = 0;	/* in case ulist_fini is called twice */
-	ulist->root = RB_ROOT;
 }
 EXPORT_SYMBOL(ulist_fini);
 
@@ -205,6 +204,7 @@ int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux,
 		u64 new_alloced = ulist->nodes_alloced + 128;
 		struct ulist_node *new_nodes;
 		void *old = NULL;
+		int i;
 
 		/*
 		 * if nodes_alloced == ULIST_SIZE no memory has been allocated
@@ -222,6 +222,17 @@ int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux,
 			memcpy(new_nodes, ulist->int_nodes,
 			       sizeof(ulist->int_nodes));
 
+		/*
+		 * krealloc actually uses memcpy, which does not copy rb_node
+		 * pointers, so we have to do it ourselves.  Otherwise we may
+		 * be bitten by crashes.
+		 */
+		for (i = 0; i < ulist->nnodes; i++) {
+			rb_erase(&ulist->nodes[i].rb_node, &ulist->root);
+			ret = ulist_rbtree_insert(ulist, &new_nodes[i]);
+			BUG_ON(ret);
+		}
+
 		ulist->nodes = new_nodes;
 		ulist->nodes_alloced = new_alloced;
 	}


  reply	other threads:[~2013-06-25 15:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 15:43 hang on 3.9, 3.10-rc5 Sage Weil
2013-06-11 16:21 ` Chris Mason
     [not found]   ` <alpine.DEB.2.00.1306121317300.27596@cobra.newdream.net>
2013-06-18 15:56     ` Sage Weil
2013-06-18 16:36       ` Chris Mason
2013-06-18 16:37 ` Josef Bacik
2013-06-18 16:59   ` Chris Mason
2013-06-20  3:44     ` Sage Weil
2013-06-20 21:56       ` Sage Weil
2013-06-21  0:42         ` Chris Mason
2013-06-21  1:00           ` Sage Weil
2013-06-21  1:04             ` Chris Mason
2013-06-21  1:09               ` Sage Weil
2013-08-09 18:04           ` Sage Weil
2013-08-09 18:08             ` Chris Mason
2013-06-18 17:19   ` Jon Nelson
2013-06-21  1:11     ` Chris Mason
2013-06-21  1:46       ` Jon Nelson
2013-06-21  5:40         ` Chris Murphy
2013-06-21  6:42         ` Clemens Eisserer
2013-06-25 15:52           ` Liu Bo [this message]
2013-06-21 11:30         ` Chris Mason
2013-06-21 13:14           ` Jon Nelson
2013-06-21 14:54     ` Johannes Hirte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130625155234.GA11866@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=chris.mason@fusionio.com \
    --cc=jnelson+btrfs@jamponi.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linuxhippy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.