[RHEL8,COMMIT] cbt: Move cbt_flush_cache() before size calculation

Submitted by Konstantin Khorenko on Dec. 10, 2019, 3:48 p.m.

Details

Message ID 201912101548.xBAFmtlM024359@finist_co8.work.ct
State New
Series "cbt: Move cbt_flush_cache() before size calculation"
Headers show

Commit Message

Konstantin Khorenko Dec. 10, 2019, 3:48 p.m.
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.6
------>
commit b9a0642e693d04884697a49ae4abc232c1eba2f7
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Tue Dec 10 18:48:31 2019 +0300

    cbt: Move cbt_flush_cache() before size calculation
    
    Flush cpu caches before searching of last bit,
    otherwise we may miss some set bits.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 block/blk-cbt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index dddac68b61b4..171d3b5869b4 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -407,14 +407,14 @@  static int blk_cbt_snap_create(struct request_queue *q, __u8 *uuid,
 		return -EBUSY;
 	}
 
+	cbt_flush_cache(cbt);
+
 	size = map_required_size(cbt->map, cbt->block_max);
 	if (to_size < size) {
 		mutex_unlock(&cbt_mutex);
 		return -EFBIG;
 	}
 
-	cbt_flush_cache(cbt);
-
 	npages = NR_PAGES(cbt->block_max);
 	map = vmalloc(npages * sizeof(void*));
 	if (!map)