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

Submitted by Konstantin Khorenko on June 3, 2020, 2:03 p.m.

Details

Message ID 202006031403.053E30YU030935@finist-ce7.sw.ru
State New
Series "ploop: Handle map_index error in ploop_index_wb_proceed()"
Headers show

Commit Message

Konstantin Khorenko June 3, 2020, 2:03 p.m.
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@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@virtuozzo.com>
---
 drivers/block/ploop/map.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);
 }