]> git.karo-electronics.de Git - karo-tx-linux.git/commit
A deadlock was found in the prefetch code in the dm verity map
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 18 Mar 2013 22:57:27 +0000 (09:57 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Mar 2013 22:57:27 +0000 (09:57 +1100)
commit6bf3df3a6890c5224dff8d12b2e09b19428d3cf1
tree3da28b7a3cf8b79b7c48b3875b8483c9de2b2060
parenta66c52b50ee88c48e1bdc93803eaaf2f77d99321
A deadlock was found in the prefetch code in the dm verity map
function.  This patch fixes this by transferring the prefetch
to a worker thread and skipping it completely if kmalloc fails.

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 occurs when one thread grabs the bufio_client
mutex and waits for an I/O to complete but the I/O is queued
on another thread's current->bio_list and is waiting to get
the mutex held by the first thread.

The fix recognises that prefetching is not essential.  If memory
can be allocated, it queues the prefetch request to the worker thread,
but if not, it does nothing.

Signed-off-by: Paul Taysom <taysom@chromium.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: stable@kernel.org
drivers/md/dm-bufio.c
drivers/md/dm-verity.c