ploop: Fix locking imballance

Submitted by Kirill Tkhai on April 16, 2019, 10:57 a.m.

Details

Message ID 155541222101.18535.13800394702320095037.stgit@localhost.localdomain
State New
Series "ploop: Fix locking imballance"
Headers show

Commit Message

Kirill Tkhai April 16, 2019, 10:57 a.m.
Move file_start_write() up.

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

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

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 9fd2075661ad..43e3dcdcd969 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -401,14 +401,14 @@  cached_submit(struct ploop_io *io, iblock_t iblk, struct ploop_request * preq,
 	used_pos = (loff_t)(io->alloc_head - 1) << (io->plo->cluster_log + 9);
 	reusing = (end_pos <= used_pos);
 
+	file_start_write(io->files.file);
+
 	if (reusing) {
 		/* Reusing a hole */
 		prealloc = clu_siz;
 		goto try_again;
 	}
 
-	file_start_write(io->files.file);
-
 	if (use_prealloc && (end_pos > used_pos) && may_fallocate) {
 		if (unlikely(io->prealloced_size < used_pos + clu_siz)) {
 			prealloc = end_pos;