From: Alasdair G Kergon <agk@redhat.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] device-mapper: [2/4] Fix deadlocks in core
Date: Mon, 11 Jul 2005 23:20:13 +0100 [thread overview]
Message-ID: <20050711222013.GD12355@agk.surrey.redhat.com> (raw)
Avoid another bdget_disk which can deadlock.
Signed-Off-By: Alasdair G Kergon <agk@redhat.com>
--- diff/drivers/md/dm.c 2005-07-11 22:52:10.000000000 +0100
+++ source/drivers/md/dm.c 2005-07-11 22:57:58.000000000 +0100
@@ -825,18 +825,13 @@
wake_up(&md->eventq);
}
-static void __set_size(struct gendisk *disk, sector_t size)
+static void __set_size(struct mapped_device *md, sector_t size)
{
- struct block_device *bdev;
+ set_capacity(md->disk, size);
- set_capacity(disk, size);
- bdev = bdget_disk(disk, 0);
- if (bdev) {
- down(&bdev->bd_inode->i_sem);
- i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
- up(&bdev->bd_inode->i_sem);
- bdput(bdev);
- }
+ down(&md->frozen_bdev->bd_inode->i_sem);
+ i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
+ up(&md->frozen_bdev->bd_inode->i_sem);
}
static int __bind(struct mapped_device *md, struct dm_table *t)
@@ -845,7 +840,7 @@
sector_t size;
size = dm_table_get_size(t);
- __set_size(md->disk, size);
+ __set_size(md, size);
if (size == 0)
return 0;
reply other threads:[~2005-07-11 22:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050711222013.GD12355@agk.surrey.redhat.com \
--to=agk@redhat.com \
--cc=akpm@osdl.org \
--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).