summaryrefslogtreecommitdiffstats
path: root/src/server/uplink.c
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-05 10:20:09 +0200
committerSimon Rettberg2018-07-05 10:20:09 +0200
commit9a206835b903a3e76a19d251159542820cbdae6f (patch)
tree805cd56bd8bfa26ecda7d87de7c6649571eb2a6b /src/server/uplink.c
parent[SERVER] Use O_DIRECT for integrity checks (diff)
downloaddnbd3-9a206835b903a3e76a19d251159542820cbdae6f.tar.gz
dnbd3-9a206835b903a3e76a19d251159542820cbdae6f.tar.xz
dnbd3-9a206835b903a3e76a19d251159542820cbdae6f.zip
[SERVER] Always use fsync instead of fdatasync
Now that we support sparse files, using just fdatasync isn't safe anymore. Instead of handling both cases differently just drop fdatasync, the difference has probably been marginal all along anyways.
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r--src/server/uplink.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/server/uplink.c b/src/server/uplink.c
index 538f388..26e5d4e 100644
--- a/src/server/uplink.c
+++ b/src/server/uplink.c
@@ -14,12 +14,6 @@
#include <poll.h>
#include <unistd.h>
-#ifdef HAVE_FDATASYNC
-#define dnbd3_fdatasync fdatasync
-#else
-#define dnbd3_fdatasync fsync
-#endif
-
static uint64_t totalBytesReceived = 0;
static pthread_spinlock_t statisticsReceivedLock;
@@ -851,7 +845,7 @@ static bool uplink_saveCacheMap(dnbd3_connection_t *link)
assert( image != NULL );
if ( link->cacheFd != -1 ) {
- if ( dnbd3_fdatasync( link->cacheFd ) == -1 ) {
+ if ( fsync( link->cacheFd ) == -1 ) {
// A failing fsync means we have no guarantee that any data
// since the last fsync (or open if none) has been saved. Apart
// from keeping the cache_map from the last successful fsync
@@ -905,7 +899,7 @@ static bool uplink_saveCacheMap(dnbd3_connection_t *link)
}
done += (size_t)ret;
}
- if ( dnbd3_fdatasync( fd ) == -1 ) {
+ if ( fsync( fd ) == -1 ) {
logadd( LOG_WARNING, "fsync() on image map %s failed with errno %d", mapfile, errno );
}
close( fd );