mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
ublk: look up ublk task via its pid in timeout handler
Look up ublk process via its pid in timeout handler, so we can avoid to touch io->task, because it is fragile to touch task structure. It is fine to kill ublk server process and this way is simpler. Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250713143415.2857561-3-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
c2c8089f32
commit
dd7a850731
|
|
@ -1368,14 +1368,23 @@ static void ublk_queue_cmd_list(struct ublk_io *io, struct rq_list *l)
|
|||
static enum blk_eh_timer_return ublk_timeout(struct request *rq)
|
||||
{
|
||||
struct ublk_queue *ubq = rq->mq_hctx->driver_data;
|
||||
struct ublk_io *io = &ubq->ios[rq->tag];
|
||||
pid_t tgid = ubq->dev->ublksrv_tgid;
|
||||
struct task_struct *p;
|
||||
struct pid *pid;
|
||||
|
||||
if (ubq->flags & UBLK_F_UNPRIVILEGED_DEV) {
|
||||
send_sig(SIGKILL, io->task, 0);
|
||||
return BLK_EH_DONE;
|
||||
}
|
||||
if (!(ubq->flags & UBLK_F_UNPRIVILEGED_DEV))
|
||||
return BLK_EH_RESET_TIMER;
|
||||
|
||||
return BLK_EH_RESET_TIMER;
|
||||
if (unlikely(!tgid))
|
||||
return BLK_EH_RESET_TIMER;
|
||||
|
||||
rcu_read_lock();
|
||||
pid = find_vpid(tgid);
|
||||
p = pid_task(pid, PIDTYPE_PID);
|
||||
if (p)
|
||||
send_sig(SIGKILL, p, 0);
|
||||
rcu_read_unlock();
|
||||
return BLK_EH_DONE;
|
||||
}
|
||||
|
||||
static blk_status_t ublk_prep_req(struct ublk_queue *ubq, struct request *rq,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user