fs/9p: Fix bit operation logic error
authorEric Van Hensbergen <ericvh@kernel.org>
Wed, 26 Apr 2023 16:18:49 +0000 (16:18 +0000)
committerEric Van Hensbergen <ericvh@kernel.org>
Fri, 28 Apr 2023 16:59:26 +0000 (16:59 +0000)
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.

Reported-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c

index 54dfe4f10f4383eb9b57a37ca820adf4fe445159..3791f642c50238009a32b44933d796600a681167 100644 (file)
@@ -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");
        }
index f9371b5b70ea6e4c526b51cc610650d81ec58a7a..3acf2bcb69cc04233112d3a2c9504dbf020e6ea8 100644 (file)
@@ -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");
        }