[Devel] [PATCH rh7 23/38] ploop: roll back alloc_head on ENOSPC

Andrey Smetanin asmetanin at virtuozzo.com
Fri May 15 09:48:24 PDT 2015


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 <MPatlasov at 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




More information about the Devel mailing list