]> git.karo-electronics.de Git - karo-tx-linux.git/commit
nbd: clear waiting_queue on shutdown
authorPaul Clements <paul.clements@steeleye.com>
Fri, 7 Sep 2012 00:17:44 +0000 (10:17 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Sep 2012 05:36:00 +0000 (15:36 +1000)
commit0478e38a61bbdf9f4520eec03bf9330b721871fd
treea35a523ba19f10c613f8cd03ba2cad9e54eb5df4
parent7b7bb07d8ce70dde1c2ed9fb4b232188e52f8e6c
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