From 805f11a0d515658106bfbfadceff0eb30bd90ad2 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Sun, 18 Aug 2013 13:30:06 +0200 Subject: um: ubd: Add REQ_FLUSH suppport UML's block device driver does not support write barriers, to support this this patch adds REQ_FLUSH suppport. Every time the block layer sends a REQ_FLUSH we fsync() now our backing file to guarantee data consistency. Reported-and-tested-by: Richard W.M. Jones Signed-off-by: Richard Weinberger --- arch/um/os-Linux/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'arch/um/os-Linux') diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index c17bd6f7d674..07a750197bb0 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c @@ -266,6 +266,15 @@ int os_write_file(int fd, const void *buf, int len) return n; } +int os_sync_file(int fd) +{ + int n = fsync(fd); + + if (n < 0) + return -errno; + return n; +} + int os_file_size(const char *file, unsigned long long *size_out) { struct uml_stat buf; -- cgit v1.2.3