[Devel] [PATCH RHEL7 COMMIT] ploop: roll back alloc_head on ENOSPC

Konstantin Khorenko khorenko at odin.com
Mon May 18 21:27:08 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.1
------>
commit ca3be1904fc3f2542497c6e15842f6684173a18f
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date:   Tue May 19 08:27:08 2015 +0400

    ploop: roll back alloc_head on ENOSPC
    
    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;
 }
 



More information about the Devel mailing list