From 7518dd3def8921d3233c5fb83f651fc6a5f710af Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 9 Oct 2008 16:03:57 -0700 Subject: [PATCH] filestore: use BTRFS_IOC_SYNC instead of fsync fsync() won't do the right thing on newer versions of btrfs, due do the new tree log stuff. Use the SYNC ioctl. --- src/os/FileStore.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 3ab0cbd23d3b4..19746cb796c29 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -1405,7 +1405,13 @@ void FileStore::sync_entry() commit_started(); - ::fsync(fd); // this should cause the fs's journal to commit. (on btrfs too.) + if (btrfs) { + // do a full btrfs commit + ::ioctl(fd, BTRFS_IOC_SYNC); + } else { + // make the file system's journal to commit. + ::fsync(fd); + } ::close(fd); commit_finish(); -- 2.39.5