FAILED: patch "[PATCH] ovl: Sync upper dirty data when syncing overlayfs" failed to apply to 4.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
e8d4bfe3a71537284a90561f77c85dea6c154369Mon Sep 17 00:00:00 2001
From: Chengguang Xu <[email protected]>
Date: Wed, 29 Nov 2017 10:01:32 +0800
Subject: [PATCH] ovl: Sync upper dirty data when syncing overlayfs
When executing filesystem sync or umount on overlayfs, dirty data does not get synced as expected on upper filesystem. This patch fixes sync filesystem method to keep data consistency for overlayfs.
Signed-off-by Chengguang Xu <[email protected]>
Fixes e593b2bf513d ("ovl: properly implement sync_filesystem()")
Cc <[email protected]> #4.11
Signed-off-by Miklos Szeredi <[email protected]>
fs/overlayfs/super.c +15 -4
@@ -252,6 +252,7 @@ static void ovl_put_super(struct super_block *sb)ovl_free_fs (ofs); } +/* Sync real dirty inodes in upper filesystem (if it exists) */ static int ovl_sync_fs (struct super_block *sb,int wait) {struct ovl_fs *ofs = sb->s_fs_info;
@@ -260,14 +261,24 @@ static int ovl_sync_fs(struct super_block *sb, int wait)if (!ofs->upper_mnt)return 0 ; - upper_sb = ofs->upper_mnt->mnt_sb; -if (!upper_sb->s_op->sync_fs) + +/* +* If this is a sync(2) call or an emergency sync, all the super blocks +* will be iterated, including upper_sb, so no need to do anything. +* +* If this is a syncfs(2) call, then we do need to call +* sync_filesystem() on upper_sb, but enough if we do it when being +* called with wait == 1. +*/ +if (!wait)return 0 ; -/* real inodes have already been synced by sync_filesystem(ovl_sb) */ + upper_sb = ofs->upper_mnt->mnt_sb; +down_read (&upper_sb->s_umount); - ret = upper_sb->s_op->sync_fs (upper_sb, wait); + ret =sync_filesystem (upper_sb);up_read (&upper_sb->s_umount); +return ret; }