From 6ff1055f4070c889c75a0037ebcca87cfbf2084d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 6 Mar 2020 14:49:58 +0000 Subject: [PATCH] daemon: 9p: modprobe 9pnet_virtio before 9pfs operations. Recent Linux kernels seem to require this, for unclear reasons. --- daemon/9p.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/daemon/9p.c b/daemon/9p.c index ce73e2ba0..743a96abd 100644 --- a/daemon/9p.c +++ b/daemon/9p.c @@ -29,19 +29,32 @@ #include #include +#include "ignore-value.h" + #include "daemon.h" #include "actions.h" #define BUS_PATH "/sys/bus/virtio/drivers/9pnet_virtio" +static void +modprobe_9pnet_virtio (void) +{ + /* Required with Linux 5.6 and maybe earlier kernels. For unclear + * reasons the module is not an automatic dependency of the 9p + * module so doesn't get loaded automatically. + */ + ignore_value (command (NULL, NULL, "modprobe", "9pnet_virtio", NULL)); +} + /* https://bugzilla.redhat.com/show_bug.cgi?id=714981#c1 */ char ** do_list_9p (void) { CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (r); - DIR *dir; + modprobe_9pnet_virtio (); + dir = opendir (BUS_PATH); if (!dir) { perror ("opendir: " BUS_PATH); @@ -157,6 +170,7 @@ do_mount_9p (const char *mount_tag, const char *mountpoint, const char *options) } } + modprobe_9pnet_virtio (); r = command (NULL, &err, "mount", "-o", opts, "-t", "9p", mount_tag, mp, NULL); if (r == -1) {