diff options
author | Sage Weil <sage@inktank.com> | 2013-06-18 21:33:09 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-19 10:57:35 -0700 |
commit | de8900dcd079207852b6ce0b51473037be9ae956 (patch) | |
tree | 8da789b7ad94cfdc107d7f23466ba04380cdff3c | |
parent | cbbad5b5d917fe74d6cbc50a259f9dbaeda54ca8 (diff) | |
download | ceph-de8900dcd079207852b6ce0b51473037be9ae956.tar.gz |
os/FileStore: use fdatasync(2) instead of sync_file_range(2)
This fixes data corruption on XFS. Backported from
ffade3c85dfffa13a16edd9630a52d99eb8a413d.
Fixes: #4976
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/os/FileStore.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index d956a05ee7a..d23454727ef 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -2912,7 +2912,7 @@ int FileStore::_write(coll_t cid, const hobject_t& oid, !m_filestore_flusher || !queue_flusher(fd, offset, len)) { if (should_flush && m_filestore_sync_flush) - ::sync_file_range(fd, offset, len, SYNC_FILE_RANGE_WRITE); + ::fdatasync(fd); lfn_close(fd); } #else @@ -3217,8 +3217,6 @@ bool FileStore::queue_flusher(int fd, uint64_t off, uint64_t len) if (flusher_queue_len < m_filestore_flusher_max_fds) { flusher_queue.push_back(sync_epoch); flusher_queue.push_back(fd); - flusher_queue.push_back(off); - flusher_queue.push_back(len); flusher_queue_len++; flusher_cond.Signal(); dout(10) << "queue_flusher ep " << sync_epoch << " fd " << fd << " " << off << "~" << len @@ -3254,13 +3252,9 @@ void FileStore::flusher_entry() q.pop_front(); int fd = q.front(); q.pop_front(); - uint64_t off = q.front(); - q.pop_front(); - uint64_t len = q.front(); - 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); } else dout(10) << "flusher_entry JUST closing " << fd << " (stop=" << stop << ", ep=" << ep << ", sync_epoch=" << sync_epoch << ")" << dendl; |