]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileStore: use fdatasync(2) instead of sync_file_range(2)
authorSage Weil <sage@inktank.com>
Wed, 19 Jun 2013 04:24:16 +0000 (21:24 -0700)
committerSage Weil <sage@inktank.com>
Wed, 19 Jun 2013 04:24:16 +0000 (21:24 -0700)
The use of sync_file_range(2) on XFS screws up XFS' delicate ordering
of writeback and range zeroing; see #4976 and this thread:

  http://oss.sgi.com/archives/xfs/2013-06/msg00066.html

Instead, replace all sync_file_range(2) calls with fdatasync(2), which
*does* do ordered writeback and should not leak unzeroed blocks.

Signed-off-by: Sage Weil <sage@inktank.com>
src/os/FileStore.cc

index fec058edd1775523486f95965f655f67638c4f55..966035f36bc4c0a597dc66f5c8646495cc3407a9 100644 (file)
@@ -2957,7 +2957,7 @@ int FileStore::_write(coll_t cid, const hobject_t& oid,
        !m_filestore_flusher ||
        !(async_done = queue_flusher(fd, offset, len, replica))) {
       if (should_flush && m_filestore_sync_flush) {
-       ::sync_file_range(fd, offset, len, SYNC_FILE_RANGE_WRITE);
+       ::fdatasync(fd);
        local_flush = true;
       }
     }
@@ -3325,7 +3325,7 @@ void FileStore::flusher_entry()
        q.pop_front();
        if (!stop && ep == sync_epoch) {
          dout(10) << "flusher_entry flushing+closing " << fd << " ep " << ep << dendl;
-         ::sync_file_range(fd, off, len, SYNC_FILE_RANGE_WRITE);
+         ::fdatasync(fd);
          if (replica && m_filestore_replica_fadvise) {
            int fa_r = posix_fadvise(fd, off, len, POSIX_FADV_DONTNEED);
            if (fa_r) {