Unverified Commit a4db63b8 authored by Christian Brauner's avatar Christian Brauner
Browse files

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: default avatarChristian Brauner <brauner@kernel.org>
parents 20052f2e 2706659d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -117,16 +117,17 @@ SYSCALL_DEFINE0(sync)
static void do_sync_work(struct work_struct *work)
{
	int nowait = 0;
	int wait = 1;

	/*
	 * Sync twice to reduce the possibility we skipped some inodes / pages
	 * because they were temporarily locked
	 */
	iterate_supers(sync_inodes_one_sb, &nowait);
	iterate_supers(sync_inodes_one_sb, NULL);
	iterate_supers(sync_fs_one_sb, &nowait);
	sync_bdevs(false);
	iterate_supers(sync_inodes_one_sb, &nowait);
	iterate_supers(sync_fs_one_sb, &nowait);
	iterate_supers(sync_inodes_one_sb, NULL);
	iterate_supers(sync_fs_one_sb, &wait);
	sync_bdevs(false);
	printk("Emergency Sync complete\n");
	kfree(work);