[Devel] [PATCH rh7 1/2] ploop: Flush data bios on merge before index update

Kirill Tkhai ktkhai at virtuozzo.com
Fri Feb 14 15:23:00 MSK 2020


Otherwise index becomes written before data cluster,
and zero data is seen after node crash.

https://jira.sw.ru/browse/PSBM-101510

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/map.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/map.c b/drivers/block/ploop/map.c
index ab2d4487d219..91e3762c691d 100644
--- a/drivers/block/ploop/map.c
+++ b/drivers/block/ploop/map.c
@@ -958,7 +958,7 @@ void ploop_index_update(struct ploop_request * preq)
 	preq->req_rw &= ~REQ_FLUSH;
 
 	/* Relocate requires consistent index update */
-	if (state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_S_FL)) {
+	if (state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_S_FL|PLOOP_REQ_MERGE_FL)) {
 		preq->req_index_update_rw |= (REQ_FLUSH | REQ_FUA);
 		do_fsync_if_delayed = 1;
 	}
@@ -1176,7 +1176,7 @@ static void map_wb_complete(struct map_node * m, int err)
 
 			state = READ_ONCE(preq->state);
 			/* Relocate requires consistent index update */
-			if (state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_S_FL)) {
+			if (state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_S_FL|PLOOP_REQ_MERGE_FL)) {
 				rw |= (REQ_FLUSH | REQ_FUA);
 				do_fsync_if_delayed = 1;
 			}




More information about the Devel mailing list