]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
nbd: clear waiting_queue on shutdown
authorPaul Clements <paul.clements@steeleye.com>
Thu, 13 Sep 2012 00:58:09 +0000 (10:58 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 13 Sep 2012 07:27:36 +0000 (17:27 +1000)
commit8946be53236e482f95770f483b5ba182b075cc9b
tree839a2a7237dcd805bfa8f3f8d759c6ee57377205
parent98368ac5cc1670d9861b615b2b366a3d2e2976ea
nbd: clear waiting_queue on shutdown

Fix a serious but uncommon bug in nbd which occurs when there is heavy I/O
going to the nbd device while, at the same time, a failure (server,
network) or manual disconnect of the nbd connection occurs.

There is a small window between the time that the nbd_thread is stopped
and the socket is shutdown where requests can continue to be queued to
nbd's internal waiting_queue.  When this happens, those requests are never
completed or freed.

The fix is to clear the waiting_queue on shutdown of the nbd device, in
the same way that the nbd request queue (queue_head) is already being cleared.

Signed-off-by: Paul Clements <paul.clements@steeleye.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/nbd.c