All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: Tom Spink <tspink@gmail.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: UML Reboot Panic
Date: Mon, 25 Aug 2008 18:11:45 -0400	[thread overview]
Message-ID: <20080825221145.GD12626@c2.user-mode-linux.org> (raw)
In-Reply-To: <7b9198260808241349v45c4d5ffjd908c7ffe34286a1@mail.gmail.com>

On Sun, Aug 24, 2008 at 09:49:15PM +0100, Tom Spink wrote:
> When using UML with a UML block device, and issuing a reboot, I was
> getting a kernel panic on the next kernel startup because UML was
> unable to open the file mapped to the UBD. 

The crash was because the attempt to get a file lock failed?

> I think this is because
> the file is not closed when the UBD is released, and the following
> patch appears to resolve this issue.

Looks right to me.

>  I'm not sure if it's the right
> fix, as I may have missed something, but it works for me.

That's slightly nasty - try the patch below.

       		      	    Jeff

-- 
Work email - jdike at linux dot intel dot com


Index: linux-2.6.22/arch/um/drivers/ubd_kern.c
===================================================================
--- linux-2.6.22.orig/arch/um/drivers/ubd_kern.c	2008-06-12 11:56:19.000000000 -0400
+++ linux-2.6.22/arch/um/drivers/ubd_kern.c	2008-08-25 18:09:35.000000000 -0400
@@ -722,6 +722,9 @@ static int create_cow_file(char *cow_fil
 
 static void ubd_close_dev(struct ubd *ubd_dev)
 {
+	if(--ubd_dev->count > 0)
+		return;
+
 	os_close_file(ubd_dev->fd);
 	if(ubd_dev->cow.file == NULL)
 		return;
@@ -801,6 +804,7 @@ static void ubd_device_release(struct de
 {
 	struct ubd *ubd_dev = dev->driver_data;
 
+	ubd_close_dev(ubd_dev);
 	blk_cleanup_queue(ubd_dev->queue);
 	*ubd_dev = ((struct ubd) DEFAULT_UBD);
 }
@@ -1144,8 +1148,7 @@ static int ubd_release(struct inode * in
 	struct gendisk *disk = inode->i_bdev->bd_disk;
 	struct ubd *ubd_dev = disk->private_data;
 
-	if(--ubd_dev->count == 0)
-		ubd_close_dev(ubd_dev);
+	ubd_close_dev(ubd_dev);
 	return 0;
 }
 

      reply	other threads:[~2008-08-25 22:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-24 20:49 UML Reboot Panic Tom Spink
2008-08-25 22:11 ` Jeff Dike [this message]

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=20080825221145.GD12626@c2.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tspink@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.