Re: lib: Use backoff polling to wait for loop device nodes

Li Wang <[email protected]> Wed, 5 Aug 2026 14:53:00 +0800
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Wake,

The AI comments make sense, I overlooked them before ack your patch.

TST_RETRY_FN_EXP_BACKOFF() is not a drop-in replacement here: it
depends on tst_multiply_timeout(), which is not declared by test.h
for legacy-API users, and its timing semantics do not match the
commit message. In particular, the argument 1 is 1us, not 1ms,
and the cap is the macro's own timeout-adjusted threshold rather
than 100ms.

On Wed, Aug 05, 2026 at 04:09:54AM +0000, [email protected] wrote:
> Hi Wake,
> 
> On Aug 5, 2026, Wake Liu wrote:
> > lib: Use backoff polling to wait for loop device nodes
> 
> > +				path_set = TST_RETRY_FN_EXP_BACKOFF(
> > +					set_dev_loop_path(rc, path, path_len),
> > +					TST_RETVAL_EQ0, 1);
> 
> Could the declaration of tst_multiply_timeout() be made available to this
> legacy-API library, or could polling avoid this macro? The macro expands to a
> call to tst_multiply_timeout(), but test.h does not declare it. GCC reports an
> implicit declaration and Clang rejects both new call sites under C99:
> 
> > error: call to undeclared function 'tst_multiply_timeout'; ISO C99 and later do not support implicit function declarations
> 
> > tst_find_free_loopdev() and tst_attach_device() (starting at 1ms delay,
> > doubling each try, capped at 100ms) to wait for the device node to be
> > successfully populated.
> 
> Could this timing description be corrected or the requested timing be
> implemented? TST_RETRY_FN_EXP_BACKOFF(..., 1) starts at one microsecond and
> uses one second as its maximum-delay threshold, subject to
> tst_multiply_timeout().
> 
> Verdict - Needs revision
> 
> ---
> Note:
> 
> The agent can sometimes produce false positives although often its
> findings are genuine. If you find issues with the review, please
> comment this email or ignore the suggestions.
> 
> Regards,
> LTP AI Reviewer
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp