linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Alasdair G Kergon <agk@redhat.com>
To: linux-lvm@redhat.com
Subject: Re: [linux-lvm] lvm2 snapshot BREAKS on 2nd snapshot
Date: Wed, 2 Nov 2005 00:03:53 +0000	[thread overview]
Message-ID: <20051102000353.GH26394@agk.surrey.redhat.com> (raw)
In-Reply-To: <1130861002.4970.3.camel@jgs4.ino.pvt>

On Tue, Nov 01, 2005 at 08:03:21AM -0800, James G. Sack (jim) wrote:
> I get this kcopyd BUG (and consequent Oops)

Here's a related patch to try from Jan Blunck.
  [The fix still needs moving into bio_list_merge() not its caller.]

If things keep to schedule, there'll be new userspace activation
code around the end of this week aimed at avoiding
snapshot failures locking up machines, and I'll be back dealing
with the outstanding kernel patches (including this one) by the 
middle of next week.

Alasdair


Index: linux-2.6/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-snap.c
+++ linux-2.6/drivers/md/dm-snap.c
@@ -588,7 +588,13 @@ static struct bio *__flush_bios(struct p
 	/* This is fine as long as kcopyd is single-threaded. If kcopyd
 	 * becomes multi-threaded, we'll need some locking here.
 	 */
-	bio_list_merge(&sibling->origin_bios, &pe->origin_bios);
+	if (pe->origin_bios.head)
+		bio_list_merge(&sibling->origin_bios, &pe->origin_bios);
+	else {
+		printk(KERN_ERR "%s(%s,%d): exception with NULL origin bio\n",
+		       __FUNCTION__, current->comm, current->pid);
+		dump_stack();
+	}
 
 	return NULL;
 }
@@ -927,7 +933,7 @@ static void list_merge(struct list_head 
 
 static int __origin_write(struct list_head *snapshots, struct bio *bio)
 {
-	int r = 1, first = 1;
+	int r = 1;
 	struct dm_snapshot *snap;
 	struct exception *e;
 	struct pending_exception *pe, *last = NULL;
@@ -981,6 +987,8 @@ static int __origin_write(struct list_he
 	 * Now that we have a complete pe list we can start the copying.
 	 */
 	if (last) {
+		int first = 1;
+
 		pe = last;
 		do {
 			down_write(&pe->snap->lock);
Index: linux-2.6/drivers/md/dm-bio-list.h
===================================================================
--- linux-2.6.orig/drivers/md/dm-bio-list.h
+++ linux-2.6/drivers/md/dm-bio-list.h
@@ -21,6 +21,8 @@ static inline void bio_list_init(struct 
 
 static inline void bio_list_add(struct bio_list *bl, struct bio *bio)
 {
+	BUG_ON(!bio);
+
 	bio->bi_next = NULL;
 
 	if (bl->tail)
@@ -33,6 +35,10 @@ static inline void bio_list_add(struct b
 
 static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2)
 {
+	BUG_ON(!bl2);
+	BUG_ON(!bl2->head);
+	BUG_ON(!bl2->tail);
+
 	if (bl->tail)
 		bl->tail->bi_next = bl2->head;
 	else


----- End forwarded message -----

  reply	other threads:[~2005-11-02  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01 16:03 [linux-lvm] lvm2 snapshot BREAKS on 2nd snapshot James G. Sack (jim)
2005-11-02  0:03 ` Alasdair G Kergon [this message]
     [not found] <20051103134422.54741734E9@hormel.redhat.com>
2005-11-03 19:17 ` James G. Sack (jim)

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=20051102000353.GH26394@agk.surrey.redhat.com \
    --to=agk@redhat.com \
    --cc=linux-lvm@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).