[Devel] [PATCH RHEL7 COMMIT] ploop: push_backup: ploop_pb_get_pending should wait again instead of ENOENT

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 21 11:35:45 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.12
------>
commit fdb5a434d54c27cbb56954febe7a615b143e040f
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Fri Jul 21 12:35:45 2017 +0400

    ploop: push_backup: ploop_pb_get_pending should wait again instead of ENOENT
    
    The patch fixes a race when ploop_pb_get_pending was rightly woken up
    to pass an extent to userspace, but before it re-acquire pbd->ppb_lock
    another thread of vz_backup_agent reports exactly this extent as processed.
    
    This effectively steals the extent from ploop_pb_get_pending, so it fails
    to get a preq from ploop_pb_get_first_reqs_from_pending(). Before the patch,
    the kernel returned ENOENT to userspace confusing vz_backup_agent. So far
    as the race happens in kernel and userspace cannot control it, let's retry
    in kernel.
    
    https://jira.sw.ru/browse/PSBM-68608
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 drivers/block/ploop/push_backup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/push_backup.c b/drivers/block/ploop/push_backup.c
index 032706e..d92b93c 100644
--- a/drivers/block/ploop/push_backup.c
+++ b/drivers/block/ploop/push_backup.c
@@ -803,6 +803,7 @@ int ploop_pb_get_pending(struct ploop_pushbackup_desc *pbd,
 			err = -EBUSY;
 			goto get_pending_unlock;
 		}
+wait_again:
 		pbd->ppb_waiting = true;
 		spin_unlock_irq(&pbd->ppb_lock);
 
@@ -825,7 +826,8 @@ int ploop_pb_get_pending(struct ploop_pushbackup_desc *pbd,
 				err =  -ESTALE;
 			else if (signal_pending(current))
 				err = -ERESTARTSYS;
-			else err = -ENOENT;
+			else
+				goto wait_again;
 
 			goto get_pending_unlock;
 		}


More information about the Devel mailing list