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

From: David Hildenbrand (Arm)

Date: Wed Dec 02 2026 - 08:41:08 EST


On 12/2/26 01:18, Yifan Feng 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:
>
> # mount -t tmpfs -o 'mpol=prefer (many):0-1' none /mnt
> # grep /mnt /proc/mounts
> none /mnt tmpfs rw,relatime,inode64,mpol=prefer (many):0-1 0 0
> # 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. The mount above is then shown as
>
> none /mnt tmpfs rw,relatime,inode64,mpol=prefer\040(many):0-1 0 0
>
> and keeps its policy over the remount.
>
> Fixes: b27abaccf8e8 ("mm/mempolicy: add MPOL_PREFERRED_MANY for multiple preferred nodes")
> Signed-off-by: Yifan Feng <evanfengff@xxxxxxxxx>
> ---

I guess that's ok, it changes something that was already user-visible ... . I'll
queue it but wait for more review.

--
Cheers,

David