Commit b0930f8d authored by Sage Weil's avatar Sage Weil

ceph: remove bad auth_x kmem_cache

It's useless, since our allocations are already a power of 2.  And it was
allocated per-instance (not globally), which caused a name collision when
we tried to mount a second file system with auth_x enabled.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 7ff899da
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "auth.h" #include "auth.h"
#include "decode.h" #include "decode.h"
struct kmem_cache *ceph_x_ticketbuf_cachep;
#define TEMP_TICKET_BUF_LEN 256 #define TEMP_TICKET_BUF_LEN 256
static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed);
...@@ -131,13 +129,12 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, ...@@ -131,13 +129,12 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
char *ticket_buf; char *ticket_buf;
u8 struct_v; u8 struct_v;
dbuf = kmem_cache_alloc(ceph_x_ticketbuf_cachep, GFP_NOFS | GFP_ATOMIC); dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS);
if (!dbuf) if (!dbuf)
return -ENOMEM; return -ENOMEM;
ret = -ENOMEM; ret = -ENOMEM;
ticket_buf = kmem_cache_alloc(ceph_x_ticketbuf_cachep, ticket_buf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS);
GFP_NOFS | GFP_ATOMIC);
if (!ticket_buf) if (!ticket_buf)
goto out_dbuf; goto out_dbuf;
...@@ -251,9 +248,9 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, ...@@ -251,9 +248,9 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
ret = 0; ret = 0;
out: out:
kmem_cache_free(ceph_x_ticketbuf_cachep, ticket_buf); kfree(ticket_buf);
out_dbuf: out_dbuf:
kmem_cache_free(ceph_x_ticketbuf_cachep, dbuf); kfree(dbuf);
return ret; return ret;
bad: bad:
...@@ -605,8 +602,6 @@ static void ceph_x_destroy(struct ceph_auth_client *ac) ...@@ -605,8 +602,6 @@ static void ceph_x_destroy(struct ceph_auth_client *ac)
remove_ticket_handler(ac, th); remove_ticket_handler(ac, th);
} }
kmem_cache_destroy(ceph_x_ticketbuf_cachep);
kfree(ac->private); kfree(ac->private);
ac->private = NULL; ac->private = NULL;
} }
...@@ -641,26 +636,20 @@ int ceph_x_init(struct ceph_auth_client *ac) ...@@ -641,26 +636,20 @@ int ceph_x_init(struct ceph_auth_client *ac)
int ret; int ret;
dout("ceph_x_init %p\n", ac); dout("ceph_x_init %p\n", ac);
ret = -ENOMEM;
xi = kzalloc(sizeof(*xi), GFP_NOFS); xi = kzalloc(sizeof(*xi), GFP_NOFS);
if (!xi) if (!xi)
return -ENOMEM; goto out;
ret = -ENOMEM;
ceph_x_ticketbuf_cachep = kmem_cache_create("ceph_x_ticketbuf",
TEMP_TICKET_BUF_LEN, 8,
(SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD),
NULL);
if (!ceph_x_ticketbuf_cachep)
goto done_nomem;
ret = -EINVAL; ret = -EINVAL;
if (!ac->secret) { if (!ac->secret) {
pr_err("no secret set (for auth_x protocol)\n"); pr_err("no secret set (for auth_x protocol)\n");
goto done_nomem; goto out_nomem;
} }
ret = ceph_crypto_key_unarmor(&xi->secret, ac->secret); ret = ceph_crypto_key_unarmor(&xi->secret, ac->secret);
if (ret) if (ret)
goto done_nomem; goto out_nomem;
xi->starting = true; xi->starting = true;
xi->ticket_handlers = RB_ROOT; xi->ticket_handlers = RB_ROOT;
...@@ -670,10 +659,9 @@ int ceph_x_init(struct ceph_auth_client *ac) ...@@ -670,10 +659,9 @@ int ceph_x_init(struct ceph_auth_client *ac)
ac->ops = &ceph_x_ops; ac->ops = &ceph_x_ops;
return 0; return 0;
done_nomem: out_nomem:
kfree(xi); kfree(xi);
if (ceph_x_ticketbuf_cachep) out:
kmem_cache_destroy(ceph_x_ticketbuf_cachep);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment