[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210923130814.140814-11-cgxu519@mykernel.net>
Date: Thu, 23 Sep 2021 21:08:14 +0800
From: Chengguang Xu <cgxu519@...ernel.net>
To: miklos@...redi.hu, jack@...e.cz, amir73il@...il.com
Cc: linux-fsdevel@...r.kernel.org, linux-unionfs@...r.kernel.org,
linux-kernel@...r.kernel.org, Chengguang Xu <cgxu519@...ernel.net>
Subject: [RFC PATCH v5 10/10] ovl: implement containerized syncfs for overlayfs
Now overlayfs can sync proper dirty inodes during syncfs,
so remove unnecessary sync_filesystem() on upper file
system.
Signed-off-by: Chengguang Xu <cgxu519@...ernel.net>
---
fs/overlayfs/super.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index bf4000eb9be8..ef998ada6cb9 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -15,6 +15,7 @@
#include <linux/seq_file.h>
#include <linux/posix_acl_xattr.h>
#include <linux/exportfs.h>
+#include <linux/writeback.h>
#include "overlayfs.h"
MODULE_AUTHOR("Miklos Szeredi <miklos@...redi.hu>");
@@ -281,18 +282,15 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
/*
* Not called for sync(2) call or an emergency sync (SB_I_SKIP_SYNC).
* All the super blocks will be iterated, including upper_sb.
- *
- * 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;
upper_sb = ovl_upper_mnt(ofs)->mnt_sb;
down_read(&upper_sb->s_umount);
- ret = sync_filesystem(upper_sb);
+ if (wait)
+ wait_sb_inodes(upper_sb);
+
+ ret = sync_fs_and_blockdev(upper_sb, wait);
up_read(&upper_sb->s_umount);
return ret;
--
2.27.0
Powered by blists - more mailing lists