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

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jun 2 12:50:23 MSK 2020


->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 6276fb9ec414..460fa4f37a23 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