ACK: [Focal:*-5.15] UBUNTU: SAUCE: Work-around compile bug in gcc-9.4
Mehmet Basaran
mehmet.basaran at canonical.com
Tue Jan 20 16:08:54 UTC 2026
Acked-by: Mehmet Basaran<mehmet.basaran at canonical.com>
On 1/20/26 19:02, Stefan Bader wrote:
> Upstream stable v5.15.195 contained a rather big set of patches
> reworking the min/max and clamp macros:
>
> - minmax: add in_range() macro
> - minmax: Introduce {min,max}_array()
> - minmax: deduplicate __unconst_integer_typeof()
> - minmax: fix indentation of __cmp_once() and __clamp_once()
> - minmax: avoid overly complicated constant expressions in VM code
> - minmax: add a few more MIN_T/MAX_T users
> - minmax: simplify and clarify min_t()/max_t() implementation
> - minmax: make generic MIN() and MAX() macros available everywhere
> - minmax: don't use max() in situations that want a C constant expression
> - minmax: simplify min()/max()/clamp() implementation
> - minmax: improve macro expansion and type checking
> - minmax: fix up min3() and max3() too
> - minmax.h: add whitespace around operators and after commas
> - minmax.h: update some comments
> - minmax.h: reduce the #define expansion of min(), max() and clamp()
> - minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()
> - minmax.h: move all the clamp() definitions after the min/max() ones
> - minmax.h: simplify the variants of clamp()
> - minmax.h: remove some #defines that are only expanded once
>
> This works without problems when compiled with gcc-11 (Jammy) but
> unexpectedly breaks when compiling with gcc-9 (Focal). Somehow the
> compiler considers (u32) always bigger than ((unsigned long)/unsigned
> int)). There might be other places but for the generic build this
> happens only in fs/nfs/nfs4stat.c. To work around this we add a cast to
> unsigned long.
>
> Ignore: yes
> Fixes: Jammy update: v5.15.195 upstream stable release (2133909)
> Signed-off-by: Stefan Bader <stefan.bader at canonical.com>
> ---
>
> I know this is not the standard format and procedure but this is needed
> to get a 5.15 backport for the 2026.01.12 cycle compiled in focal...
>
> fs/nfsd/nfs4state.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index df982830efc2..d8e014535ae1 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1823,7 +1823,7 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca, struct nfsd_net *nn
> scale_factor = max_t(unsigned int, 8, nn->nfsd_serv->sv_nrthreads);
>
> avail = clamp_t(unsigned long, avail, slotsize,
> - total_avail/scale_factor);
> + ((unsigned long) total_avail/scale_factor));
> num = min_t(int, num, avail / slotsize);
> num = max_t(int, num, 1);
> nfsd_drc_mem_used += num * slotsize;
More information about the kernel-team
mailing list