[Devel] [RFC 17/54] sync: fix CONFIG_VE=n build

Eva Kurchatova eva.kurchatova at virtuozzo.com
Wed Apr 29 22:58:17 MSK 2026


Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 fs/sync.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/sync.c b/fs/sync.c
index b851c6b48f6d..3eb05f9f2ba6 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -109,6 +109,7 @@ static void sync_fs_one_sb(struct super_block *sb, void *arg)
 	}
 }
 
+#ifdef CONFIG_VE
 static int __ve_fsync_behavior(struct ve_struct *ve)
 {
 	/*
@@ -134,6 +135,7 @@ int ve_fsync_behavior(void)
 	else
 		return __ve_fsync_behavior(ve);
 }
+#endif
 
 /*
  * Sync everything. We start by waking flusher threads so that most of
@@ -147,11 +149,12 @@ int ve_fsync_behavior(void)
  */
 void ksys_sync(void)
 {
-	struct ve_struct *ve = get_exec_env();
 	struct sync_arg sarg;
 
 	sarg.ve = NULL;
+#ifdef CONFIG_VE
 	if (!ve_is_super(ve)) {
+		struct ve_struct *ve = get_exec_env();
 		int fsb;
 		/*
 		 * init can't sync during VE stop. Rationale:
@@ -169,6 +172,7 @@ void ksys_sync(void)
 		if (fsb == FSYNC_FILTERED)
 			sarg.ve = ve;
 	}
+#endif
 
 	wakeup_flusher_threads(WB_REASON_SYNC);
 
@@ -269,12 +273,15 @@ SYSCALL_DEFINE1(syncfs, int, fd)
 	struct fd f = fdget(fd);
 	struct super_block *sb;
 	int ret = 0, ret2 = 0;
+#ifdef CONFIG_VE
 	struct ve_struct *ve;
+#endif
 
 	if (!fd_file(f))
 		return -EBADF;
 	sb = fd_file(f)->f_path.dentry->d_sb;
 
+#ifdef CONFIG_VE
 	ve = get_exec_env();
 
 	if (!ve_is_super(ve)) {
@@ -296,6 +303,7 @@ SYSCALL_DEFINE1(syncfs, int, fd)
 		if ((fsb == FSYNC_FILTERED) && !is_sb_ve_accessible(ve, sb))
 			goto fdput;
 	}
+#endif
 
 	down_read(&sb->s_umount);
 	ret = sync_filesystem(sb);
@@ -303,7 +311,9 @@ SYSCALL_DEFINE1(syncfs, int, fd)
 
 	ret2 = errseq_check_and_advance(&sb->s_wb_err, &fd_file(f)->f_sb_err);
 
+#ifdef CONFIG_VE
 fdput:
+#endif
 	fdput(f);
 	return ret ? ret : ret2;
 }
-- 
2.54.0



More information about the Devel mailing list