Commit dfbe03f6 authored by Alasdair G Kergon's avatar Alasdair G Kergon Committed by Linus Torvalds

[PATCH] device-mapper: let freeze_bdev return error

Allow freeze_bdev() to return an error.
Signed-Off-By: default avatarAlasdair G Kergon <agk@redhat.com>
From: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3dcee806
...@@ -991,22 +991,38 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table) ...@@ -991,22 +991,38 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
*/ */
static int __lock_fs(struct mapped_device *md) static int __lock_fs(struct mapped_device *md)
{ {
int error = -ENOMEM;
if (test_and_set_bit(DMF_FS_LOCKED, &md->flags)) if (test_and_set_bit(DMF_FS_LOCKED, &md->flags))
return 0; return 0;
md->frozen_bdev = bdget_disk(md->disk, 0); md->frozen_bdev = bdget_disk(md->disk, 0);
if (!md->frozen_bdev) { if (!md->frozen_bdev) {
DMWARN("bdget failed in __lock_fs"); DMWARN("bdget failed in __lock_fs");
return -ENOMEM; goto out;
} }
WARN_ON(md->frozen_sb); WARN_ON(md->frozen_sb);
md->frozen_sb = freeze_bdev(md->frozen_bdev); 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 /* don't bdput right now, we don't want the bdev
* to go away while it is locked. We'll bdput * to go away while it is locked. We'll bdput
* in __unlock_fs * in __unlock_fs
*/ */
return 0; 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) static void __unlock_fs(struct mapped_device *md)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment