blk-mq: fix sbitmap ws_active for shared tags
authorJens Axboe <axboe@kernel.dk>
Mon, 25 Mar 2019 18:34:10 +0000 (12:34 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Mar 2019 19:05:47 +0000 (13:05 -0600)
commite861857545567adec8da3bdff728efdf7db12285
tree71572b52d87ba2421159bf6ee70c85708878be44
parent9e75ad5d8f399a21c86271571aa630dd080223e2
blk-mq: fix sbitmap ws_active for shared tags

We now wrap sbitmap waitqueues in an active counter, so we can avoid
iterating wakeups unless we have waiters there. This works as long as
everyone that's manipulating the waitqueues use the proper helpers. For
the tag wait case for shared tags, however, we add ourselves to the
waitqueue without incrementing/decrementing the ->ws_active count. This
means that wakeups can take a long time to happen.

Fix this by manually doing the inc/dec as needed for the wait queue
handling.

Reported-by: Michael Leun <kbug@newton.leun.net>
Tested-by: Michael Leun <kbug@newton.leun.net>
Cc: stable@vger.kernel.org
Reviewed-by: Omar Sandoval <osandov@fb.com>
Fixes: 5d2ee7122c73 ("sbitmap: optimize wakeup check")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c