block: stack unplug
authorShaohua Li <shli@kernel.org>
Tue, 31 Jul 2012 07:08:15 +0000 (09:08 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 31 Jul 2012 07:08:15 +0000 (09:08 +0200)
MD raid1 prepares to dispatch request in unplug callback. If make_request in
low level queue also uses unplug callback to dispatch request, the low level
queue's unplug callback will not be called. Recheck the callback list helps
this case.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c

index 177ddcf356e6a2cf3dca8b86d5985c3461addade..35bf4fe8234ca32b136c55a4c2cd9339d0adfbf9 100644 (file)
@@ -2913,17 +2913,16 @@ static void flush_plug_callbacks(struct blk_plug *plug)
 {
        LIST_HEAD(callbacks);
 
-       if (list_empty(&plug->cb_list))
-               return;
-
-       list_splice_init(&plug->cb_list, &callbacks);
+       while (!list_empty(&plug->cb_list)) {
+               list_splice_init(&plug->cb_list, &callbacks);
 
-       while (!list_empty(&callbacks)) {
-               struct blk_plug_cb *cb = list_first_entry(&callbacks,
+               while (!list_empty(&callbacks)) {
+                       struct blk_plug_cb *cb = list_first_entry(&callbacks,
                                                          struct blk_plug_cb,
                                                          list);
-               list_del(&cb->list);
-               cb->callback(cb);
+                       list_del(&cb->list);
+                       cb->callback(cb);
+               }
        }
 }