Re: [PATCH V3 4/4] 9p: convert to the new mount API

From: Dominique Martinet

Date: Mon Oct 13 2025 - 06:26:55 EST


Hi Eric,

Thanks for this V3!

I find it much cleaner, hopefully will be easier to debug :)
... Which turned out to be needed right away, trying with qemu's 9p
export "mount -t 9p -o trans=virtio tmp /mnt" apparently calls
p9_virtio_create() with fc->source == NULL, instead of the expected
"tmp" string
(FWIW I tried '-o trans=tcp 127.0.0.1' and I got the same problem in
p9_fd_create_tcp(), might be easier to test with diod if that's what you
used)

Looking at other filesystems (e.g. fs/nfs/fs_context.c but others are
the same) it looks like they all define a fsparam_string "source" option
explicitly?...

Something like this looks like it works to do (+ probably make the error
more verbose? nothing in dmesg hints at why mount returns EINVAL...)
-----
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 6c07635f5776..999d54a0c7d9 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -34,6 +34,8 @@ struct kmem_cache *v9fs_inode_cache;
*/

enum {
+ /* Mount-point source */
+ Opt_source,
/* Options that take integer arguments */
Opt_debug, Opt_dfltuid, Opt_dfltgid, Opt_afid,
/* String options */
@@ -82,6 +84,7 @@ static const struct constant_table p9_cache_mode[] = {
* the client, and all the transports.
*/
const struct fs_parameter_spec v9fs_param_spec[] = {
+ fsparam_string ("source", Opt_source),
fsparam_u32hex ("debug", Opt_debug),
fsparam_uid ("dfltuid", Opt_dfltuid),
fsparam_gid ("dfltgid", Opt_dfltgid),
@@ -210,6 +213,14 @@ int v9fs_parse_param(struct fs_context *fc, struct fs_parameter *param)
}

switch (opt) {
+ case Opt_source:
+ if (fc->source) {
+ pr_info("p9: multiple sources not supported\n");
+ return -EINVAL;
+ }
+ fc->source = param->string;
+ param->string = NULL;
+ break;
case Opt_debug:
session_opts->debug = result.uint_32;
#ifdef CONFIG_NET_9P_DEBUG
-----

I'll try to find some time to test a mix of actual mount options later
this week

Cheers,
--
Dominique Martinet | Asmadeus