]> git.baikalelectronics.ru Git - kernel.git/commit
drbd: add drbd_queue_work_if_unqueued helper
authorLars Ellenberg <lars.ellenberg@linbit.com>
Mon, 28 Apr 2014 09:43:21 +0000 (11:43 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Jul 2014 16:35:07 +0000 (18:35 +0200)
commite640419adc9650f81b1f4f2699750f5fed3c01b4
treed8050e5998e46e3f6f541b3941dd727714ae07ba
parent4ecfbcbb38c061a441c88730917e37e4d33e4ef4
drbd: add drbd_queue_work_if_unqueued helper

We sometimes do
    if (list_empty(&w.list))
drbd_queue_work(&q, &w.list);

Removal (list_del_init) may happen outside all locks, after all
pending work entries have been moved to an on-stack local work list.

For not dynamically allocated, but embeded, work structs,
we must avoid to re-add until it really was removed.

Move that list_empty check inside the spin_lock(&q->q_lock)
within the helper function, and change to list_empty_careful().

This may have been the reason for a list_add corruption
inside drbd_queue_work().

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_worker.c