提交 401600df 编写于 作者: M Mikulas Patocka 提交者: Alasdair G Kergon

dm: allow uninterruptible wait for pending io

Allow uninterruptible wait for pending IOs.

Add argument "interruptible" to dm_wait_for_completion that specifies
either interruptible or uninterruptible waiting.
Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 ef208587
...@@ -1375,18 +1375,19 @@ void dm_put(struct mapped_device *md) ...@@ -1375,18 +1375,19 @@ void dm_put(struct mapped_device *md)
} }
EXPORT_SYMBOL_GPL(dm_put); EXPORT_SYMBOL_GPL(dm_put);
static int dm_wait_for_completion(struct mapped_device *md) static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
{ {
int r = 0; int r = 0;
while (1) { while (1) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(interruptible);
smp_mb(); smp_mb();
if (!atomic_read(&md->pending)) if (!atomic_read(&md->pending))
break; break;
if (signal_pending(current)) { if (interruptible == TASK_INTERRUPTIBLE &&
signal_pending(current)) {
r = -EINTR; r = -EINTR;
break; break;
} }
...@@ -1565,7 +1566,7 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags) ...@@ -1565,7 +1566,7 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
/* /*
* Wait for the already-mapped ios to complete. * Wait for the already-mapped ios to complete.
*/ */
r = dm_wait_for_completion(md); r = dm_wait_for_completion(md, TASK_INTERRUPTIBLE);
down_write(&md->io_lock); down_write(&md->io_lock);
remove_wait_queue(&md->wait, &wait); remove_wait_queue(&md->wait, &wait);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册