summaryrefslogtreecommitdiff
path: root/fs/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index d024b78c3e60..35d43421c3a8 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -811,6 +811,13 @@ int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
if (buffer_dirty(bh)) {
get_bh(bh);
spin_unlock(lock);
+ /*
+ * Ensure any pending I/O completes so that
+ * ll_rw_block() actually writes the current
+ * contents - it is a noop if I/O is still in
+ * flight on potentially older contents.
+ */
+ wait_on_buffer(bh);
ll_rw_block(WRITE, 1, &bh);
brelse(bh);
spin_lock(lock);