Re: [PATCH] agheader: remove inappropriate use of -ENOSYS

From: Carlos Maiolino
Date: Fri Jul 18 2025 - 09:02:56 EST


On Fri, Jul 18, 2025 at 05:43:24PM +0500, or10n-cli wrote:
> From 8b4f1f86101f2bf47a90a56321259d32d7fe55eb Mon Sep 17 00:00:00 2001
> From: or10n-cli <muhammad.ahmed.27@xxxxxxxxxxx>
> Date: Fri, 18 Jul 2025 16:24:10 +0500
> Subject: [PATCH] agheader: remove inappropriate use of -ENOSYS
>
> The ENOSYS error code should only be used to indicate an invalid
> system call number. Its usage in this context is misleading and
> has been removed to align with kernel error code semantics.
>
> Signed-off-by: my.user <my.mail@xxxxxxxxxxx>
> ---
>  fs/xfs/scrub/agheader.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
> index 303374df44bd..743e0584b75d 100644
> --- a/fs/xfs/scrub/agheader.c
> +++ b/fs/xfs/scrub/agheader.c
> @@ -134,7 +134,6 @@ xchk_superblock(
>          */
>         switch (error) {
>         case -EINVAL:   /* also -EWRONGFS */
> -       case -ENOSYS:
>         case -EFBIG:
>                 error = -EFSCORRUPTED;
>                 fallthrough;
> --

The comment right above what you changed says:

/*
* The superblock verifier can return several different error codes
* if it thinks the superblock doesn't look right.
.
.
*/

What you did is basically skipping superblock inode size validation,
now scrub will assume it's consistent even if it's corrupted.

Also. Please, go read Documentation/process/submitting-patches.rst