[Devel] [PATCH] blk-cbt: Enable interrupts when unlocking in blk_cbt_update_size

Nikolay Borisov nikolay.borisov at virtuozzo.com
Wed Feb 1 16:22:32 MSK 2023


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. This 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.

Reported-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Signed-off-by: Nikolay Borisov <nikolay.borisov 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 32485c793484..083ed5785031 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -607,7 +607,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:
-- 
2.34.1



More information about the Devel mailing list