[PATCH] fallocate returned values on failure

Jones jones.kstw at gmail.com
Wed Dec 3 23:33:10 MST 2014


Hello Jeremy,

Thanks for kindly feedback!
Sure i would like to test it!

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

--
Regards,
Jones

2014-12-04 14:31 GMT+08:00 Jeremy Allison <jra at samba.org>:

> On Wed, Dec 03, 2014 at 10:15:59PM -0800, Jeremy Allison wrote:
> > On Thu, Dec 04, 2014 at 02:02:38PM +0800, Jones wrote:
> > > Hello list,
> > >
> > > There is samba-4.0.5 in the linux box,
> > > and set strict allocate = yes to go through fallocate api.
> > >
> > > Found if fallocate() returns -1 with errno = ENOSPC,
> > > cannot catch by error handling as followings:
> > >     ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_EXTEND_SIZE,
> > >              offset, num_to_write);
> > >   if (ret == ENOSPC) {
> > >   errno = ENOSPC;
> > > ret = -1;
> > >         goto out;
> > >   }
> > >
> > > Per man pages said,
> > > posix_fallocate() returns an error number on failure,
> > > fallocate() returns -1 on failure.
> > >
> > > Patch as attached could handle -1 returned from fallocate() on failure,
> > > please help review and any suggestions are appreciated,
> > > thanks.
> >
> > Very good catch ! Thanks.
> >
> > I think the best way to fix this is to
> > standardize the return from SMB_VFS_FALLOCATE()
> > to be -1,set errno on error, and then convert
> > the lower level to do this if it uses posix_fallocate().
> >
> > We should also fix vfs_slow_fallocate() to
> > do the same - and then fix all the callers
> > to expect -1,errno returns instead of errno.
> >
> > Can you log a bug so we can track this and
> > get it fixed in 4.0.x and above ?
> >
> > I'll code a fix up for master, I'd appreciate
> > it if you could test it !
>
> Hmmm. This is a horrible mess... some of the
> fallocate code paths (the gpfs or gluster versions for example)
> return -1,errno, and many of the others return errno.
>
> I'm going to go through and unify all these on
> one return convention. It's the only way to stay
> sane :-(.
>


More information about the samba-technical mailing list