Re: [PATCH V3 5/4] 9p: fix cache option printing in v9fs_show_options

From: Al Viro
Date: Tue Dec 02 2025 - 18:13:55 EST


On Tue, Dec 02, 2025 at 04:30:53PM -0600, Eric Sandeen wrote:
> commit 4eb3117888a92 changed the cache= option to accept either string
> shortcuts or bitfield values. It also changed /proc/mounts to emit the
> option as the hexadecimal numeric value rather than the shortcut string.
>
> However, by printing "cache=%x" without the leading 0x, shortcuts such
> as "cache=loose" will emit "cache=f" and 'f' is not a string that is
> parseable by kstrtoint(), so remounting may fail if a remount with
> "cache=f" is attempted.
>
> Fix this by adding the 0x prefix to the hexadecimal value shown in
> /proc/mounts.
>
> Fixes: 4eb3117888a92 ("fs/9p: Rework cache modes and add new options to Documentation")
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
>
> diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
> index 05fc2ba3c5d4..d684cb406ed6 100644
> --- a/fs/9p/v9fs.c
> +++ b/fs/9p/v9fs.c
> @@ -148,7 +148,7 @@ int v9fs_show_options(struct seq_file *m, struct dentry *root)
> if (v9ses->nodev)
> seq_puts(m, ",nodevmap");
> if (v9ses->cache)
> - seq_printf(m, ",cache=%x", v9ses->cache);
> + seq_printf(m, ",cache=0x%x", v9ses->cache);

What's wrong with "cache=%#x"?