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

Submitted by Kirill Tkhai on Feb. 14, 2020, 12:23 p.m.

Details

Message ID 158168293164.795662.2089995968249584273.stgit@localhost.localdomain
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Feb. 14, 2020, 12:23 p.m.
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@virtuozzo.com>
---
 drivers/block/ploop/map.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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