From: Yuho Choi <oss.patchbox@gmail.com>
To: Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Dominique Martinet <asmadeus@codewreck.org>
Cc: Christian Schoenebeck <linux_oss@crudebyte.com>,
v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH] 9p/trans_virtio: reset device before deleting virtqueue on probe failure
Date: Thu, 3 Dec 2026 21:56:18 +0000 [thread overview]
Message-ID: <20261203215847.2322040-2-oss.patchbox@gmail.com> (raw)
When p9_virtio_probe() fails after finding the virtqueue, it deletes the
queue without resetting the device, and the virtio core does not reset it
after a failed probe either. On virtio-pci modern the queue then stays
enabled, so every later probe of the device fails in setup_vq() with
-ENOENT and the share can no longer be mounted. Reset the device before
deleting the virtqueue, as p9_virtio_remove() does.
Fixes: 97ee9b025740 ("net/9p: Use the tag name in the config space for identifying mount point")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
An LLM helped me write and run this reproduction test.
Tested on 9p-next 45cf2b26cf26 in a QEMU/KVM guest with virtio-9p-pci.
A test-only module parameter made p9_virtio_probe() fail once, at the
tag allocation or at the vc_wq allocation, and the device was then
bound again through sysfs. Without this patch every bind failed and
the share could not be mounted (3 of 3 runs for each failure point):
9pnet_virtio virtio0: probe with driver 9pnet_virtio failed with error -2
mount: mounting host0 on /mnt failed: No such file or directory
With this patch the first bind succeeded each time and the share
mounted.
net/9p/trans_virtio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 9fa63e3ebf67..a75ea075f781 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -677,6 +677,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
out_free_tag:
kfree(tag);
out_free_vq:
+ virtio_reset_device(vdev);
vdev->config->del_vqs(vdev);
out_free_chan:
kfree(chan);
base-commit: 45cf2b26cf260ce66b89c390245579527ae60782
--
2.56.1
reply other threads:[~2026-12-03 21:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203215847.2322040-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=v9fs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox