Skip to contentSkip to conversation

fs/9p: Fix bit operation logic error

PATCH New Eric Van Hensbergen 1 participant 1 message Apr 26, 2023 9P file system

lore
Share & tools
lore

Eric Van Hensbergen

author maintainer
#0 lore raw

PATCH 1/1 fs/9p: Fix bit operation logic error

This re-introduces a fix that somehow got dropped during rebase of the current series in for-next. When writeback is enabled, opens are forced to support both read and write operations but with the logic error other flags may be dropped unintentionaly.

---
 fs/9p/vfs_inode.c      | 2 +-
 fs/9p/vfs_inode_dotl.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/9p/vfs_inode.c +1 -1
index 54dfe4f10f43..3791f642c502 100644
@@ -823,7 +823,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
 	p9_omode = v9fs_uflags2omode(flags, v9fs_proto_dotu(v9ses));
 
 	if ((v9ses->cache & CACHE_WRITEBACK) && (p9_omode & P9_OWRITE)) {
-		p9_omode = (p9_omode & !P9_OWRITE) | P9_ORDWR;
+		p9_omode = (p9_omode & ~P9_OWRITE) | P9_ORDWR;
 		p9_debug(P9_DEBUG_CACHE,
 			"write-only file with writeback enabled, creating w/ O_RDWR\n");
 	}
fs/9p/vfs_inode_dotl.c +1 -1
index f9371b5b70ea..3acf2bcb69cc 100644
@@ -288,7 +288,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
 	}
 
 	if ((v9ses->cache & CACHE_WRITEBACK) && (p9_omode & P9_OWRITE)) {
-		p9_omode = (p9_omode & !P9_OWRITE) | P9_ORDWR;
+		p9_omode = (p9_omode & ~P9_OWRITE) | P9_ORDWR;
 		p9_debug(P9_DEBUG_CACHE,
 			"write-only file with writeback enabled, creating w/ O_RDWR\n");
 	}

---
base-commit: 4eb3117888a923f6b9b1ad2dd093641c49a63ae5
change-id: 20230426-fix-bitops-c862099c8d28

Best regards,

Signature · 1 line
Eric Van Hensbergen <[email protected]>