mirror of
https://github.com/adulau/aha.git
synced 2024-12-30 20:56:23 +00:00
[PATCH] device-mapper: handle __lock_fs error
Handle error from __lock_fs() 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>
This commit is contained in:
parent
dfbe03f6d0
commit
354e007121
1 changed files with 14 additions and 8 deletions
|
@ -1048,6 +1048,7 @@ int dm_suspend(struct mapped_device *md)
|
||||||
{
|
{
|
||||||
struct dm_table *map;
|
struct dm_table *map;
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
DECLARE_WAITQUEUE(wait, current);
|
||||||
|
int error;
|
||||||
|
|
||||||
/* Flush I/O to the device. */
|
/* Flush I/O to the device. */
|
||||||
down_read(&md->lock);
|
down_read(&md->lock);
|
||||||
|
@ -1056,25 +1057,29 @@ int dm_suspend(struct mapped_device *md)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = __lock_fs(md);
|
||||||
|
if (error) {
|
||||||
|
up_read(&md->lock);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
map = dm_get_table(md);
|
map = dm_get_table(md);
|
||||||
if (map)
|
if (map)
|
||||||
dm_table_presuspend_targets(map);
|
dm_table_presuspend_targets(map);
|
||||||
__lock_fs(md);
|
|
||||||
|
|
||||||
up_read(&md->lock);
|
up_read(&md->lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First we set the BLOCK_IO flag so no more ios will be
|
* First we set the BLOCK_IO flag so no more ios will be mapped.
|
||||||
* 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);
|
down_write(&md->lock);
|
||||||
if (test_bit(DMF_BLOCK_IO, &md->flags)) {
|
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);
|
up_write(&md->lock);
|
||||||
|
if (map)
|
||||||
|
dm_table_put(map);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1107,6 +1112,7 @@ int dm_suspend(struct mapped_device *md)
|
||||||
|
|
||||||
/* were we interrupted ? */
|
/* were we interrupted ? */
|
||||||
if (atomic_read(&md->pending)) {
|
if (atomic_read(&md->pending)) {
|
||||||
|
/* FIXME Undo the presuspend_targets */
|
||||||
__unlock_fs(md);
|
__unlock_fs(md);
|
||||||
clear_bit(DMF_BLOCK_IO, &md->flags);
|
clear_bit(DMF_BLOCK_IO, &md->flags);
|
||||||
up_write(&md->lock);
|
up_write(&md->lock);
|
||||||
|
|
Loading…
Reference in a new issue