[LTP] [PATCH v2] listmount04.c: Update case support mnt_id_req.mnt_ns_fd

Petr Vorel pvorel@suse.cz
Tue Dec 9 18:49:07 CET 2025


> Hi!
> > > +	uint32_t mnt_ns_fd;
> > > +#else
> > >  	uint32_t spare;
> > > +#endif
> > >  	uint64_t mnt_id;
> > >  	uint64_t param;
> > >  	uint64_t *mnt_ids;
> > > @@ -73,12 +77,21 @@ static struct tcase {
> > >  	{
> > >  		.req_usage = 1,
> > >  		.size = MNT_ID_REQ_SIZE_VER0,
> > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
> > > +		.mnt_ns_fd = -1,
> > > +#else
> > >  		.spare = -1,
> > > +#endif
> > >  		.mnt_id = LSMT_ROOT,
> > >  		.mnt_ids = mnt_ids,
> > >  		.nr_mnt_ids = MNT_SIZE,
> > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
> > > +		.exp_errno = EBADF,
> > > +		.msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor",
> > > +#else
> > >  		.exp_errno = EINVAL,
> > >  		.msg = "invalid mnt_id_req.spare",
> > > +#endif

> This is never going to work, how kernel interprets the value depends on
> solely on the running kernel verision not on headers that were present
> during the compilation.

+1, I realized that myself as well.

> What we need to do is to differentiate the expected errno based on
> running kernel version.

Other option would be just accept both errnos (as kernel developers seem to be
not forcing us to be pedantic on kernel internals - recent swapon03.c rewrite
requirement). But lets use tst_kvercmp() to not delay the fix with more
discussion.

Kind regards,
Petr


More information about the ltp mailing list