Skip to content

Commit f4ca523

Browse files
committed
Merge branch 'for-6.17/block' into for-next
* for-6.17/block: nbd: fix lockdep deadlock warning
2 parents 33d379b + 8b428f4 commit f4ca523

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/block/nbd.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,17 @@ static int nbd_start_device(struct nbd_device *nbd)
14731473
return -EINVAL;
14741474
}
14751475

1476-
blk_mq_update_nr_hw_queues(&nbd->tag_set, config->num_connections);
1476+
retry:
1477+
mutex_unlock(&nbd->config_lock);
1478+
blk_mq_update_nr_hw_queues(&nbd->tag_set, num_connections);
1479+
mutex_lock(&nbd->config_lock);
1480+
1481+
/* if another code path updated nr_hw_queues, retry until succeed */
1482+
if (num_connections != config->num_connections) {
1483+
num_connections = config->num_connections;
1484+
goto retry;
1485+
}
1486+
14771487
nbd->pid = task_pid_nr(current);
14781488

14791489
nbd_parse_flags(nbd);

0 commit comments

Comments
 (0)