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)