FYI, this nbd bugfix just went into mainline. Details below.

--
Paul

---------- Forwarded message ----------
From:  <[email protected]>
Date: Tue, Sep 18, 2012 at 3:04 PM
Subject: [merged] nbd-clear-waiting_queue-on-shutdown.patch removed
from -mm tree
To: [email protected], [email protected],
[email protected]



The patch titled
     Subject: nbd: clear waiting_queue on shutdown
has been removed from the -mm tree.  Its filename was
     nbd-clear-waiting_queue-on-shutdown.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Paul Clements <[email protected]>
Subject: 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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 drivers/block/nbd.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff -puN drivers/block/nbd.c~nbd-clear-waiting_queue-on-shutdown
drivers/block/nbd.c
--- a/drivers/block/nbd.c~nbd-clear-waiting_queue-on-shutdown
+++ a/drivers/block/nbd.c
@@ -449,6 +449,14 @@ static void nbd_clear_que(struct nbd_dev
                req->errors++;
                nbd_end_request(req);
        }
+
+       while (!list_empty(&nbd->waiting_queue)) {
+               req = list_entry(nbd->waiting_queue.next, struct request,
+                                queuelist);
+               list_del_init(&req->queuelist);
+               req->errors++;
+               nbd_end_request(req);
+       }
 }


@@ -598,6 +606,7 @@ static int __nbd_ioctl(struct block_devi
                nbd->file = NULL;
                nbd_clear_que(nbd);
                BUG_ON(!list_empty(&nbd->queue_head));
+               BUG_ON(!list_empty(&nbd->waiting_queue));
                if (file)
                        fput(file);
                return 0;
_

Patches currently in -mm which might be from [email protected] are

origin.patch
nbd-add-set-flags-ioctl.patch
nbd-handle-discard-requests.patch

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to