Linux Overlay Filesystem development
 help / color / mirror / Atom feed
* [PATCH] common/overlay: fix _check_overlay_feature for default-on param-less options
@ 2026-11-06 15:58 Amir Goldstein
  2026-11-21 17:19 ` Zorro Lang
  0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2026-11-06 15:58 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Miklos Szeredi, linux-unionfs, fstests, Prabhakar Pujeri

Overlayfs only displays a mount option if it differs from the default.
Commit 73a018cb treated a feature without a module parameter of the same
name (e.g. xino) as default off and required "${feature}=on" in the mount
options.  On a samefs xfs setup xino is on by default and is not displayed,
so tests requiring xino (e.g. overlay/041, 043, 044, 067, 070, 071) were
wrongly skipped.

For features without a boolean module parameter, assume the feature may
be on by default and only verify that the mount options do not show it
with a value other than "on", same as for features that default to Y.

Fixes: 73a018cbf57b ("common/overlay: let _check_overlay_feature handle param-less options")
Cc: Prabhakar Pujeri <prabhakar.pujeri@dell.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 common/overlay | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/common/overlay b/common/overlay
index 132b2bf7..0cf6db2d 100644
--- a/common/overlay
+++ b/common/overlay
@@ -172,24 +172,20 @@ _check_overlay_feature()
 	# parameter (the system default) and per mount by mount
 	# option ${feature}=[on|off].
 	local default=`_get_fs_module_param ${feature}`
-	if [ "$default" != Y ] && [ "$default" != N ]; then
-		# Some mount options (e.g. uuid, xino, verity) have no
-		# on/off module parameter of the same name.  For those,
-		# a missing (or non-boolean) parameter means that the
-		# feature defaults to off rather than that it is
-		# unsupported.  Unsupported options are rejected by the
-		# probe mount in _require_scratch_overlay_features.
-		default=N
-	fi
+	local value=`_fs_options $dev | tr ',' '\n' | grep "^${feature}=" | cut -d= -f2`
 
 	# Check options to be sure. For example, Overlayfs will fallback to
 	# index=off if underlying fs does not support file handles.
 	# Overlayfs only displays mount option if it differs from the default.
+	# Without a module param of the same name (e.g. xino), the feature
+	# may be on by default, so only require it is not shown as non-on.
 	# Overlayfs may enable the feature, but fallback to read-only mount.
-	((( [ "$default" = N ] && _fs_options $dev | grep -q "${feature}=on" ) || \
-	  ( [ "$default" = Y ] && ! _fs_options $dev | grep -q "${feature}=off" )) && \
-	    touch $mnt/foo 2>/dev/null ) || \
-	        _notrun "${FSTYP} feature '${feature}' cannot be enabled on ${dev}"
+	if [ "$default" = N ]; then
+		[ "$value" = on ]
+	else
+		[ -z "$value" -o "$value" = on ]
+	fi && touch $mnt/foo 2>/dev/null || \
+		_notrun "${FSTYP} feature '${feature}' cannot be enabled on ${dev}"
 }
 
 # Require a set of overlayfs features
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] common/overlay: fix _check_overlay_feature for default-on param-less options
  2026-11-06 15:58 [PATCH] common/overlay: fix _check_overlay_feature for default-on param-less options Amir Goldstein
@ 2026-11-21 17:19 ` Zorro Lang
  0 siblings, 0 replies; 2+ messages in thread
From: Zorro Lang @ 2026-11-21 17:19 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Miklos Szeredi, linux-unionfs, fstests, Prabhakar Pujeri

On Fri, Nov 06, 2026 at 04:58:31PM +0100, Amir Goldstein wrote:
> Overlayfs only displays a mount option if it differs from the default.
> Commit 73a018cb treated a feature without a module parameter of the same
> name (e.g. xino) as default off and required "${feature}=on" in the mount
> options.  On a samefs xfs setup xino is on by default and is not displayed,
> so tests requiring xino (e.g. overlay/041, 043, 044, 067, 070, 071) were
> wrongly skipped.
> 
> For features without a boolean module parameter, assume the feature may
> be on by default and only verify that the mount options do not show it
> with a value other than "on", same as for features that default to Y.
> 
> Fixes: 73a018cbf57b ("common/overlay: let _check_overlay_feature handle param-less options")
> Cc: Prabhakar Pujeri <prabhakar.pujeri@dell.com>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---

Looks good to me!

Reviewed-by: Zorro Lang <zlang@kernel.org>

>  common/overlay | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/common/overlay b/common/overlay
> index 132b2bf7..0cf6db2d 100644
> --- a/common/overlay
> +++ b/common/overlay
> @@ -172,24 +172,20 @@ _check_overlay_feature()
>  	# parameter (the system default) and per mount by mount
>  	# option ${feature}=[on|off].
>  	local default=`_get_fs_module_param ${feature}`
> -	if [ "$default" != Y ] && [ "$default" != N ]; then
> -		# Some mount options (e.g. uuid, xino, verity) have no
> -		# on/off module parameter of the same name.  For those,
> -		# a missing (or non-boolean) parameter means that the
> -		# feature defaults to off rather than that it is
> -		# unsupported.  Unsupported options are rejected by the
> -		# probe mount in _require_scratch_overlay_features.
> -		default=N
> -	fi
> +	local value=`_fs_options $dev | tr ',' '\n' | grep "^${feature}=" | cut -d= -f2`
>
>  	# Check options to be sure. For example, Overlayfs will fallback to
>  	# index=off if underlying fs does not support file handles.
>  	# Overlayfs only displays mount option if it differs from the default.
> +	# Without a module param of the same name (e.g. xino), the feature
> +	# may be on by default, so only require it is not shown as non-on.
>  	# Overlayfs may enable the feature, but fallback to read-only mount.
> -	((( [ "$default" = N ] && _fs_options $dev | grep -q "${feature}=on" ) || \
> -	  ( [ "$default" = Y ] && ! _fs_options $dev | grep -q "${feature}=off" )) && \
> -	    touch $mnt/foo 2>/dev/null ) || \
> -	        _notrun "${FSTYP} feature '${feature}' cannot be enabled on ${dev}"
> +	if [ "$default" = N ]; then
> +		[ "$value" = on ]
> +	else
> +		[ -z "$value" -o "$value" = on ]
> +	fi && touch $mnt/foo 2>/dev/null || \
> +		_notrun "${FSTYP} feature '${feature}' cannot be enabled on ${dev}"
>  }
>  
>  # Require a set of overlayfs features
> -- 
> 2.55.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-21 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 15:58 [PATCH] common/overlay: fix _check_overlay_feature for default-on param-less options Amir Goldstein
2026-11-21 17:19 ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox