percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask
authorKent Overstreet <kmo@daterainc.com>
Sun, 19 Jan 2014 08:26:37 +0000 (08:26 +0000)
committerNicholas Bellinger <nab@linux-iscsi.org>
Thu, 23 Jan 2014 20:17:18 +0000 (20:17 +0000)
commit6f6b5d1ec56acdeab0503d2b823f6f88a0af493e
tree7a95dca01cc9ddd652ccbfba4df9d5c30abda549
parent4a4caa29f1abcb14377e05d57c0793d338fb945d
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>
block/blk-mq-tag.c
drivers/target/iscsi/iscsi_target_util.c
drivers/target/tcm_fc/tfc_cmd.c
drivers/vhost/scsi.c
include/linux/percpu_ida.h
lib/percpu_ida.c