From f8047f4736cd4c93e6557aa9169320b24333c2f2 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Mon, 8 Apr 2002 18:59:50 +0000 Subject: [PATCH] o Perform a BLKFLSBUF ioctl whenever a block device is closed. Patrick, can you see if this fixes your cluster syncing problem please ? If so I'll make it so it only syncs if you have actually written to the device. --- lib/device/dev-io.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index 6f49165ff..30447d3d6 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -96,6 +96,12 @@ int dev_open(struct device *dev, int flags) return 1; } +static void _flush(int fd) +{ + if (ioctl(fd, BLKFLSBUF, 0)) + log_error("couldn't flush device."); +} + int dev_close(struct device *dev) { if (dev->fd < 0) { @@ -104,6 +110,8 @@ int dev_close(struct device *dev) return 0; } + _flush(dev->fd); + if (close(dev->fd)) log_sys_error("close", dev_name(dev));