block-6.13-20241228

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmdwJ8UQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpokHD/wN0fLwLNKF2WFCI/8VXxJ8wAQ4q61hrgKD
 PhqfIY+wsz8RnPnoma7aduVzh+JeDK2FurlMFDUXx/hSQI2CxFZHVFjdpAEcTu2z
 MHJ4xnRHR/XbfsmN3rfLgiKson15cQ7wC9IFUoM1fIDhosfWyt5vu7kvLTbLScql
 bfcoW3iBipLHOb7J272ZDjdD8QgLMtCOZ/o7/GTWZfw0ocei2xloCjg1Gxq6qCu0
 P+POptLQvqMrRwu+hG3Ff/svUM1zu36DfIXrJCrxsi1jV2kFTcXytTtNo6x7DsHR
 2gpKPs/v1TJQSMg7CHtTdPAK7o/7mjZxjTlRDMR95l+F4EEC7nVvi0D+ZaAcCznA
 d9oJ9QMGlB99blYN838o17v0K3shy1BhPJt9NO7jqbls/tD/i4U+wJfMWDjhK6oA
 xmNifLb4ecSTiCnGmOfLnCky4ELSpUoQMPg9vu/FtYd09dxHiUhx+8ZBkTQ7TXLT
 I5MDE+5fh36NaLzlyjJM1jxv5KNQSAd5Ow47zCejvjgvAtFJoEXpfQV7/2n3YYm7
 XVxBHhY/e/mXYCYAQ7hwTfQjIto7NurET0QX0LYpOHBpRLADf3okV0VA4jScwcRK
 SbMe5puCADCFEv1AUBVgs7HSUIo5yiXmBGko7MvHBIC3o7qedGc1YDEW4tYwQWDJ
 czYf97xi1Q==
 =HcC5
 -----END PGP SIGNATURE-----

Merge tag 'block-6.13-20241228' of git://git.kernel.dk/linux

Pull block fix from Jens Axboe:
 "Just a single fix for ublk setup error handling"

* tag 'block-6.13-20241228' of git://git.kernel.dk/linux:
  ublk: detach gendisk from ublk device if add_disk() fails
This commit is contained in:
Linus Torvalds 2024-12-28 11:02:35 -08:00
commit 059dd502b2

View File

@ -1618,6 +1618,21 @@ static void ublk_unquiesce_dev(struct ublk_device *ub)
blk_mq_kick_requeue_list(ub->ub_disk->queue);
}
static struct gendisk *ublk_detach_disk(struct ublk_device *ub)
{
struct gendisk *disk;
/* Sync with ublk_abort_queue() by holding the lock */
spin_lock(&ub->lock);
disk = ub->ub_disk;
ub->dev_info.state = UBLK_S_DEV_DEAD;
ub->dev_info.ublksrv_pid = -1;
ub->ub_disk = NULL;
spin_unlock(&ub->lock);
return disk;
}
static void ublk_stop_dev(struct ublk_device *ub)
{
struct gendisk *disk;
@ -1631,14 +1646,7 @@ static void ublk_stop_dev(struct ublk_device *ub)
ublk_unquiesce_dev(ub);
}
del_gendisk(ub->ub_disk);
/* Sync with ublk_abort_queue() by holding the lock */
spin_lock(&ub->lock);
disk = ub->ub_disk;
ub->dev_info.state = UBLK_S_DEV_DEAD;
ub->dev_info.ublksrv_pid = -1;
ub->ub_disk = NULL;
spin_unlock(&ub->lock);
disk = ublk_detach_disk(ub);
put_disk(disk);
unlock:
mutex_unlock(&ub->mutex);
@ -2336,7 +2344,7 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
out_put_cdev:
if (ret) {
ub->dev_info.state = UBLK_S_DEV_DEAD;
ublk_detach_disk(ub);
ublk_put_device(ub);
}
if (ret)