Commit ebecd3d9 authored by Sage Weil's avatar Sage Weil Committed by Chris Mason
Browse files

Btrfs: make flushoncommit mount option correctly wait on ordered_extents

The commit_transaction call to wait_ordered_extents when snap_pending
passes nocow_only=1 to process only NOCOW or PREALLOC extents.  This isn't
correct for the 'flushoncommit' mode, as it skips extents we just started
IO on in start_delalloc_inodes.

So, in the flushoncommit case, wait on all ordered extents.  Otherwise,
only pass the nocow_only flag to wait_ordered_extents if snap_pending.
Signed-off-by: default avatarSage Weil <>
Signed-off-by: default avatarChris Mason <>
parent d717aa1d
......@@ -942,9 +942,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
if (flush_on_commit || snap_pending) {
if (flush_on_commit)
if (flush_on_commit) {
ret = btrfs_wait_ordered_extents(root, 0);
} else if (snap_pending) {
ret = btrfs_wait_ordered_extents(root, 1);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment