public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* Compile Error fs/nfsd/nfs4state.o - clamp() low limit slotsize greater than high limit total_avail/scale_factor
@ 2025-11-04 14:15 Mike-SPC via Bugspray Bot
  2025-11-04 14:50 ` Chuck Lever
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Mike-SPC via Bugspray Bot @ 2025-11-04 14:15 UTC (permalink / raw)
  To: anna, linux-nfs, cel, jlayton, trondmy

Mike-SPC writes via Kernel.org Bugzilla:

Hi there,

with kernel version > 6.1.156 I get the following error by compiling it (make bzImage) on a 32bit platform:

  CALL    scripts/checksyscalls.sh
  CC      fs/nfsd/nfs4state.o
In file included from <command-line>:
In function 'nfsd4_get_drc_mem',
    inlined from 'check_forechannel_attrs' at fs/nfsd/nfs4state.c:3539:16,
    inlined from 'nfsd4_create_session' at fs/nfsd/nfs4state.c:3612:11:
././include/linux/compiler_types.h:375:38: error: call to '__compiletime_assert_587' declared with attribute error: clamp() low limit slotsize greater than high limit total_avail/scale_factor
  375 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                      ^
././include/linux/compiler_types.h:356:4: note: in definition of macro '__compiletime_assert'
  356 |    prefix ## suffix();    \
      |    ^~~~~~
././include/linux/compiler_types.h:375:2: note: in expansion of macro '_compiletime_assert'
  375 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/minmax.h:188:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
  188 |  BUILD_BUG_ON_MSG(statically_true(ulo > uhi),    \
      |  ^~~~~~~~~~~~~~~~
./include/linux/minmax.h:195:2: note: in expansion of macro '__clamp_once'
  195 |  __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
      |  ^~~~~~~~~~~~
./include/linux/minmax.h:218:36: note: in expansion of macro '__careful_clamp'
  218 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
      |                                    ^~~~~~~~~~~~~~~
fs/nfsd/nfs4state.c:1825:10: note: in expansion of macro 'clamp_t'
 1825 |  avail = clamp_t(unsigned long, avail, slotsize,
      |          ^~~~~~~
make[3]: *** [scripts/Makefile.build:250: fs/nfsd/nfs4state.o] Error 1
make[2]: *** [scripts/Makefile.build:503: fs/nfsd] Error 2
make[1]: *** [scripts/Makefile.build:503: fs] Error 2
make: *** [Makefile:2025: .] Error 2



I'm not a coder, so I checked it with OpenAI, which throwed out the following patch:

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1822,8 +1822,12 @@ 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);
+       /* Ensure hi >= lo per "give at least one slot" policy */
+       do {
+               unsigned long hi = total_avail / scale_factor;
+               if (hi < slotsize) hi = slotsize;
+               avail = clamp_t(unsigned long, avail, slotsize, hi);
+       } while (0);
        num = min_t(int, num, avail / slotsize);



After implementing it, I'm able to compile the kernel.
But, as I mentioned before, I'm not a coder, so I cannot test the patch from a programming perspective.

Therefore, it would be nice if a patch could be made available by a human. :)

Thanks in advance - regards,
Michael

View: https://bugzilla.kernel.org/show_bug.cgi?id=220745#c0
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


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

end of thread, other threads:[~2025-11-15 11:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 14:15 Compile Error fs/nfsd/nfs4state.o - clamp() low limit slotsize greater than high limit total_avail/scale_factor Mike-SPC via Bugspray Bot
2025-11-04 14:50 ` Chuck Lever
2025-11-04 22:20   ` NeilBrown
2025-11-05  8:25     ` Mike-SPC via Bugspray Bot
2025-11-05 12:25 ` Mike-SPC via Bugspray Bot
2025-11-05 14:29   ` Chuck Lever
2025-11-06 11:30     ` Mike-SPC via Bugspray Bot
2025-11-06 12:29       ` Jeff Layton
2025-11-06 14:33         ` Fwd: " Chuck Lever
2025-11-06 19:22           ` David Laight
2025-11-06 19:32             ` Chuck Lever
2025-11-06 22:39               ` David Laight
2025-11-07 11:17             ` NeilBrown
2025-11-07 11:43               ` David Laight
2025-11-07 22:49                 ` NeilBrown
2025-11-08 15:49                   ` Chuck Lever
2025-11-08 22:40                     ` David Laight
2025-11-15 11:00 ` Mike-SPC via Bugspray Bot

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