Hello,

Mikhail Karpov, le dim. 08 nov. 2026 16:32:51 +0700, a ecrit:
> On Sat, 7 Nov 2026 15:52:52 Samuel Thibault wrote:
> 
> > Mmm, we should probably be able to factorize iohelp_free_iouser (user);
> > by having at the exit place a if (user) iohelp_free_iouser (user); and
> > make the success path set user = NULL?
> >
> > You'll then be able to use the simple-to-read
> >
> > if (!err)
> >     err = do_something();
> >
> > if (!err)
> >     err = do_something();
> >
> > etc.
> >
> > if (err)
> >     {
> >         errno = err
> >         goto out;
> >     }
> 
> I think we can factor out the error-handling code in this way.

Yeah, it looks good :)

> I’ve tried to make the code in libnetfs/io_duplicate.c resemble the code in
> libdiskfs/io_duplicate.c.  In libdiskfs, the refcount_ref function is called
> after the mutex has been locked; perhaps we should do the same in libnetfs.

refcnt is already threadsafe, so we do not need to keep a mutex for it.
Better rather make libdiskfs avoid spending the refcount overhead within
the mutex region. But it makes the code simpler, so why not.

Samuel

Reply via email to