[Devel] [PATCH RHEL7 COMMIT] cbt: blk_cbt_update_size() must return if cbt->block_max not changed

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 9 01:42:56 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.13
------>
commit e60b95961323b14d74d2effeeb43b490bd5ecd1a
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Thu Jun 9 12:42:56 2016 +0400

    cbt: blk_cbt_update_size() must return if cbt->block_max not changed
    
    It's useless to recreate cbt every time as we called for the same
    block-device size. Actually, it's worthy only if cbt->block_max
    increases.
    
    Since commit b8e560a299 (fix cbt->block_max calculation), we calculate
    cbt->block_max precisely:
    
    >       cbt->block_max  = (size + blocksize - 1) >> cbt->block_bits;
    
    Hence, the following check:
    
    	if ((new_sz + bsz) >> cbt->block_bits <= cbt->block_max)
    		goto err_mtx;
    
    must be corrected accordingly.
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at virtuozzo.com>
---
 block/blk-cbt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index 3a2b197..4f2ce26 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -440,7 +440,7 @@ void blk_cbt_update_size(struct block_device *bdev)
 		return;
 	}
 	bsz = 1 << cbt->block_bits;
-	if ((new_sz + bsz) >> cbt->block_bits <= cbt->block_max)
+	if ((new_sz + bsz - 1) >> cbt->block_bits <= cbt->block_max)
 		goto err_mtx;
 
 	new = do_cbt_alloc(q, cbt->uuid, new_sz, bsz);


More information about the Devel mailing list