percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask
authorKent Overstreet <kmo@daterainc.com>
Tue, 18 Feb 2014 17:16:37 +0000 (09:16 -0800)
committerJens Axboe <axboe@fb.com>
Mon, 30 Mar 2015 18:54:41 +0000 (12:54 -0600)
commitbe54811a102ee61bda0b7490f8f2237bfc3ada79
tree298dbb89145fd9ba4a6f6d8b57c2bcae161de0b5
parentebb291ff731cb1d2acb279fec3757750ae09717e
percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask

This patch changes percpu_ida_alloc() + callers to accept task state
bitmask for prepare_to_wait() for code like target/iscsi that needs
it for interruptible sleep, that is provided in a subsequent patch.

It now expects TASK_UNINTERRUPTIBLE when the caller is able to sleep
waiting for a new tag, or TASK_RUNNING when the caller cannot sleep,
and is forced to return a negative value when no tags are available.

v2 changes:
  - Include blk-mq + tcm_fc + vhost/scsi + target/iscsi changes
  - Drop signal_pending_state() call
v3 changes:
  - Only call prepare_to_wait() + finish_wait() when != TASK_RUNNING
    (PeterZ)

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: <stable@vger.kernel.org> #3.12+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-tag.c
include/linux/percpu_ida.h
lib/percpu_ida.c