Blame SOURCES/Clean-up-flags-in-opendir-downstream.patch

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