lkml.org 
[lkml]   [2022]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] 9p: client_create: init fcall_cache earlier
Date
fcall cache was init'd last for some reason, but we actually allocate
some requests for the version check before that.
Moving the cache creation towards the start also makes p9_client_destroy's
order match the allocation order, which might be easier to think about

Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
net/9p/client.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index 40b59431a566..1ea326e6e271 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -977,6 +977,17 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
if (err < 0)
goto out;

+ /* P9_HDRSZ + 4 is the smallest packet header we can have that is
+ * followed by data accessed from userspace by read
+ * Note we do not check for failure here because the cache is
+ * optional; warning will be issued on dmesg for failure.
+ */
+ clnt->fcall_cache =
+ kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize,
+ 0, 0, P9_HDRSZ + 4,
+ clnt->msize - (P9_HDRSZ + 4),
+ NULL);
+
if (!clnt->trans_mod)
clnt->trans_mod = v9fs_get_default_trans();

@@ -1016,15 +1027,6 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
if (err)
goto out;

- /* P9_HDRSZ + 4 is the smallest packet header we can have that is
- * followed by data accessed from userspace by read
- */
- clnt->fcall_cache =
- kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize,
- 0, 0, P9_HDRSZ + 4,
- clnt->msize - (P9_HDRSZ + 4),
- NULL);
-
return clnt;

out:
--
2.35.1
\
 
 \ /
  Last update: 2022-09-28 23:47    [W:0.089 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site