RFR: 8232861: (fc) FileChannel.force fails on WebDAV file systems (macOS)

Alan Bateman alanb at openjdk.java.net
Wed Apr 7 07:39:21 UTC 2021


On Wed, 7 Apr 2021 02:35:18 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Apparently `fcntl(fd, F_FULLFSYNC)` can fail with `ENOTTY` in addition to `ENOTSUP` although it is not so documented. The `ioctl()` case is documented as
> [ENOTTY]       fildes is not associated with a character special
>                device.
> [ENOTTY]       The specified request does not apply to the kind of
>                object that the descriptor fildes references.
> 
> This request proposes to catch `ENOTTY` as well and fall back to `fsync(fd)`. The change was verified manually using a WebDAV server and no failures in CI test tiers 1-3 were observed. An alternative would be to fall back to `fsync(fd)` for **all** errors.

fcntl(fd, F_FULLFSYNC) is the semantics we want for local files. If it fails then the force method has to throw. The force method doesn't provide any guarantees when the file is remote so using fsync for the WebDAV case is okay. I can't find any man pages or other documentation that documents ENOTTY. I think I would be more comfortable with an approach that somehow detects the file is local or not, that would allow it to fallback to fsync when not local.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3366


More information about the nio-dev mailing list