[PATCH] fallocate returned values on failure
Jeremy Allison
jra at samba.org
Thu Dec 4 23:22:42 MST 2014
On Fri, Dec 05, 2014 at 08:44:27AM +0800, Jones wrote:
> Hello Jeremy,
>
> Thanks! Will test this patch ASAP!
>
> And one more thing,
> returns -1 between contend_level2_oplock_{begin,end} pairs
> looks a bit concern to me,
> perhaps move them after contend_level2_oplocks_end() ?
>
> contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_GROW);
>
> if (lp_strict_allocate(SNUM(fsp->conn))) {
> /* See if we have a syscall that will allocate beyond
> end-of-file without changing EOF. */
> ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_KEEP_SIZE, 0, len);
> } else {
> ret = 0;
> }
>
> contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_ALLOC_GROW);
>
> + if (ret == -1 && errno == ENOSPC) {
> + return -1;
> + }
Yes, that's correct - I missed that. It would
actually have worked (the actual case is that
only the contend_level2_oplocks_begin() is
used within normal Samba - the _begin/_end cases
were added for only one vendor who now no longer
uses Samba) but it's good to be careful about
these things.
I'll upload a modified patch tomorrow.
Cheers,
Jeremy.
More information about the samba-technical
mailing list