From: Mikulas Patocka Date: Thu, 2 Apr 2009 18:55:38 +0000 (+0100) Subject: dm: allow uninterruptible wait for pending io X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=401600dfd368305e641d79db16d514f55c084544;p=linux-beck.git 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: Mikulas Patocka Signed-off-by: Alasdair G Kergon --- diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 4ba0811f28c5..ae21833b270a 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1375,18 +1375,19 @@ void dm_put(struct mapped_device *md) } 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; while (1) { - set_current_state(TASK_INTERRUPTIBLE); + set_current_state(interruptible); smp_mb(); if (!atomic_read(&md->pending)) break; - if (signal_pending(current)) { + if (interruptible == TASK_INTERRUPTIBLE && + signal_pending(current)) { r = -EINTR; break; } @@ -1565,7 +1566,7 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags) /* * 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); remove_wait_queue(&md->wait, &wait);