diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-08 10:30:16 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-08 10:30:16 -0500 |
commit | d1def9a4b193fe31ca877d47ff882146b8e55f26 (patch) | |
tree | 937a1103f5e84bb9983a34de736214ca479adffe | |
parent | 3deb1e0b17728ea273a45b60c9ee464b7465ddd0 (diff) | |
download | bcachefs-tools-d1def9a4b193fe31ca877d47ff882146b8e55f26.tar.gz |
linux shim: Fix dropped O_DIRECT flag
A recent libbcachefs update accidentally committed a change that dropped
the O_DIRECT flag - we definitely didn't want to do that.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | linux/blkdev.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/linux/blkdev.c b/linux/blkdev.c index 805d55db..45b03fba 100644 --- a/linux/blkdev.c +++ b/linux/blkdev.c @@ -192,7 +192,7 @@ struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, if (buffered_fd < 0) return ERR_PTR(-errno); - fd = open(path, flags); + fd = open(path, flags|O_DIRECT); if (fd < 0) fd = dup(buffered_fd); if (fd < 0) { @@ -200,7 +200,7 @@ struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, return ERR_PTR(-errno); } - sync_fd = open(path, flags|O_SYNC); + sync_fd = open(path, flags|O_DIRECT|O_SYNC); if (sync_fd < 0) sync_fd = open(path, flags|O_SYNC); if (sync_fd < 0) { |