mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-07-30 16:18:14 +02:00
vduse: Requeue failed read to send_list head
[ Upstream commit373ec43ded] When copy_to_iter() fails in vduse_dev_read_iter(), put the message back at the head of send_list to preserve FIFO ordering and retry the oldest pending request first. Fixes:c8a6153b6c("vduse: Introduce VDUSE - vDPA Device in Userspace") Reported-by: Michael S. Tsirkin <mst@redhat.com> Suggested-by: Xie Yongji <xieyongji@bytedance.com> Signed-off-by: Zhang Tianci <zhangtianci.1997@bytedance.com> Reviewed-by: Xie Yongji <xieyongji@bytedance.com> Acked-by: Jason Wang <jasowang@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260226115550.1814-2-zhangtianci.1997@bytedance.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
55a644031e
commit
cd2bb18bbe
@@ -182,6 +182,12 @@ static void vduse_enqueue_msg(struct list_head *head,
|
||||
list_add_tail(&msg->list, head);
|
||||
}
|
||||
|
||||
static void vduse_enqueue_msg_head(struct list_head *head,
|
||||
struct vduse_dev_msg *msg)
|
||||
{
|
||||
list_add(&msg->list, head);
|
||||
}
|
||||
|
||||
static void vduse_dev_broken(struct vduse_dev *dev)
|
||||
{
|
||||
struct vduse_dev_msg *msg, *tmp;
|
||||
@@ -342,7 +348,7 @@ static ssize_t vduse_dev_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
||||
spin_lock(&dev->msg_lock);
|
||||
if (ret != size) {
|
||||
ret = -EFAULT;
|
||||
vduse_enqueue_msg(&dev->send_list, msg);
|
||||
vduse_enqueue_msg_head(&dev->send_list, msg);
|
||||
goto unlock;
|
||||
}
|
||||
vduse_enqueue_msg(&dev->recv_list, msg);
|
||||
|
||||
Reference in New Issue
Block a user