[Devel] [PATCH RHEL7 COMMIT] ploop: Handle map_index error in ploop_index_wb_proceed()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 3 17:03:00 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.161.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.161.5
------>
commit 3b5617f687bb3c172fba3207a7c0b926d1338825
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Jun 3 17:02:59 2020 +0300

    ploop: Handle map_index error in ploop_index_wb_proceed()
    
    ->map_index can fail (though, the probability is very low).
    Handle this.
    
    https://jira.sw.ru/browse/PSBM-104572
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/map.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/map.c b/drivers/block/ploop/map.c
index 6276fb9ec4147..460fa4f37a23c 100644
--- a/drivers/block/ploop/map.c
+++ b/drivers/block/ploop/map.c
@@ -855,14 +855,19 @@ void ploop_index_wb_proceed(struct ploop_request * preq)
 	struct page * page = preq->sinfo.wi.tpage;
 	unsigned long rw = preq->req_index_update_rw;
 	sector_t sec;
+	int ret;
 
 	preq->eng_state = PLOOP_E_INDEX_WB;
 
-	top_delta->ops->map_index(top_delta, m->mn_start, &sec);
+	ret = top_delta->ops->map_index(top_delta, m->mn_start, &sec);
+	if (ret == 0) {
+		PLOOP_FAIL_REQUEST(preq, -EINVAL);
+		goto out;
+	}
 
 	__TRACE("wbi-proceed %p %u %p\n", preq, preq->req_cluster, m);
 	top_delta->io.ops->write_page(&top_delta->io, preq, page, sec, rw);
-
+out:
 	put_page(page);
 }
 


More information about the Devel mailing list