diff --git a/pom.xml b/pom.xml index b11d2a0..a110f35 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.cryptomator fuse-nio-adapter - 1.2.0 + 1.2.1 FUSE-NIO-Adapter Access resources at a given NIO path via FUSE. https://github.com/cryptomator/fuse-nio-adapter diff --git a/src/main/java/org/cryptomator/frontend/fuse/OpenFile.java b/src/main/java/org/cryptomator/frontend/fuse/OpenFile.java index 21fa27b..60ba4ad 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/OpenFile.java +++ b/src/main/java/org/cryptomator/frontend/fuse/OpenFile.java @@ -98,8 +98,8 @@ public void close() throws IOException { channel.close(); } - public void flush() throws IOException { - channel.force(false); + public void fsync(boolean metaData) throws IOException { + channel.force(metaData); } public void truncate(long size) throws IOException { diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java index 5a52304..74564cc 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteAdapter.java @@ -281,11 +281,12 @@ public int ftruncate(String path, long size, FuseFileInfo fi) { } @Override - public int flush(String path, FuseFileInfo fi) { + public int fsync(String path, int isdatasync, FuseFileInfo fi) { try { + boolean metaData = isdatasync == 0; Path node = resolvePath(path); - LOG.trace("flush {}", path); - return fileHandler.flush(node, fi); + LOG.trace("fsync {}", path); + return fileHandler.fsync(node, fi, metaData); } catch (RuntimeException e) { LOG.error("flush " + path + " failed.", e); return -ErrorCodes.EIO(); diff --git a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteFileHandler.java b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteFileHandler.java index ddb2c70..bc98129 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/ReadWriteFileHandler.java +++ b/src/main/java/org/cryptomator/frontend/fuse/ReadWriteFileHandler.java @@ -93,14 +93,14 @@ public int write(Path path, Pointer buf, long size, long offset, FuseFileInfo fi } } - public int flush(Path path, FuseFileInfo fi) { + public int fsync(Path path, FuseFileInfo fi, boolean metaData) { OpenFile file = openFiles.get(fi.fh.get()); if (file == null) { LOG.warn("flush: File not opened: {}", path); return -ErrorCodes.EBADFD(); } try { - file.flush(); + file.fsync(metaData); return 0; } catch (IOException e) { LOG.error("Flushing file failed.", e); diff --git a/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java b/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java index 06d84c3..afb5271 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java +++ b/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java @@ -112,10 +112,10 @@ private String getVersionString() { return node.getTextContent(); } } catch (ParserConfigurationException | SAXException | XPathException e) { - LOG.error("Could not parse file {} to detect version of OSXFUSE.", OSXFUSE_VERSIONFILE_LOCATION); + LOG.error("Could not parse " + OSXFUSE_VERSIONFILE_LOCATION + " to detect version of OSXFUSE.", e); return null; } catch (IOException e) { - LOG.error("Could not read file {} to detect version of OSXFUSE.", OSXFUSE_VERSIONFILE_LOCATION); + LOG.error("Could not read " + OSXFUSE_VERSIONFILE_LOCATION + " to detect version of OSXFUSE.", e); return null; } }