CHROMIUM: md: dm-verity: Fix to avoid a deadlock in dm-bufio
Changed the dm-verity prefetching to use a worker thread to avoid
a deadlock in dm-bufio.
If generic_make_request is called recursively, it queues the I/O
request on the current->bio_list without making the I/O request
and returns. The routine making the recursive call cannot wait
for the I/O to complete.
The deadlock occurred when one thread grabbed the bufio_client
mutex and waited for an I/O to complete but the I/O was queued
on another thread's current->bio_list and it was waiting to get
the mutex held by the first thread.
The fix allows only one I/O request from dm-verity to dm-bufio
per thread. To do this, the prefetch requests were queued on worker
threads.
In addition to avoiding the deadlock, this fix made a slight
improvement in performance.
seconds_kernel_to_login:
with prefetch: 8.43s
without prefetch: 9.2s
worker prefetch: 8.28s
BUG=chromium-os:39148
TEST=./run_remote_tests.sh --board=$B --remote=$IP suite:smoke
Signed-off-by: Paul Taysom <taysom@chromium.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@kernel.org
Change-Id: I5f3cddfed507abfb8198fee71e713495f076b772
Reviewed-on: https://gerrit.chromium.org/gerrit/42422
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>