mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 05:04:09 +08:00
Btrfs: properly wait log writers during log sync
A recently fsync optimization make btrfs_sync_log skip calling wait_for_writer in the single log writer case. This is incorrect since the writer count can also be increased by btrfs_pin_log. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
5d5e103a70
commit
86df7eb921
@ -1995,12 +1995,13 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||||||
if (atomic_read(&root->log_commit[(index1 + 1) % 2]))
|
if (atomic_read(&root->log_commit[(index1 + 1) % 2]))
|
||||||
wait_log_commit(trans, root, root->log_transid - 1);
|
wait_log_commit(trans, root, root->log_transid - 1);
|
||||||
|
|
||||||
while (root->log_multiple_pids) {
|
while (1) {
|
||||||
unsigned long batch = root->log_batch;
|
unsigned long batch = root->log_batch;
|
||||||
|
if (root->log_multiple_pids) {
|
||||||
mutex_unlock(&root->log_mutex);
|
mutex_unlock(&root->log_mutex);
|
||||||
schedule_timeout_uninterruptible(1);
|
schedule_timeout_uninterruptible(1);
|
||||||
mutex_lock(&root->log_mutex);
|
mutex_lock(&root->log_mutex);
|
||||||
|
}
|
||||||
wait_for_writer(trans, root);
|
wait_for_writer(trans, root);
|
||||||
if (batch == root->log_batch)
|
if (batch == root->log_batch)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user