In case we do not refill, we can overwrite cur pointer from prio_head
by one from not prioritized head, what looks as something that was
not intended.
This change make we always take works from prio_head first until it's
not empty.
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Josef Bacik <jbacik@fb.com>
struct btrfs_work *work = NULL;
struct list_head *cur = NULL;
- if (!list_empty(prio_head))
+ if (!list_empty(prio_head)) {
cur = prio_head->next;
+ goto out;
+ }
smp_mb();
if (!list_empty(&worker->prio_pending))
goto refill;
- if (!list_empty(head))
+ if (!list_empty(head)) {
cur = head->next;
-
- if (cur)
goto out;
+ }
refill:
spin_lock_irq(&worker->lock);