[v4,06/11] net/9p: fix bug in client create for .L

Message ID 20230218003323.2322580-7-ericvh@kernel.org
State New
Headers
Series Performance fixes for 9p filesystem |

Commit Message

Eric Van Hensbergen Feb. 18, 2023, 12:33 a.m. UTC
  We are supposed to set fid->mode to reflect the flags
that were used to open the file.  We were actually setting
it to the creation mode which is the default perms of the
file not the flags the file was opened with.

Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
---
 net/9p/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Dominique Martinet Feb. 18, 2023, 8:01 a.m. UTC | #1
Eric Van Hensbergen wrote on Sat, Feb 18, 2023 at 12:33:18AM +0000:
> We are supposed to set fid->mode to reflect the flags
> that were used to open the file.  We were actually setting
> it to the creation mode which is the default perms of the
> file not the flags the file was opened with.
> 
> Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>

I was about to say fcreate has the same problem, but TCREATE's mode
actually is the open mode (0 (called OREAD), 1 (OWRITE), 2 (ORDWR), and
3 (OEXEC)) and dotl's create is called perm :|

I guess that's where the mistake came from... Good catch!
(and there's also p9_wstat's mode which also is the perms to make things
more confusing...)


Anyway,
Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>
  

Patch

diff --git a/net/9p/client.c b/net/9p/client.c
index 6c2a768a6ab1..2adcb5e7b0e2 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1293,7 +1293,7 @@  int p9_client_create_dotl(struct p9_fid *ofid, const char *name, u32 flags,
 		 qid->type, qid->path, qid->version, iounit);
 
 	memmove(&ofid->qid, qid, sizeof(struct p9_qid));
-	ofid->mode = mode;
+	ofid->mode = flags;
 	ofid->iounit = iounit;
 
 free_and_error: