Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WT-2672 handle system calls that don't set errno #2765

Merged
merged 2 commits into from Jun 2, 2016

Conversation

keithbostic
Copy link
Contributor

@michaelcahill, I tried coding up your suggestion, and I agree it's better than #2757.

I think we should review how we're using SYSCALL_RETRY, though. We're calling it for things that aren't worth retrying (gettimeofday), and we're not calling it for things that might reasonably need to be retried (pread, pwrite). I could see using retry for open(2) calls, but I don't think it has much value outside of that, since pread/pwrite clearly don't need it.

Define system call success as a 0 return, and split error handling
into two parts: if the call returns -1, use errno, otherwise expect
the failing return to be an error value.

Replace calls to remove with unlink, so we know errno will be set.
Do the best we can with rename, there's no easy workaround.
@keithbostic keithbostic self-assigned this Jun 1, 2016
return a -1/errno pair instead (at least FreeBSD and OS X). I don't care
about retrying posix_madvise calls on failure, but since WT_SYSCALL_RETRY
includes the necessary error handling magic, wrap the posix_madvise calls
in WT_SYSCALL_RETRY.
@michaelcahill
Copy link
Contributor

Thanks, @keithbostic -- this lgtm. I agree that it makes sense to split WT_SYSCALL_RETRY into two parts: one that gets the best error code for a given call and another than retries in the cases where that makes sense.

I'd forgotten we retry for cases like ENOSPC, so it may not be as simple as saying pwrite should never retry.

@michaelcahill michaelcahill merged commit ced588a into develop Jun 2, 2016
@keithbostic keithbostic deleted the wt-2672-system-call-second branch June 3, 2016 12:09
michaelcahill pushed a commit that referenced this pull request Jun 23, 2016
Define system call success as a 0 return, and split error handling into two parts: if the call returns -1, use errno, otherwise expect the failing return to be an error value.

Replace calls to remove with unlink, so we know errno will be set.  Do the best we can with rename, there's no easy workaround.

POSIX requires posix_madvise return an errno value, but some OS versions return a -1/errno pair instead (at least FreeBSD and OS X). I don't care about retrying posix_madvise calls on failure, but since WT_SYSCALL_RETRY includes the necessary error handling magic, wrap the posix_madvise calls in WT_SYSCALL_RETRY.

(cherry picked from commit ced588a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants