Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1027
b: refs/heads/master
c: 354e007
h: refs/heads/master
i:
  1025: 46a0b2d
  1023: 4a33e99
v: v3
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed May 5, 2005
1 parent 839e7db commit 1e42914
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 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: dfbe03f6d09fcebf85ae2a2cbb4ceee9b0985e67
refs/heads/master: 354e007121de546e50b5592c2557575117435522
22 changes: 14 additions & 8 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ int dm_suspend(struct mapped_device *md)
{
struct dm_table *map;
DECLARE_WAITQUEUE(wait, current);
int error;

/* Flush I/O to the device. */
down_read(&md->lock);
Expand All @@ -1056,25 +1057,29 @@ int dm_suspend(struct mapped_device *md)
return -EINVAL;
}

error = __lock_fs(md);
if (error) {
up_read(&md->lock);
return error;
}

map = dm_get_table(md);
if (map)
dm_table_presuspend_targets(map);
__lock_fs(md);

up_read(&md->lock);

/*
* First we set the BLOCK_IO flag so no more ios will be
* mapped.
* First we set the BLOCK_IO flag so no more ios will be mapped.
*
* If the flag is already set we know another thread is trying to
* suspend as well, so we leave the fs locked for this thread.
*/
down_write(&md->lock);
if (test_bit(DMF_BLOCK_IO, &md->flags)) {
/*
* If we get here we know another thread is
* trying to suspend as well, so we leave the fs
* locked for this thread.
*/
up_write(&md->lock);
if (map)
dm_table_put(map);
return -EINVAL;
}

Expand Down Expand Up @@ -1107,6 +1112,7 @@ int dm_suspend(struct mapped_device *md)

/* were we interrupted ? */
if (atomic_read(&md->pending)) {
/* FIXME Undo the presuspend_targets */
__unlock_fs(md);
clear_bit(DMF_BLOCK_IO, &md->flags);
up_write(&md->lock);
Expand Down

0 comments on commit 1e42914

Please sign in to comment.