Skip to content

Commit 75f5f23

Browse files
committed
Merge tag 'block-6.16-20250619' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: - Two fixes for aoe which fixes issues dating back to when this driver was converted to blk-mq - Fix for ublk, checking for valid queue depth and count values before setting up a device * tag 'block-6.16-20250619' of git://git.kernel.dk/linux: ublk: santizize the arguments from userspace when adding a device aoe: defer rexmit timer downdev work to workqueue aoe: clean device rq_list in aoedev_downdev()
2 parents 255da9b + 8c84728 commit 75f5f23

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

drivers/block/aoe/aoe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ enum {
8080
DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
8181
DEVFL_FREEING = (1<<7), /* set when device is being cleaned up */
8282
DEVFL_FREED = (1<<8), /* device has been cleaned up */
83+
DEVFL_DEAD = (1<<9), /* device has timed out of aoe_deadsecs */
8384
};
8485

8586
enum {

drivers/block/aoe/aoecmd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ rexmit_timer(struct timer_list *timer)
754754

755755
utgts = count_targets(d, NULL);
756756

757-
if (d->flags & DEVFL_TKILL) {
757+
if (d->flags & (DEVFL_TKILL | DEVFL_DEAD)) {
758758
spin_unlock_irqrestore(&d->lock, flags);
759759
return;
760760
}
@@ -786,7 +786,8 @@ rexmit_timer(struct timer_list *timer)
786786
* to clean up.
787787
*/
788788
list_splice(&flist, &d->factive[0]);
789-
aoedev_downdev(d);
789+
d->flags |= DEVFL_DEAD;
790+
queue_work(aoe_wq, &d->work);
790791
goto out;
791792
}
792793

@@ -898,6 +899,9 @@ aoecmd_sleepwork(struct work_struct *work)
898899
{
899900
struct aoedev *d = container_of(work, struct aoedev, work);
900901

902+
if (d->flags & DEVFL_DEAD)
903+
aoedev_downdev(d);
904+
901905
if (d->flags & DEVFL_GDALLOC)
902906
aoeblk_gdalloc(d);
903907

drivers/block/aoe/aoedev.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ aoedev_downdev(struct aoedev *d)
198198
{
199199
struct aoetgt *t, **tt, **te;
200200
struct list_head *head, *pos, *nx;
201+
struct request *rq, *rqnext;
201202
int i;
203+
unsigned long flags;
202204

203-
d->flags &= ~DEVFL_UP;
205+
spin_lock_irqsave(&d->lock, flags);
206+
d->flags &= ~(DEVFL_UP | DEVFL_DEAD);
207+
spin_unlock_irqrestore(&d->lock, flags);
204208

205209
/* clean out active and to-be-retransmitted buffers */
206210
for (i = 0; i < NFACTIVE; i++) {
@@ -223,6 +227,13 @@ aoedev_downdev(struct aoedev *d)
223227
/* clean out the in-process request (if any) */
224228
aoe_failip(d);
225229

230+
/* clean out any queued block requests */
231+
list_for_each_entry_safe(rq, rqnext, &d->rq_list, queuelist) {
232+
list_del_init(&rq->queuelist);
233+
blk_mq_start_request(rq);
234+
blk_mq_end_request(rq, BLK_STS_IOERR);
235+
}
236+
226237
/* fast fail all pending I/O */
227238
if (d->blkq) {
228239
/* UP is cleared, freeze+quiesce to insure all are errored */

drivers/block/ublk_drv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,6 +2825,9 @@ static int ublk_ctrl_add_dev(const struct ublksrv_ctrl_cmd *header)
28252825
if (copy_from_user(&info, argp, sizeof(info)))
28262826
return -EFAULT;
28272827

2828+
if (info.queue_depth > UBLK_MAX_QUEUE_DEPTH || info.nr_hw_queues > UBLK_MAX_NR_QUEUES)
2829+
return -EINVAL;
2830+
28282831
if (capable(CAP_SYS_ADMIN))
28292832
info.flags &= ~UBLK_F_UNPRIVILEGED_DEV;
28302833
else if (!(info.flags & UBLK_F_UNPRIVILEGED_DEV))

0 commit comments

Comments
 (0)