From: Joe Thornber Date: Mon, 8 Apr 2002 18:59:50 +0000 (+0000) Subject: o Perform a BLKFLSBUF ioctl whenever a block device is closed. X-Git-Tag: v2_02_91~5623 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=f31c47ade8e62d34da28e6cfc789e1b9501d7003;p=lvm2.git 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. --- 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));