Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alex Elder and committed by
Alex Elder
6c4a1915 ed96af64

+47 -41
+16 -16
fs/ceph/mds_client.c
··· 334 334 dout("mdsc put_session %p %d -> %d\n", s, 335 335 atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1); 336 336 if (atomic_dec_and_test(&s->s_ref)) { 337 - if (s->s_authorizer) 337 + if (s->s_auth.authorizer) 338 338 s->s_mdsc->fsc->client->monc.auth->ops->destroy_authorizer( 339 339 s->s_mdsc->fsc->client->monc.auth, 340 - s->s_authorizer); 340 + s->s_auth.authorizer); 341 341 kfree(s); 342 342 } 343 343 } ··· 3404 3404 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; 3405 3405 int ret = 0; 3406 3406 3407 - if (force_new && s->s_authorizer) { 3408 - ac->ops->destroy_authorizer(ac, s->s_authorizer); 3409 - s->s_authorizer = NULL; 3407 + if (force_new && s->s_auth.authorizer) { 3408 + ac->ops->destroy_authorizer(ac, s->s_auth.authorizer); 3409 + s->s_auth.authorizer = NULL; 3410 3410 } 3411 - if (s->s_authorizer == NULL) { 3411 + if (s->s_auth.authorizer == NULL) { 3412 3412 if (ac->ops->create_authorizer) { 3413 3413 ret = ac->ops->create_authorizer( 3414 3414 ac, CEPH_ENTITY_TYPE_MDS, 3415 - &s->s_authorizer, 3416 - &s->s_authorizer_buf, 3417 - &s->s_authorizer_buf_len, 3418 - &s->s_authorizer_reply_buf, 3419 - &s->s_authorizer_reply_buf_len); 3415 + &s->s_auth.authorizer, 3416 + &s->s_auth.authorizer_buf, 3417 + &s->s_auth.authorizer_buf_len, 3418 + &s->s_auth.authorizer_reply_buf, 3419 + &s->s_auth.authorizer_reply_buf_len); 3420 3420 if (ret) 3421 3421 return ret; 3422 3422 } 3423 3423 } 3424 3424 3425 3425 *proto = ac->protocol; 3426 - *buf = s->s_authorizer_buf; 3427 - *len = s->s_authorizer_buf_len; 3428 - *reply_buf = s->s_authorizer_reply_buf; 3429 - *reply_len = s->s_authorizer_reply_buf_len; 3426 + *buf = s->s_auth.authorizer_buf; 3427 + *len = s->s_auth.authorizer_buf_len; 3428 + *reply_buf = s->s_auth.authorizer_reply_buf; 3429 + *reply_len = s->s_auth.authorizer_reply_buf_len; 3430 3430 return 0; 3431 3431 } 3432 3432 ··· 3437 3437 struct ceph_mds_client *mdsc = s->s_mdsc; 3438 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 3443 3443 static int invalidate_authorizer(struct ceph_connection *con)
+2 -3
fs/ceph/mds_client.h
··· 11 11 #include <linux/ceph/types.h> 12 12 #include <linux/ceph/messenger.h> 13 13 #include <linux/ceph/mdsmap.h> 14 + #include <linux/ceph/auth.h> 14 15 15 16 /* 16 17 * Some lock dependencies: ··· 114 113 115 114 struct ceph_connection s_con; 116 115 117 - struct ceph_authorizer *s_authorizer; 118 - void *s_authorizer_buf, *s_authorizer_reply_buf; 119 - size_t s_authorizer_buf_len, s_authorizer_reply_buf_len; 116 + struct ceph_auth_handshake s_auth; 120 117 121 118 /* protected by s_gen_ttl_lock */ 122 119 spinlock_t s_gen_ttl_lock;
+8
include/linux/ceph/auth.h
··· 14 14 struct ceph_auth_client; 15 15 struct ceph_authorizer; 16 16 17 + struct ceph_auth_handshake { 18 + struct ceph_authorizer *authorizer; 19 + void *authorizer_buf; 20 + size_t authorizer_buf_len; 21 + void *authorizer_reply_buf; 22 + size_t authorizer_reply_buf_len; 23 + }; 24 + 17 25 struct ceph_auth_client_ops { 18 26 const char *name; 19 27
+5 -6
include/linux/ceph/osd_client.h
··· 6 6 #include <linux/mempool.h> 7 7 #include <linux/rbtree.h> 8 8 9 - #include "types.h" 10 - #include "osdmap.h" 11 - #include "messenger.h" 9 + #include <linux/ceph/types.h> 10 + #include <linux/ceph/osdmap.h> 11 + #include <linux/ceph/messenger.h> 12 + #include <linux/ceph/auth.h> 12 13 13 14 /* 14 15 * Maximum object name size ··· 41 40 struct list_head o_requests; 42 41 struct list_head o_linger_requests; 43 42 struct list_head o_osd_lru; 44 - struct ceph_authorizer *o_authorizer; 45 - void *o_authorizer_buf, *o_authorizer_reply_buf; 46 - size_t o_authorizer_buf_len, o_authorizer_reply_buf_len; 43 + struct ceph_auth_handshake o_auth; 47 44 unsigned long lru_ttl; 48 45 int o_marked_for_keepalive; 49 46 struct list_head o_keepalive_item;
+16 -16
net/ceph/osd_client.c
··· 667 667 if (atomic_dec_and_test(&osd->o_ref)) { 668 668 struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; 669 669 670 - if (osd->o_authorizer) 671 - ac->ops->destroy_authorizer(ac, osd->o_authorizer); 670 + if (osd->o_auth.authorizer) 671 + ac->ops->destroy_authorizer(ac, osd->o_auth.authorizer); 672 672 kfree(osd); 673 673 } 674 674 } ··· 2117 2117 struct ceph_auth_client *ac = osdc->client->monc.auth; 2118 2118 int ret = 0; 2119 2119 2120 - if (force_new && o->o_authorizer) { 2121 - ac->ops->destroy_authorizer(ac, o->o_authorizer); 2122 - o->o_authorizer = NULL; 2120 + if (force_new && o->o_auth.authorizer) { 2121 + ac->ops->destroy_authorizer(ac, o->o_auth.authorizer); 2122 + o->o_auth.authorizer = NULL; 2123 2123 } 2124 - if (o->o_authorizer == NULL) { 2124 + if (o->o_auth.authorizer == NULL) { 2125 2125 ret = ac->ops->create_authorizer( 2126 2126 ac, CEPH_ENTITY_TYPE_OSD, 2127 - &o->o_authorizer, 2128 - &o->o_authorizer_buf, 2129 - &o->o_authorizer_buf_len, 2130 - &o->o_authorizer_reply_buf, 2131 - &o->o_authorizer_reply_buf_len); 2127 + &o->o_auth.authorizer, 2128 + &o->o_auth.authorizer_buf, 2129 + &o->o_auth.authorizer_buf_len, 2130 + &o->o_auth.authorizer_reply_buf, 2131 + &o->o_auth.authorizer_reply_buf_len); 2132 2132 if (ret) 2133 2133 return ret; 2134 2134 } 2135 2135 2136 2136 *proto = ac->protocol; 2137 - *buf = o->o_authorizer_buf; 2138 - *len = o->o_authorizer_buf_len; 2139 - *reply_buf = o->o_authorizer_reply_buf; 2140 - *reply_len = o->o_authorizer_reply_buf_len; 2137 + *buf = o->o_auth.authorizer_buf; 2138 + *len = o->o_auth.authorizer_buf_len; 2139 + *reply_buf = o->o_auth.authorizer_reply_buf; 2140 + *reply_len = o->o_auth.authorizer_reply_buf_len; 2141 2141 return 0; 2142 2142 } 2143 2143 ··· 2148 2148 struct ceph_osd_client *osdc = o->o_osdc; 2149 2149 struct ceph_auth_client *ac = osdc->client->monc.auth; 2150 2150 2151 - return ac->ops->verify_authorizer_reply(ac, o->o_authorizer, len); 2151 + return ac->ops->verify_authorizer_reply(ac, o->o_auth.authorizer, len); 2152 2152 } 2153 2153 2154 2154 static int invalidate_authorizer(struct ceph_connection *con)