summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2005-05-05 16:16:04 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 16:36:45 -0700
commitdfbe03f6d09fcebf85ae2a2cbb4ceee9b0985e67 (patch)
tree81fda9aa4042682a8559269aab315199a5330016 /drivers/md/dm.c
parent3dcee8064bd36c547b45514dfd33df4c12695428 (diff)
downloadop-kernel-dev-dfbe03f6d09fcebf85ae2a2cbb4ceee9b0985e67.zip
op-kernel-dev-dfbe03f6d09fcebf85ae2a2cbb4ceee9b0985e67.tar.gz
[PATCH] device-mapper: let freeze_bdev return error
Allow freeze_bdev() to return an error. Signed-Off-By: Alasdair G Kergon <agk@redhat.com> From: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 0e4c8d3..9687a08 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -991,22 +991,38 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
*/
static int __lock_fs(struct mapped_device *md)
{
+ int error = -ENOMEM;
+
if (test_and_set_bit(DMF_FS_LOCKED, &md->flags))
return 0;
md->frozen_bdev = bdget_disk(md->disk, 0);
if (!md->frozen_bdev) {
DMWARN("bdget failed in __lock_fs");
- return -ENOMEM;
+ goto out;
}
WARN_ON(md->frozen_sb);
+
md->frozen_sb = freeze_bdev(md->frozen_bdev);
+ if (IS_ERR(md->frozen_sb)) {
+ error = PTR_ERR(md->frozen_sb);
+ goto out_bdput;
+ }
+
/* don't bdput right now, we don't want the bdev
* to go away while it is locked. We'll bdput
* in __unlock_fs
*/
return 0;
+
+out_bdput:
+ bdput(md->frozen_bdev);
+ md->frozen_sb = NULL;
+ md->frozen_bdev = NULL;
+out:
+ clear_bit(DMF_FS_LOCKED, &md->flags);
+ return error;
}
static void __unlock_fs(struct mapped_device *md)
OpenPOWER on IntegriCloud