dm: use signal_pending_state() in dm_wait_for_completion()
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 31 Aug 2016 22:16:22 +0000 (15:16 -0700)
committerMike Snitzer <snitzer@redhat.com>
Wed, 14 Sep 2016 17:56:38 +0000 (13:56 -0400)
Use signal_pending_state() instead of open-coding it.  This patch does
not change any functionality but makes it possible to pass TASK_KILLABLE
as the second argument of dm_wait_for_completion().  See also commit
16882c1e962b ("sched: fix TASK_WAKEKILL vs SIGKILL race").

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c

index 4aaffe05de9452920e4424adff7e410acf8c807a..6678cb2c2138961102c7840e262df62f1028cd32 100644 (file)
@@ -1954,8 +1954,7 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)
                if (!md_in_flight(md))
                        break;
 
-               if (task_state == TASK_INTERRUPTIBLE &&
-                   signal_pending(current)) {
+               if (signal_pending_state(task_state, current)) {
                        r = -EINTR;
                        break;
                }