diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sync.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/namei.h> | ||
10 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
11 | #include <linux/writeback.h> | 12 | #include <linux/writeback.h> |
12 | #include <linux/syscalls.h> | 13 | #include <linux/syscalls.h> |
@@ -128,6 +129,29 @@ void emergency_sync(void) | |||
128 | } | 129 | } |
129 | } | 130 | } |
130 | 131 | ||
132 | /* | ||
133 | * sync a single super | ||
134 | */ | ||
135 | SYSCALL_DEFINE1(syncfs, int, fd) | ||
136 | { | ||
137 | struct file *file; | ||
138 | struct super_block *sb; | ||
139 | int ret; | ||
140 | int fput_needed; | ||
141 | |||
142 | file = fget_light(fd, &fput_needed); | ||
143 | if (!file) | ||
144 | return -EBADF; | ||
145 | sb = file->f_dentry->d_sb; | ||
146 | |||
147 | down_read(&sb->s_umount); | ||
148 | ret = sync_filesystem(sb); | ||
149 | up_read(&sb->s_umount); | ||
150 | |||
151 | fput_light(file, fput_needed); | ||
152 | return ret; | ||
153 | } | ||
154 | |||
131 | /** | 155 | /** |
132 | * vfs_fsync_range - helper to sync a range of data & metadata to disk | 156 | * vfs_fsync_range - helper to sync a range of data & metadata to disk |
133 | * @file: file to sync | 157 | * @file: file to sync |