summaryrefslogtreecommitdiff
path: root/linux/blkdev.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-05-05 00:27:01 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-05-05 00:27:50 -0800
commite004b95b88ae95cf7bb26bd7dc80c5dcf2b2664a (patch)
treebfa21c820a15686c5dd93293d38dfb8f19cdd46c /linux/blkdev.c
parent5db58a0baee8e732b9dc8a90dd4a739253e758a5 (diff)
fix sync writes - don't use O_EXCL
Diffstat (limited to 'linux/blkdev.c')
-rw-r--r--linux/blkdev.c6
1 files changed, 5 insertions, 1 deletions
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);
}