From fe451a01e888b6dcd8f5240dadb93692a1244fad Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 28 Apr 2003 16:20:39 +0000 Subject: [PATCH] Try alternative syncs if BLKFLSBUF fails. --- lib/device/dev-io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index 8a8c47ad9..8281dc76a 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -72,7 +72,13 @@ int dev_get_sectsize(struct device *dev, uint32_t *size) static void _flush(int fd) { - ioctl(fd, BLKFLSBUF, 0); + if (ioctl(fd, BLKFLSBUF, 0) >= 0) + return; + + if (fsync(fd) >= 0) + return; + + sync(); } int dev_open(struct device *dev, int flags)