[RHEL7,COMMIT] ploop: Flush data bios on merge before index update

Submitted by Kirill Tkhai on Feb. 19, 2020, 3:06 p.m.

Details

Message ID 202002191506.01JF6oSi370355@localhost.localdomain
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Feb. 19, 2020, 3:06 p.m.
The commit is pushed to "branch-rh7-3.10.0-1062.12.1.vz7.131.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.12.1.vz7.131.3
------>
commit c6ec01d2daa6c7bda64d02be4200614b91f4eeee
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Wed Feb 19 15:06:50 2020 +0000

    ploop: Flush data bios on merge before index update
    
    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 ab2d448..91e3762 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;
 			}