diff options
author | Alasdair G Kergon <agk@redhat.com> | 2005-07-12 18:53:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 19:19:10 -0400 |
commit | 436d41087d047b61f8ab0604dc74fff3240a8933 (patch) | |
tree | 46bab3a0cf02a7514b4faa5470a76326e6f8bc72 /drivers/md/dm.c | |
parent | a044d016896d2717694003f00d31a98194077511 (diff) |
[PATCH] device-mapper multipath: Avoid possible suspension deadlock
To avoid deadlock when suspending a multipath device after all its paths have
failed, stop queueing any I/O that is about to fail *before* calling
freeze_bdev instead of after.
Instead of setting a multipath 'suspended' flag which would have to be reset
if an error occurs during the process, save the previous queueing state and
leave userspace to restore if it wishes.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
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.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 5d40555b42ba..bb3ad79c14d7 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -1055,14 +1055,17 @@ int dm_suspend(struct mapped_device *md) | |||
1055 | if (test_bit(DMF_BLOCK_IO, &md->flags)) | 1055 | if (test_bit(DMF_BLOCK_IO, &md->flags)) |
1056 | goto out_read_unlock; | 1056 | goto out_read_unlock; |
1057 | 1057 | ||
1058 | error = __lock_fs(md); | ||
1059 | if (error) | ||
1060 | goto out_read_unlock; | ||
1061 | |||
1062 | map = dm_get_table(md); | 1058 | map = dm_get_table(md); |
1063 | if (map) | 1059 | if (map) |
1060 | /* This does not get reverted if there's an error later. */ | ||
1064 | dm_table_presuspend_targets(map); | 1061 | dm_table_presuspend_targets(map); |
1065 | 1062 | ||
1063 | error = __lock_fs(md); | ||
1064 | if (error) { | ||
1065 | dm_table_put(map); | ||
1066 | goto out_read_unlock; | ||
1067 | } | ||
1068 | |||
1066 | up_read(&md->lock); | 1069 | up_read(&md->lock); |
1067 | 1070 | ||
1068 | /* | 1071 | /* |
@@ -1121,7 +1124,6 @@ int dm_suspend(struct mapped_device *md) | |||
1121 | return 0; | 1124 | return 0; |
1122 | 1125 | ||
1123 | out_unfreeze: | 1126 | out_unfreeze: |
1124 | /* FIXME Undo dm_table_presuspend_targets */ | ||
1125 | __unlock_fs(md); | 1127 | __unlock_fs(md); |
1126 | clear_bit(DMF_BLOCK_IO, &md->flags); | 1128 | clear_bit(DMF_BLOCK_IO, &md->flags); |
1127 | out_write_unlock: | 1129 | out_write_unlock: |