Hello Tejun, On 2017/12/6 上午2:20, Tejun Heo wrote: > Hello, Xuejiufei. > > On Mon, Dec 04, 2017 at 03:13:34PM +0800, xuejiufei wrote: >> I have found that system call sync may return even if dirty pages still >> exist. This is caused by the following case: >> >> sync >> -> sync_inodes_sb() >> -> bdi_split_work_to_wbs() queue works for each wb >> -> wb_wait_for_completions() wait for these works to complete. >> >>>>>>>> race window. Writeback thread found it should switch to another >> new wb while doing foreign cgroup detect. So a new wb is created, and >> the inodes are move from old wb to the new one. The writeback work for >> old wb is done, so the sync process is woken while the inodes with dirty >> pages are still queued in new wb. > > So, wb_wait_for_completion() may end up returning earlier than > expected but data integrity is waited by wait_sb_inodes() which isn't > affected by inode cgroup wb migrations. Have you actually seen this > happening? > Yes, I have seen it actually happening. I think wait_sb_inodes() only wait for pages tagged with PAGECACHE_TAG_WRITEBACK, that means it wait the pages written before. The pages are not written are still tagged with PAGECACHE_TAG_DIRTY and wait_sb_inodes() will not wait for them. Thanks > Thanks. > -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html