[PATCH 4/5] vfs: call blkdev_issue_flush from generic file_fsync helper

Fernando Luis Vázquez Cao
2009-03-30T01:53:19Z

To ensure that bits are truly on-disk after an fsync or fdatasync
we should force a disk flush explicitly. This is necessary to
have data integrity guarantees in filesystems such as FAT which
do not provide their own fsync implementation and use the vfs
helper instead.

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
---

diff -urNp linux-2.6.29-orig/fs/sync.c linux-2.6.29/fs/sync.c
--- linux-2.6.29-orig/fs/sync.c 2009-03-24 08:12:14.000000000 +0900
+++ linux-2.6.29/fs/sync.c 2009-03-28 20:58:54.000000000 +0900
@@ -72,6 +72,11 @@ int file_fsync(struct file *filp, struct
err = sync_blockdev(sb->s_bdev);
if (!ret)
ret = err;
+
+ err = block_flush_device(sb);
+ if (!ret)
+ ret = err;
+
return ret;
}