Re: [PATCH] tmpfs: escape the space in the mpol mount option

From: Andrew Morton

Date: Sat Nov 28 2026 - 21:13:25 EST


On Sat, 28 Nov 2026 15:37:47 -0800 Yifan Feng <evanfengff@xxxxxxxxx> wrote:

> The policy names "weighted interleave" and "prefer (many)" contain a
> space, and shmem_show_mpol() prints the name as it is. Readers of
> /proc/mounts take the space as the end of the options field, so
> mount(8) reads back mpol=prefer and an unrelated remount replaces the
> policy:

A little more info please.

> # mount -t tmpfs -o 'mpol=prefer (many):0-1' none /mnt

what's in /proc mounts at this point?

> # mount -o remount,size=128M /mnt
> # grep /mnt /proc/mounts
> none /mnt tmpfs rw,relatime,size=131072k,inode64,mpol=local 0 0
>
> With "weighted interleave" the same remount fails with EINVAL.
>
> Escape the value like the other fields of the line, so that the space
> is printed as \040.

and what does /proc/mounts look like after making this change?