Re: [PATCH v2 2/2] selftests/liveupdate: Add helpers to preserve/retrieve FDs

From: Vipin Sharma

Date: Fri Jun 12 2026 - 15:38:32 EST


On Fri, Jun 12, 2026 at 10:34:32AM -0700, Vipin Sharma wrote:
> On Fri, Jun 12, 2026 at 03:09:32AM +0000, Pasha Tatashin wrote:
> > On Wed, 10 Jun 2026 16:09:08 -0700, Vipin Sharma <vipinsh@xxxxxxxxxx> wrote:
> > > diff --git a/tools/testing/selftests/liveupdate/lib/liveupdate.c b/tools/testing/selftests/liveupdate/lib/liveupdate.c
> > > index 897c200f3845..961a732b541d 100644
> > > --- a/tools/testing/selftests/liveupdate/lib/liveupdate.c
> > > +++ b/tools/testing/selftests/liveupdate/lib/liveupdate.c
> > > @@ -78,9 +78,35 @@ int luo_retrieve_session(int luo_fd, const char *name)
> > > return arg.fd;
> > > }
> > >
> > > +int luo_session_preserve_fd(int session_fd, int fd, __u64 token)
> > > +{
> > > + struct liveupdate_session_preserve_fd arg = {
> > > + .size = sizeof(arg),
> > > + .fd = fd,
> > > + .token = token,
> > > + };
> > > +
> > > + if (ioctl(session_fd, LIVEUPDATE_SESSION_PRESERVE_FD, &arg) < 0)
> > > + return -errno;
> >
> > We do not return positive values on success either, so !ioctl() would
> > be a tighter check, but < 0 is also acceptable.
> >
> > Reviewed-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
>
> I have to send v3 for other feedbacks, I will address this also in that
> version.

I forgot this before, other two ioctls LIVEUPDATE_IOCTL_CREATE_SESSION
and LIVEUPDATE_IOCTL_RETRIEVE_SESSION are using the same pattern of
checking with '< 0'. Lets keep it same, I can send a separate patch if
there is a desire to use tighter check.