• Keith Busch's avatar
    nvme-tcp: fix io_work priority inversion · 70f437fb
    Keith Busch authored
    Dispatching requests inline with the .queue_rq() call may block while
    holding the send_mutex. If the tcp io_work also happens to schedule, it
    may see the req_list is non-empty, leaving "pending" true and remaining
    in TASK_RUNNING. Since io_work is of higher scheduling priority, the
    .queue_rq task may not get a chance to run, blocking forward progress
    and leading to io timeouts.
    
    Instead of checking for pending requests within io_work, let the queueing
    restart io_work outside the send_mutex lock if there is more work to be
    done.
    
    Fixes: a0fdd141 ("nvme-tcp: rerun io_work if req_list is not empty")
    Reported-by: default avatarSamuel Jones <sjones@kalrayinc.com>
    Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
    Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    70f437fb
tcp.c 65.9 KB