Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Jul 2024 20:40:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        virtualization@FreeBSD.org
Subject:   [Bug 280098] 9pfs panics on qemu+kvm
Message-ID:  <bug-280098-27103-z3x1kPXdfO@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-280098-27103@https.bugs.freebsd.org/bugzilla/>
References:  <bug-280098-27103@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D280098

--- Comment #2 from Danilo Egea Gondolfo <danilo@FreeBSD.org> ---
Ok, I think I get it (kind of).

This patch will do the trick. But I'm not very familiar with the virtio
infrastructure yet so I'd like some feedback:

---
diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c
b/sys/dev/virtio/p9fs/virtio_p9fs.c
index aa174d3bd5b..3b849e26246 100644
--- a/sys/dev/virtio/p9fs/virtio_p9fs.c
+++ b/sys/dev/virtio/p9fs/virtio_p9fs.c
@@ -320,6 +320,7 @@ vt9p_attach(device_t dev)
        struct sysctl_oid *tree;
        struct vt9p_softc *chan;
        char *mount_tag;
+       char *mount_tag_p;
        int error;
        uint16_t mount_tag_len;

@@ -352,9 +353,12 @@ vt9p_attach(device_t dev)
        mount_tag =3D malloc(mount_tag_len + 1, M_P9FS_MNTTAG,
            M_WAITOK | M_ZERO);

-       virtio_read_device_config(dev,
-           offsetof(struct virtio_9pnet_config, mount_tag),
-           mount_tag, mount_tag_len);
+       mount_tag_p =3D mount_tag;
+       for (int i =3D 0; i < mount_tag_len; i++, mount_tag_p++) {
+               virtio_read_device_config(dev,
+                       offsetof(struct virtio_9pnet_config, mount_tag) + i,
+                       mount_tag_p, 1);
+       }

        device_printf(dev, "Mount tag: %s\n", mount_tag);

---

With this patch I get

virtio_p9fs0: <VirtIO 9P Transport> on virtio_pci7
virtio_p9fs0: Mount tag: config


root@freebsd:~ # mount -t p9fs config /mnt
root@freebsd:~ # ls /mnt/
agent-mounts.json       agent.crt               files=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20
lxd-agent               server.crt              udev
agent.conf              agent.key               install.sh              nic=
s=20=20=20
                systemd
root@freebsd:~ # mount
/dev/da0p2 on / (ufs, local, synchronous, soft-updates, journaled soft-upda=
tes)
devfs on /dev (devfs)
/dev/da0p1 on /boot/efi (msdosfs, local)
config on /mnt (p9fs, local)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-280098-27103-z3x1kPXdfO>