Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge patch series "fs: fully sync all fsese even for an emergency sync"

Qu Wenruo <wqu@suse.com> says:

The first patch is a cleanup related to sync_inodes_one_sb() callback.
Since it always wait for the writeback, there is no need to pass any
parameter for it.

The second patch is a fix mostly affecting btrfs, as btrfs requires a
explicit sync_fc() call with wait == 1, to commit its super blocks,
and sync_bdevs() won't cut it at all.

However the current emergency sync never passes wait == 1, it means
btrfs will writeback all dirty data and metadata, but still no super
block update, resulting everything still pointing back to the old
data/metadata.

This lead to a problem where btrfs doesn't seem to do anything during
emergency sync.

The second patch fixes the problem by passing wait == 1 for the second
iteration of sync_fs_one_sb().

* patches from https://patch.msgid.link/cover.1762142636.git.wqu@suse.com:
fs: fully sync all fses even for an emergency sync
fs: do not pass a parameter for sync_inodes_one_sb()

Link: https://patch.msgid.link/cover.1762142636.git.wqu@suse.com
Signed-off-by: Christian Brauner <brauner@kernel.org>

+4 -3
+4 -3
fs/sync.c
··· 117 117 static void do_sync_work(struct work_struct *work) 118 118 { 119 119 int nowait = 0; 120 + int wait = 1; 120 121 121 122 /* 122 123 * Sync twice to reduce the possibility we skipped some inodes / pages 123 124 * because they were temporarily locked 124 125 */ 125 - iterate_supers(sync_inodes_one_sb, &nowait); 126 + iterate_supers(sync_inodes_one_sb, NULL); 126 127 iterate_supers(sync_fs_one_sb, &nowait); 127 128 sync_bdevs(false); 128 - iterate_supers(sync_inodes_one_sb, &nowait); 129 - iterate_supers(sync_fs_one_sb, &nowait); 129 + iterate_supers(sync_inodes_one_sb, NULL); 130 + iterate_supers(sync_fs_one_sb, &wait); 130 131 sync_bdevs(false); 131 132 printk("Emergency Sync complete\n"); 132 133 kfree(work);