aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fs-writeback.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r--fs/fs-writeback.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 3be57189efd5..a85ac4e33436 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -45,6 +45,7 @@ struct wb_writeback_work {
45 unsigned int for_kupdate:1; 45 unsigned int for_kupdate:1;
46 unsigned int range_cyclic:1; 46 unsigned int range_cyclic:1;
47 unsigned int for_background:1; 47 unsigned int for_background:1;
48 unsigned int for_sync:1; /* sync(2) WB_SYNC_ALL writeback */
48 enum wb_reason reason; /* why was writeback initiated? */ 49 enum wb_reason reason; /* why was writeback initiated? */
49 50
50 struct list_head list; /* pending work list */ 51 struct list_head list; /* pending work list */
@@ -443,9 +444,11 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
443 /* 444 /*
444 * Make sure to wait on the data before writing out the metadata. 445 * Make sure to wait on the data before writing out the metadata.
445 * This is important for filesystems that modify metadata on data 446 * This is important for filesystems that modify metadata on data
446 * I/O completion. 447 * I/O completion. We don't do it for sync(2) writeback because it has a
448 * separate, external IO completion path and ->sync_fs for guaranteeing
449 * inode metadata is written back correctly.
447 */ 450 */
448 if (wbc->sync_mode == WB_SYNC_ALL) { 451 if (wbc->sync_mode == WB_SYNC_ALL && !wbc->for_sync) {
449 int err = filemap_fdatawait(mapping); 452 int err = filemap_fdatawait(mapping);
450 if (ret == 0) 453 if (ret == 0)
451 ret = err; 454 ret = err;
@@ -578,6 +581,7 @@ static long writeback_sb_inodes(struct super_block *sb,
578 .tagged_writepages = work->tagged_writepages, 581 .tagged_writepages = work->tagged_writepages,
579 .for_kupdate = work->for_kupdate, 582 .for_kupdate = work->for_kupdate,
580 .for_background = work->for_background, 583 .for_background = work->for_background,
584 .for_sync = work->for_sync,
581 .range_cyclic = work->range_cyclic, 585 .range_cyclic = work->range_cyclic,
582 .range_start = 0, 586 .range_start = 0,
583 .range_end = LLONG_MAX, 587 .range_end = LLONG_MAX,
@@ -1362,6 +1366,7 @@ void sync_inodes_sb(struct super_block *sb)
1362 .range_cyclic = 0, 1366 .range_cyclic = 0,
1363 .done = &done, 1367 .done = &done,
1364 .reason = WB_REASON_SYNC, 1368 .reason = WB_REASON_SYNC,
1369 .for_sync = 1,
1365 }; 1370 };
1366 1371
1367 /* Nothing to do? */ 1372 /* Nothing to do? */