[Devel] [PATCH RHEL7 COMMIT] ploop: reloc vs extent_conversion race fix

Vladimir Davydov vdavydov at virtuozzo.com
Sun Jul 3 10:38:12 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.22
------>
commit bbc7ec7ef8492f736fa0cce85f4a609fb7cb80df
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Sun Jul 3 21:38:12 2016 +0400

    ploop: reloc vs extent_conversion race fix
    
    We have fixed most relocation bugs during fixing https://jira.sw.ru/browse/PSBM-47107
    
    Currently reloc_a looks like follows:
    
     1->read_data_from_old_post
     2->write_to_new_pos
        ->sumbit_alloc
          ->submit_pad
      ->post_submit->convert_unwritten
     3->update_index ->write_page with FLUSH|FUA
     4->nullify_old_pos
     5->issue_flush
    
    But on step 3 extent coversion is not yet stable because belongs to uncommitted
    transaction. We MUST call ->fsync inside ->post_sumit as we do for REQ_FUA
    requests. Let's tag relocatoin requests as FUA from very beginning in order to
    assert sync semantics.
    
    https://jira.sw.ru/browse/PSBM-49143
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 drivers/block/ploop/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 40768b6ef2c5..e5f010b9aeba 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4097,7 +4097,7 @@ static void ploop_relocate(struct ploop_device * plo)
 	preq->bl.tail = preq->bl.head = NULL;
 	preq->req_cluster = 0;
 	preq->req_size = 0;
-	preq->req_rw = WRITE_SYNC;
+	preq->req_rw = WRITE_SYNC|REQ_FUA;
 	preq->eng_state = PLOOP_E_ENTRY;
 	preq->state = (1 << PLOOP_REQ_SYNC) | (1 << PLOOP_REQ_RELOC_A);
 	preq->error = 0;
@@ -4401,7 +4401,7 @@ static void ploop_relocblks_process(struct ploop_device *plo)
 		preq->bl.tail = preq->bl.head = NULL;
 		preq->req_cluster = ~0U; /* uninitialized */
 		preq->req_size = 0;
-		preq->req_rw = WRITE_SYNC;
+		preq->req_rw = WRITE_SYNC|REQ_FUA;
 		preq->eng_state = PLOOP_E_ENTRY;
 		preq->state = (1 << PLOOP_REQ_SYNC) | (1 << PLOOP_REQ_RELOC_S);
 		preq->error = 0;


More information about the Devel mailing list