[Devel] [PATCH vz9 v1 62/63] dm-ploop: fix locks used in mixed context
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Fri Jan 24 18:36:36 MSK 2025
These locks are used in both interrupt and user context so we must
preserve interrupts state.
https://virtuozzo.atlassian.net/browse/VSTOR-98471
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index a47341f40627..c6c46b49bccf 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1408,6 +1408,7 @@ static void ploop_check_standby_mode(struct ploop *ploop, long res)
{
struct request_queue *q = ploop_blk_queue(ploop);
int prev;
+ unsigned long flags;
if (!blk_queue_standby_en(q))
return;
@@ -1416,9 +1417,9 @@ static void ploop_check_standby_mode(struct ploop *ploop, long res)
if (res != -EBUSY && res != -ENOTCONN && res != -EIO)
return;
- spin_lock_irq(&q->queue_lock);
+ spin_lock_irqsave(&q->queue_lock, flags);
prev = blk_queue_flag_test_and_set(QUEUE_FLAG_STANDBY, q);
- spin_unlock_irq(&q->queue_lock);
+ spin_unlock_irqrestore(&q->queue_lock, flags);
if (!prev)
PL_INFO("was switched into the standby mode");
@@ -1540,12 +1541,13 @@ static bool ploop_postpone_if_cluster_locked(struct ploop *ploop,
struct pio *pio, u32 clu)
{
struct pio *e_h; /* Exclusively locked */
+ unsigned long flags;
- spin_lock_irq(&ploop->deferred_lock);
+ spin_lock_irqsave(&ploop->deferred_lock, flags);
e_h = ploop_find_lk_of_cluster(ploop, clu);
if (e_h && pio)
ploop_add_endio_pio(e_h, pio);
- spin_unlock_irq(&ploop->deferred_lock);
+ spin_unlock_irqrestore(&ploop->deferred_lock, flags);
return e_h != NULL;
}
--
2.43.0
More information about the Devel
mailing list