From e004b95b88ae95cf7bb26bd7dc80c5dcf2b2664a Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 5 May 2017 00:27:01 -0800 Subject: fix sync writes - don't use O_EXCL --- linux/blkdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'linux/blkdev.c') diff --git a/linux/blkdev.c b/linux/blkdev.c index c0c8fd0d..7fe638f6 100644 --- a/linux/blkdev.c +++ b/linux/blkdev.c @@ -167,15 +167,19 @@ struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, else if (mode & FMODE_WRITE) flags = O_WRONLY; +#if 0 + /* using O_EXCL doesn't work with opening twice for an O_SYNC fd: */ if (mode & FMODE_EXCL) flags |= O_EXCL; +#endif fd = open(path, flags); if (fd < 0) return ERR_PTR(-errno); sync_fd = open(path, flags|O_SYNC); - if (fd < 0) { + if (sync_fd < 0) { + assert(0); close(fd); return ERR_PTR(-errno); } -- cgit v1.2.3