From 1bb43a5cdcb48dc9a8add0d1c94e627cd76f80f6 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Tue, 22 Mar 2022 10:22:01 +0100 Subject: [PATCH] Clean up flags in opendir (downstream) Clean up O_RDWR and O_WRONLY flags in opendir to work around a bug in the Windows virtio-fs guest driver. Resolves: rhbz#2057252 Signed-off-by: Sergio Lopez --- src/passthrough/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/passthrough/mod.rs b/src/passthrough/mod.rs index b2b265c..6e4b236 100644 --- a/src/passthrough/mod.rs +++ b/src/passthrough/mod.rs @@ -1133,7 +1133,10 @@ impl FileSystem for PassthroughFs { inode: Inode, flags: u32, ) -> io::Result<(Option, OpenOptions)> { - self.do_open(inode, false, flags | (libc::O_DIRECTORY as u32)) + // Clean up O_RDWR and O_WRONLY from flags to work around a bug in the Windows + // virtio-fs guest driver. BZ#2057252 + let clean_flags: u32 = flags & !((libc::O_RDWR | libc::O_WRONLY) as u32); + self.do_open(inode, false, clean_flags | (libc::O_DIRECTORY as u32)) } fn releasedir( -- 2.35.1