[PATCH] vfs_default: Fix passing of errno from async calls

Jeremy Allison jra at samba.org
Wed Aug 23 23:01:57 UTC 2017


On Wed, Aug 23, 2017 at 03:58:36PM -0700, Christof Schmitt wrote:
> On Wed, Aug 23, 2017 at 03:54:58PM -0700, Jeremy Allison wrote:
> > On Wed, Aug 23, 2017 at 03:12:26PM -0700, Christof Schmitt via samba-technical wrote:
> > > I found this while testing with a system where the actual write() system
> > > call returned an error. This led to Samba hanging and never continuing
> > > with the result of the write. The attached patch fixes the problem. From
> > > what i understand, errno was never passed correctly back to the callers.
> > 
> > Wow - good catch !!!!
> > 
> > Can we change the assignment:
> > 
> >  -     state->err = errno;
> >  +     state->vfs_aio_state.error = errno;
> > 
> > to:
> > 
> >  -     state->err = errno;
> >  +	if (state->ret == -1) {
> >  +	     state->vfs_aio_state.error = errno;
> >  +	}
> > 
> > on each of the hunks, as we need to make
> > sure that the thread only assigns non-zero
> > to state->vfs_aio_state.error in the fail
> > case. It's (theoretically) possible that
> > the first go around returns -1, errno = EINTR and
> > the second go around returns 0, but
> > doesn't set errno (leaving it as the
> > previous EINTR value). We should only
> > set state->vfs_aio_state.error on a
> > *known* error return IMHO.
> > 
> > If you're happy with that RB+.
> 
> Yes, that makes sense. Let me test with the change and then send the
> updated patch.

Bug ID for back-ports:

https://bugzilla.samba.org/show_bug.cgi?id=12983



More information about the samba-technical mailing list