Re: [PATCH v2] efivarfs: add nostatfs mount option to skip QueryVariableInfo()

From: sashiko-bot

Date: Sat Sep 19 2026 - 00:51:24 EST


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] efivarfs: cannot disable nostatfs on PREEMPT_RT kernels
--

commit d9f40eeab38e7ccb1227aacdbea972e4b143d97c
Author: Prashant Singh <singhpra@xxxxxxxxxxx>
Subject: efivarfs: add nostatfs mount option to skip QueryVariableInfo()

This commit introduces a "nostatfs" mount option to efivarfs to skip calling
the slow QueryVariableInfo() EFI runtime service during statfs(). On kernels
built with CONFIG_PREEMPT_RT, this option is enabled by default to avoid
stalling the CPU.

Link: https://lore.kernel.org/all/20260917071600.5587-1-singhpra@xxxxxxxxxxx/

> diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
> index 8d33f11db2a1b..fbdaa4915d303 100644
> --- a/fs/efivarfs/super.c
> +++ b/fs/efivarfs/super.c
[ ... ]
> @@ -323,12 +331,13 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
> enum {
> - Opt_uid, Opt_gid,
> + Opt_uid, Opt_gid, Opt_nostatfs,
> };
>
> static const struct fs_parameter_spec efivarfs_parameters[] = {
> fsparam_uid("uid", Opt_uid),
> fsparam_gid("gid", Opt_gid),
> + fsparam_flag("nostatfs", Opt_nostatfs),
> {},
> };

[Severity: Medium]
Does this omit the ability to specify the inverse of the option?

Only the positive flag is registered with the parser here in
efivarfs_parameters, which means there is no way to explicitly pass a
negated option during mount.

[ ... ]
> @@ -350,6 +359,9 @@ static int efivarfs_parse_param(struct fs_context *fc, struct fs_parameter *para
> case Opt_gid:
> opts->gid = result.gid;
> break;
> + case Opt_nostatfs:
> + opts->nostatfs = true;
> + break;
> default:
> return -EINVAL;
> }

[Severity: Medium]
Is there a way for users to explicitly request statfs to be enabled?

There is no corresponding case in efivarfs_parse_param() to set
opts->nostatfs = false (for example, via a "statfs" option).

[ ... ]
> @@ -526,6 +538,8 @@ static int efivarfs_init_fs_context(struct fs_context *fc)
>
> sfi->mount_opts.uid = GLOBAL_ROOT_UID;
> sfi->mount_opts.gid = GLOBAL_ROOT_GID;
> + /* QueryVariableInfo() stalls the CPU; default nostatfs on PREEMPT_RT. */
> + sfi->mount_opts.nostatfs = IS_ENABLED(CONFIG_PREEMPT_RT);
>
> fc->s_fs_info = sfi;

[Severity: Medium]
Since the flag is enabled by default in efivarfs_init_fs_context() on
PREEMPT_RT kernels, and the parser has no mechanism to clear it, does this
permanently lock administrators out of checking EFI variable capacity
via statfs() on those systems?

Would it make sense to define a negative flag using fsparam_flag_no() so
administrators can override the CONFIG_PREEMPT_RT default if they need to
monitor the capacity and are willing to accept the stall?

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919044124.8268-1-singhpra@xxxxxxxxxxx?part=1