[Devel] [PATCH RH7 1/4] ve: remove sysctl_fsync_enable and use ve_fsync_behavior instead

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Jun 25 05:56:21 PDT 2015


- sysctl_fsync_enable is always = 2 and checking it is meaningless
- we already changed it with ve_fsync_behavior in setfl and dentry_open
- in do_fsync and syncfs we have both checks
- in msync replace
- in sync_file_range we don't need replacement according to patch
  diff-ve-fsync-behavior-sanitize:
    * Don't filter syncs in sync_file_range, since this syscall is
    not technically sync, then name is misleading

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 fs/sync.c          | 9 ---------
 include/linux/fs.h | 1 -
 mm/msync.c         | 2 +-
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/fs/sync.c b/fs/sync.c
index 45649b6..b5a2f58 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -24,8 +24,6 @@
 #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
 			SYNC_FILE_RANGE_WAIT_AFTER)
 
-int sysctl_fsync_enable = 2;
-
 /*
  * Do the filesystem syncing work. For simple filesystems
  * writeback_inodes_sb(sb) just dirties buffers with inodes so we have to
@@ -327,8 +325,6 @@ SYSCALL_DEFINE1(syncfs, int, fd)
 		if (is_child_reaper(task_pid(current)))
 			goto fdput;
 
-		if (!sysctl_fsync_enable)
-			goto fdput;
 		fsb = __ve_fsync_behavior(ve);
 		if (fsb == FSYNC_NEVER)
 			goto fdput;
@@ -405,8 +401,6 @@ static int do_fsync(unsigned int fd, int datasync)
 	struct fd f;
 	int ret = -EBADF;
 
-	if (!ve_is_super(get_exec_env()) && !sysctl_fsync_enable)
-		return 0;
 	if (ve_fsync_behavior() == FSYNC_NEVER)
 		return 0;
 
@@ -502,9 +496,6 @@ SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
 	loff_t endbyte;			/* inclusive */
 	umode_t i_mode;
 
-	if (!ve_is_super(get_exec_env()) && !sysctl_fsync_enable)
- 		return 0;
-
 	ret = -EINVAL;
 	if (flags & ~VALID_FLAGS)
 		goto out;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index fdade5c..9bdf99f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -58,7 +58,6 @@ extern struct inodes_stat_t inodes_stat;
 extern int leases_enable, lease_break_time;
 extern int sysctl_protected_symlinks;
 extern int sysctl_protected_hardlinks;
-extern int sysctl_fsync_enable;
 
 struct buffer_head;
 typedef int (get_block_t)(struct inode *inode, sector_t iblock,
diff --git a/mm/msync.c b/mm/msync.c
index b7d634a..f47b2d7 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -48,7 +48,7 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
 	if (end < start)
 		goto out;
 	error = 0;
-	if (!ve_is_super(get_exec_env()) && !sysctl_fsync_enable)
+	if (ve_fsync_behavior() == FSYNC_NEVER)
 		goto out;
 	if (end == start)
 		goto out;
-- 
1.9.3




More information about the Devel mailing list