Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1026
b: refs/heads/master
c: dfbe03f
h: refs/heads/master
v: v3
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed May 5, 2005
1 parent 46a0b2d commit 839e7db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3dcee8064bd36c547b45514dfd33df4c12695428
refs/heads/master: dfbe03f6d09fcebf85ae2a2cbb4ceee9b0985e67
18 changes: 17 additions & 1 deletion trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 839e7db

Please sign in to comment.