mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
vfs: Fix sys_sync() and fsync_super() reliability (version 4)
So far, do_sync() called: sync_inodes(0); sync_supers(); sync_filesystems(0); sync_filesystems(1); sync_inodes(1); This ordering makes it kind of hard for filesystems as sync_inodes(0) need not submit all the IO (for example it skips inodes with I_SYNC set) so e.g. forcing transaction to disk in ->sync_fs() is not really enough. Therefore sys_sync has not been completely reliable on some filesystems (ext3, ext4, reiserfs, ocfs2 and others are hit by this) when racing e.g. with background writeback. A similar problem hits also other filesystems (e.g. ext2) because of write_supers() being called before the sync_inodes(1). Change the ordering of calls in do_sync() - this requires a new function sync_blockdevs() to preserve the property that block devices are always synced after write_super() / sync_fs() call. The same issue is fixed in __fsync_super() function used on umount / remount read-only. [AV: build fixes] Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
876a9f76ab
commit
5a3e5cb8e0
3 changed files with 40 additions and 2 deletions
|
|
@ -71,3 +71,12 @@ extern void chroot_fs_refs(struct path *, struct path *);
|
|||
* file_table.c
|
||||
*/
|
||||
extern void mark_files_ro(struct super_block *);
|
||||
|
||||
/*
|
||||
* super.c
|
||||
*/
|
||||
#ifdef CONFIG_BLOCK
|
||||
extern void sync_blockdevs(void);
|
||||
#else
|
||||
static inline void sync_blockdevs(void) { }
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue