]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore/BlueFS: fix flush_bdev placement
authorSage Weil <sage@redhat.com>
Thu, 9 Mar 2017 21:51:21 +0000 (16:51 -0500)
committerNathan Cutler <ncutler@suse.com>
Tue, 4 Jul 2017 14:08:57 +0000 (16:08 +0200)
commitc08720553f6ae787fe3b0edbdd1497859cdfe0d4
tree00d2337abefea9cbf7e4df796c841268ba4ce74d
parent594332631e442f3da1b7e6aa49248a6e3c46a30f
os/bluestore/BlueFS: fix flush_bdev placement

We need to flush any new writes on any fsync().  Notably, this includes
the rocksdb log. However, previously _fsync was only doing a bdev flush if
we also had a dirty bluefs journal and called into _sync_and_flush_journal.
If we didn't, we weren't doing a flush() at all, which could lead to
corrupted data.

Fix this by moving the first flush_bdev *out* of _sync_and_flush_log.  (The
second one is there to flush the bluefs journal; the first one was to
ensure prior writes are stable.)  Instead, flush prior writes in all of the
callers prior to calling _sync_and_flush_log.  This includes _fsync (and
fixes the bug by covering the non-journal-flush path) as well as several
other callers.

Fixes: http://tracker.ceph.com/issues/19250
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 2924a96493d8570317e55854a25fc64911ecf151)
src/os/bluestore/BlueFS.cc