Re: [PATCH] udf: parse umask, mode and dmode as octal again

From: Jan Kara

Date: Wed Dec 02 2026 - 07:18:29 EST


On Tue 01-12-26 16:22:27, Yifan Feng wrote:
> Before the conversion to the new mount API these three options were
> parsed with match_octal(). Now they are fsparam_u32, which takes a
> number without a leading zero as decimal. So mode=644,dmode=755 gives
> files the permissions 0204 and directories 0363.
>
> udf_show_options() prints the values in octal without a leading zero,
> so they are also read back as other values. mount(8) passes the
> options of /proc/mounts again when it is given the mount point only,
> and every such remount changes the permissions:
>
> # mount -o umask=022 /dev/vda /mnt
> # findmnt -no OPTIONS /mnt
> rw,relatime,umask=22,iocharset=utf8
> # mount -o remount,noatime /mnt
> # findmnt -no OPTIONS /mnt
> rw,noatime,umask=26,iocharset=utf8
>
> Use fsparam_u32oct for the three options.
>
> Fixes: c4e89cc674ac ("udf: convert to new mount API")
> Signed-off-by: Yifan Feng <evanfengff@xxxxxxxxx>

Thanks! I've added the patch to my tree.

Honza

> ---
> Tested in QEMU with mount(8) from util-linux 2.38.1. umask=8 and mode=0x1a4 are rejected again, as before the conversion. The checkpatch warnings are the existing style of the table.
> Found and written with the help of an AI coding assistant.
>
> fs/udf/super.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index a81a8509524a..5a07271b9745 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -502,7 +502,7 @@ static const struct fs_parameter_spec udf_param_spec[] = {
> fsparam_flag ("longad", Opt_longad),
> fsparam_string ("gid", Opt_gid),
> fsparam_string ("uid", Opt_uid),
> - fsparam_u32 ("umask", Opt_umask),
> + fsparam_u32oct ("umask", Opt_umask),
> fsparam_u32 ("session", Opt_session),
> fsparam_u32 ("lastblock", Opt_lastblock),
> fsparam_u32 ("anchor", Opt_anchor),
> @@ -512,8 +512,8 @@ static const struct fs_parameter_spec udf_param_spec[] = {
> fsparam_u32 ("rootdir", Opt_rootdir),
> fsparam_flag ("utf8", Opt_utf8),
> fsparam_string ("iocharset", Opt_iocharset),
> - fsparam_u32 ("mode", Opt_fmode),
> - fsparam_u32 ("dmode", Opt_dmode),
> + fsparam_u32oct ("mode", Opt_fmode),
> + fsparam_u32oct ("dmode", Opt_dmode),
> {}
> };
>
>
> base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
> --
> 2.39.3 (Apple Git-146)
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR