The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.6.1.vz9.18.12
------>
commit 98f9ed8f27664b8578d6b529cb2872d272c98de6
Author: Nikolay Borisov <nikolay.bori...@virtuozzo.com>
Date:   Wed Feb 1 15:22:32 2023 +0200

    blk-cbt: Enable interrupts when unlocking in blk_cbt_update_size()
    
    blk_cbt_update_size() uses spin_lock_irq() to lock the cbt while pages
    are being copied and the new cbt is published at q->cbt.
    
    This lock is used to synchronize against blk_cbt_release(), which can be
    called within softirq context.
    
    Some calltrace from the internet which proves that blk_cbt_release() may be
    called from softirq context:
    
     blk_release_queue+0x90/0xf0
      kobject_cleanup+0x74/0x1cc
       kobject_put+0x5c/0x98
        blk_put_queue+0x20/0x2c
         blkg_free+0xc0/0xe8
          __blkg_release+0x98/0x140
           rcu_do_batch+0x1d4/0x4a4
            rcu_core+0x100/0x2fc
             rcu_core_si+0x1c/0x28
              __do_softirq+0xe8/0x344
    
    blk_cbt_release() is called by the blk_release_queue()
    which is the .release() callback of struct kobj_type.
    
    blk_cbt_update_size() function requires unlocking be done with
    spin_unlock_irq() so that interrupts are properly reenabled.
    Without this fix the core on which blk_cbt_update_size() run would end
    up with interrupts being disabled.
    
    Fixes: e69ca16f4135 ("cbt: introduce changed block tracking")
    
    Reported-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>
    Signed-off-by: Nikolay Borisov <nikolay.bori...@virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomi...@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 2fa19ba7630e..a7abf5b8c044 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -609,7 +609,7 @@ void blk_cbt_update_size(struct block_device *bdev)
        }
        rcu_assign_pointer(q->cbt, new);
        in_use = cbt->count;
-       spin_unlock(&cbt->lock);
+       spin_unlock_irq(&cbt->lock);
        if (!in_use)
                call_rcu(&cbt->rcu, &cbt_release_callback);
 err_mtx:
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to