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()
This commit is contained in:
@@ -80,6 +80,7 @@ enum {
|
||||
DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
|
||||
DEVFL_FREEING = (1<<7), /* set when device is being cleaned up */
|
||||
DEVFL_FREED = (1<<8), /* device has been cleaned up */
|
||||
DEVFL_DEAD = (1<<9), /* device has timed out of aoe_deadsecs */
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
@@ -754,7 +754,7 @@ rexmit_timer(struct timer_list *timer)
|
||||
|
||||
utgts = count_targets(d, NULL);
|
||||
|
||||
if (d->flags & DEVFL_TKILL) {
|
||||
if (d->flags & (DEVFL_TKILL | DEVFL_DEAD)) {
|
||||
spin_unlock_irqrestore(&d->lock, flags);
|
||||
return;
|
||||
}
|
||||
@@ -786,7 +786,8 @@ rexmit_timer(struct timer_list *timer)
|
||||
* to clean up.
|
||||
*/
|
||||
list_splice(&flist, &d->factive[0]);
|
||||
aoedev_downdev(d);
|
||||
d->flags |= DEVFL_DEAD;
|
||||
queue_work(aoe_wq, &d->work);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -898,6 +899,9 @@ aoecmd_sleepwork(struct work_struct *work)
|
||||
{
|
||||
struct aoedev *d = container_of(work, struct aoedev, work);
|
||||
|
||||
if (d->flags & DEVFL_DEAD)
|
||||
aoedev_downdev(d);
|
||||
|
||||
if (d->flags & DEVFL_GDALLOC)
|
||||
aoeblk_gdalloc(d);
|
||||
|
||||
|
||||
@@ -198,9 +198,13 @@ aoedev_downdev(struct aoedev *d)
|
||||
{
|
||||
struct aoetgt *t, **tt, **te;
|
||||
struct list_head *head, *pos, *nx;
|
||||
struct request *rq, *rqnext;
|
||||
int i;
|
||||
unsigned long flags;
|
||||
|
||||
d->flags &= ~DEVFL_UP;
|
||||
spin_lock_irqsave(&d->lock, flags);
|
||||
d->flags &= ~(DEVFL_UP | DEVFL_DEAD);
|
||||
spin_unlock_irqrestore(&d->lock, flags);
|
||||
|
||||
/* clean out active and to-be-retransmitted buffers */
|
||||
for (i = 0; i < NFACTIVE; i++) {
|
||||
@@ -223,6 +227,13 @@ aoedev_downdev(struct aoedev *d)
|
||||
/* clean out the in-process request (if any) */
|
||||
aoe_failip(d);
|
||||
|
||||
/* clean out any queued block requests */
|
||||
list_for_each_entry_safe(rq, rqnext, &d->rq_list, queuelist) {
|
||||
list_del_init(&rq->queuelist);
|
||||
blk_mq_start_request(rq);
|
||||
blk_mq_end_request(rq, BLK_STS_IOERR);
|
||||
}
|
||||
|
||||
/* fast fail all pending I/O */
|
||||
if (d->blkq) {
|
||||
/* UP is cleared, freeze+quiesce to insure all are errored */
|
||||
|
||||
@@ -2825,6 +2825,9 @@ static int ublk_ctrl_add_dev(const struct ublksrv_ctrl_cmd *header)
|
||||
if (copy_from_user(&info, argp, sizeof(info)))
|
||||
return -EFAULT;
|
||||
|
||||
if (info.queue_depth > UBLK_MAX_QUEUE_DEPTH || info.nr_hw_queues > UBLK_MAX_NR_QUEUES)
|
||||
return -EINVAL;
|
||||
|
||||
if (capable(CAP_SYS_ADMIN))
|
||||
info.flags &= ~UBLK_F_UNPRIVILEGED_DEV;
|
||||
else if (!(info.flags & UBLK_F_UNPRIVILEGED_DEV))
|
||||
|
||||
Reference in New Issue
Block a user