linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] dm missing bdput/thaw_bdev at removal
Date: Thu, 23 Feb 2006 19:05:09 -0500	[thread overview]
Message-ID: <43FE4DB5.5050904@ce.jp.nec.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

Hello,

The following script stalls at the 2nd suspend.
It's because bdput() isn't called for the suspended_bdev.

So the inode with bd_mount_sem held is just reused
in the next mapped_device device.
Then dm_suspend will try to freeze_bdev and wait forever.

Attached patch fixes this problem.

------------------------------------------------------------
#!/bin/sh -x

map=a
while true; do
  dmsetup create $map --notable
  dmsetup suspend $map
  dmsetup remove $map
done
------------------------------------------------------------

-- 
Jun'ichi Nomura, NEC Solutions (America), Inc.

[-- Attachment #2: dm-missing-bdput.patch --]
[-- Type: text/x-patch, Size: 638 bytes --]

Need to unfreeze and release bdev
otherwise the bdev inode with inconsistent state is reused later
and cause problem.

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>

--- linux-2.6.15.orig/drivers/md/dm.c	2006-02-23 18:28:23.000000000 -0500
+++ linux-2.6.15/drivers/md/dm.c	2006-02-23 18:29:04.000000000 -0500
@@ -812,6 +812,10 @@ static struct mapped_device *alloc_dev(u
 
 static void free_dev(struct mapped_device *md)
 {
+	if (md->suspended_bdev) {
+		thaw_bdev(md->suspended_bdev, NULL);
+		bdput(md->suspended_bdev);
+	}
 	free_minor(md->disk->first_minor);
 	mempool_destroy(md->tio_pool);
 	mempool_destroy(md->io_pool);

             reply	other threads:[~2006-02-24  0:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24  0:05 Jun'ichi Nomura [this message]
2006-02-24 16:31 ` [dm-devel] [PATCH] dm missing bdput/thaw_bdev at removal Alasdair G Kergon

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=43FE4DB5.5050904@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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).