The first thing dio_submit_alloc() does is incrementing io->alloc_head. In case
of errors it doesn't roll back io->alloc_head becuase ploop will go to
"aborted" state anyway and any write requests will fail immediately.

But there is one exception: in case of ENOSPC, dio_submit_alloc() must
decrement io->alloc_head back because ploop handles ENOSPC in a special way
(by freezing operations until some space emerges).

https://jira.sw.ru/browse/PSBM-24694

Signed-off-by: Maxim Patlasov <mpatla...@parallels.com>
---
 drivers/block/ploop/io_direct.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index e5eb66a..5e2e078 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -683,8 +683,11 @@ dio_submit_alloc(struct ploop_io *io, struct ploop_request 
* preq,
        }
 
        err = cached_submit(io, iblk, preq, sbl, size);
-       if (err)
+       if (err) {
+               if (err == -ENOSPC)
+                       io->alloc_head--;
                ploop_fail_request(preq, err);
+       }
        preq->eng_state = PLOOP_E_DATA_WBI;
 }
 
-- 
1.9.3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to