aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-16 16:16:38 -0400
committerAlex Elder <elder@dreamhost.com>2012-05-17 09:18:12 -0400
commit6c4a19158b96ea1fb8acbe0c1d5493d9dcd2f147 (patch)
tree5fe6418eb57bf4e84f1eda9606a4a045ff08dcba /fs/ceph
parented96af646011412c2bf1ffe860db170db355fae5 (diff)
ceph: define ceph_auth_handshake type
The definitions for the ceph_mds_session and ceph_osd both contain five fields related only to "authorizers." Encapsulate those fields into their own struct type, allowing for better isolation in some upcoming patches. Fix the #includes in "linux/ceph/osd_client.h" to lay out their more complete canonical path. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/mds_client.c32
-rw-r--r--fs/ceph/mds_client.h5
2 files changed, 18 insertions, 19 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 89971e137aab..42013c620488 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -334,10 +334,10 @@ void ceph_put_mds_session(struct ceph_mds_session *s)
334 dout("mdsc put_session %p %d -> %d\n", s, 334 dout("mdsc put_session %p %d -> %d\n", s,
335 atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1); 335 atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1);
336 if (atomic_dec_and_test(&s->s_ref)) { 336 if (atomic_dec_and_test(&s->s_ref)) {
337 if (s->s_authorizer) 337 if (s->s_auth.authorizer)
338 s->s_mdsc->fsc->client->monc.auth->ops->destroy_authorizer( 338 s->s_mdsc->fsc->client->monc.auth->ops->destroy_authorizer(
339 s->s_mdsc->fsc->client->monc.auth, 339 s->s_mdsc->fsc->client->monc.auth,
340 s->s_authorizer); 340 s->s_auth.authorizer);
341 kfree(s); 341 kfree(s);
342 } 342 }
343} 343}
@@ -3404,29 +3404,29 @@ static int get_authorizer(struct ceph_connection *con,
3404 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; 3404 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
3405 int ret = 0; 3405 int ret = 0;
3406 3406
3407 if (force_new && s->s_authorizer) { 3407 if (force_new && s->s_auth.authorizer) {
3408 ac->ops->destroy_authorizer(ac, s->s_authorizer); 3408 ac->ops->destroy_authorizer(ac, s->s_auth.authorizer);
3409 s->s_authorizer = NULL; 3409 s->s_auth.authorizer = NULL;
3410 } 3410 }
3411 if (s->s_authorizer == NULL) { 3411 if (s->s_auth.authorizer == NULL) {
3412 if (ac->ops->create_authorizer) { 3412 if (ac->ops->create_authorizer) {
3413 ret = ac->ops->create_authorizer( 3413 ret = ac->ops->create_authorizer(
3414 ac, CEPH_ENTITY_TYPE_MDS, 3414 ac, CEPH_ENTITY_TYPE_MDS,
3415 &s->s_authorizer, 3415 &s->s_auth.authorizer,
3416 &s->s_authorizer_buf, 3416 &s->s_auth.authorizer_buf,
3417 &s->s_authorizer_buf_len, 3417 &s->s_auth.authorizer_buf_len,
3418 &s->s_authorizer_reply_buf, 3418 &s->s_auth.authorizer_reply_buf,
3419 &s->s_authorizer_reply_buf_len); 3419 &s->s_auth.authorizer_reply_buf_len);
3420 if (ret) 3420 if (ret)
3421 return ret; 3421 return ret;
3422 } 3422 }
3423 } 3423 }
3424 3424
3425 *proto = ac->protocol; 3425 *proto = ac->protocol;
3426 *buf = s->s_authorizer_buf; 3426 *buf = s->s_auth.authorizer_buf;
3427 *len = s->s_authorizer_buf_len; 3427 *len = s->s_auth.authorizer_buf_len;
3428 *reply_buf = s->s_authorizer_reply_buf; 3428 *reply_buf = s->s_auth.authorizer_reply_buf;
3429 *reply_len = s->s_authorizer_reply_buf_len; 3429 *reply_len = s->s_auth.authorizer_reply_buf_len;
3430 return 0; 3430 return 0;
3431} 3431}
3432 3432
@@ -3437,7 +3437,7 @@ static int verify_authorizer_reply(struct ceph_connection *con, int len)
3437 struct ceph_mds_client *mdsc = s->s_mdsc; 3437 struct ceph_mds_client *mdsc = s->s_mdsc;
3438 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; 3438 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
3439 3439
3440 return ac->ops->verify_authorizer_reply(ac, s->s_authorizer, len); 3440 return ac->ops->verify_authorizer_reply(ac, s->s_auth.authorizer, len);
3441} 3441}
3442 3442
3443static int invalidate_authorizer(struct ceph_connection *con) 3443static int invalidate_authorizer(struct ceph_connection *con)
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 8c7c04ebb595..dd26846dd71d 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -11,6 +11,7 @@
11#include <linux/ceph/types.h> 11#include <linux/ceph/types.h>
12#include <linux/ceph/messenger.h> 12#include <linux/ceph/messenger.h>
13#include <linux/ceph/mdsmap.h> 13#include <linux/ceph/mdsmap.h>
14#include <linux/ceph/auth.h>
14 15
15/* 16/*
16 * Some lock dependencies: 17 * Some lock dependencies:
@@ -113,9 +114,7 @@ struct ceph_mds_session {
113 114
114 struct ceph_connection s_con; 115 struct ceph_connection s_con;
115 116
116 struct ceph_authorizer *s_authorizer; 117 struct ceph_auth_handshake s_auth;
117 void *s_authorizer_buf, *s_authorizer_reply_buf;
118 size_t s_authorizer_buf_len, s_authorizer_reply_buf_len;
119 118
120 /* protected by s_gen_ttl_lock */ 119 /* protected by s_gen_ttl_lock */
121 spinlock_t s_gen_ttl_lock; 120 spinlock_t s_gen_ttl_lock;