[Devel] [PATCH RHEL8 COMMIT] ploop: Make ploop_push_backup_read() not warn in case of two threads call it
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Oct 25 17:24:59 MSK 2019
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.3
------>
commit 56b830960b730e0d0da7372dee9c10563310232e
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Fri Oct 25 17:24:57 2019 +0300
ploop: Make ploop_push_backup_read() not warn in case of two threads call it
In case of parallel thread picked h up, the list may be empty.
Do not warn in this case.
Fixes: 9c8c97ee9860 ("ploop: Sleepable push_backup_read")
Reported-by: Konstantin Khorenko <khorenko at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-cmd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 145dabbac7d6..c45c2106c387 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -1445,13 +1445,16 @@ static int ploop_push_backup_read(struct ploop *ploop, char *uuid,
return -EINVAL;
if (!pb->alive)
return -ESTALE;
+again:
if (wait_event_interruptible(pb->wq, !list_empty_careful(&pb->pending)))
return -EINTR;
spin_lock_irq(&ploop->pb_lock);
h = orig_h = list_first_entry_or_null(&pb->pending, typeof(*h), list);
- if (WARN_ON_ONCE(!h))
- goto unlock;
+ if (unlikely(!h)) {
+ spin_unlock_irq(&ploop->pb_lock);
+ goto again;
+ }
list_del_init(&h->list);
left = right = h->cluster;
@@ -1473,7 +1476,6 @@ static int ploop_push_backup_read(struct ploop *ploop, char *uuid,
}
DMEMIT("%u:%u", left, right - left + 1);
-unlock:
spin_unlock_irq(&ploop->pb_lock);
return ret;
}
More information about the Devel
mailing list