[RHEL7,COMMIT] ploop: Fix locking imballance

Submitted by Konstantin Khorenko on April 16, 2019, 11:08 a.m.

Details

Message ID 201904161108.x3GB8J0C013708@finist-ce7.sw.ru
State New
Series "ploop: Fix locking imballance"
Headers show

Commit Message

Konstantin Khorenko April 16, 2019, 11:08 a.m.
The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.94.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.94.14
------>
commit c6aa2b675fe941ece29d82b2fcc00d7b81851fe8
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Tue Apr 16 14:08:19 2019 +0300

    ploop: Fix locking imballance
    
    Move file_start_write() up.
    
    Fixes: 6b526783df00 ("ploop: Fallocate cluster in cached_submit() during hole
    reuse")
    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;