aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-03-25 13:26:14 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:17:14 -0400
commit27859f9773e4a0b2042435b13400ee2c891a61f4 (patch)
tree28b8e7133959c88f4de89cc98eee2016874b1ca6 /fs/ceph
parent0bed9b5c523d577378b6f83eab5835fe30c27208 (diff)
libceph: wrap auth ops in wrapper functions
Use wrapper functions that check whether the auth op exists so that callers do not need a bunch of conditional checks. Simplifies the external interface. Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/mds_client.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 010ff83d640b..13ae44eaa980 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -365,9 +365,9 @@ void ceph_put_mds_session(struct ceph_mds_session *s)
365 atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1); 365 atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1);
366 if (atomic_dec_and_test(&s->s_ref)) { 366 if (atomic_dec_and_test(&s->s_ref)) {
367 if (s->s_auth.authorizer) 367 if (s->s_auth.authorizer)
368 s->s_mdsc->fsc->client->monc.auth->ops->destroy_authorizer( 368 ceph_auth_destroy_authorizer(
369 s->s_mdsc->fsc->client->monc.auth, 369 s->s_mdsc->fsc->client->monc.auth,
370 s->s_auth.authorizer); 370 s->s_auth.authorizer);
371 kfree(s); 371 kfree(s);
372 } 372 }
373} 373}
@@ -3439,18 +3439,17 @@ static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con,
3439 struct ceph_auth_handshake *auth = &s->s_auth; 3439 struct ceph_auth_handshake *auth = &s->s_auth;
3440 3440
3441 if (force_new && auth->authorizer) { 3441 if (force_new && auth->authorizer) {
3442 if (ac->ops && ac->ops->destroy_authorizer) 3442 ceph_auth_destroy_authorizer(ac, auth->authorizer);
3443 ac->ops->destroy_authorizer(ac, auth->authorizer);
3444 auth->authorizer = NULL; 3443 auth->authorizer = NULL;
3445 } 3444 }
3446 if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) { 3445 if (!auth->authorizer) {
3447 int ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS, 3446 int ret = ceph_auth_create_authorizer(ac, CEPH_ENTITY_TYPE_MDS,
3448 auth); 3447 auth);
3449 if (ret) 3448 if (ret)
3450 return ERR_PTR(ret); 3449 return ERR_PTR(ret);
3451 } else if (ac->ops && ac->ops_update_authorizer) { 3450 } else {
3452 int ret = ac->ops->update_authorizer(ac, CEPH_ENTITY_TYPE_MDS, 3451 int ret = ceph_auth_update_authorizer(ac, CEPH_ENTITY_TYPE_MDS,
3453 auth); 3452 auth);
3454 if (ret) 3453 if (ret)
3455 return ERR_PTR(ret); 3454 return ERR_PTR(ret);
3456 } 3455 }
@@ -3466,7 +3465,7 @@ static int verify_authorizer_reply(struct ceph_connection *con, int len)
3466 struct ceph_mds_client *mdsc = s->s_mdsc; 3465 struct ceph_mds_client *mdsc = s->s_mdsc;
3467 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; 3466 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
3468 3467
3469 return ac->ops->verify_authorizer_reply(ac, s->s_auth.authorizer, len); 3468 return ceph_auth_verify_authorizer_reply(ac, s->s_auth.authorizer, len);
3470} 3469}
3471 3470
3472static int invalidate_authorizer(struct ceph_connection *con) 3471static int invalidate_authorizer(struct ceph_connection *con)
@@ -3475,8 +3474,7 @@ static int invalidate_authorizer(struct ceph_connection *con)
3475 struct ceph_mds_client *mdsc = s->s_mdsc; 3474 struct ceph_mds_client *mdsc = s->s_mdsc;
3476 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; 3475 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
3477 3476
3478 if (ac->ops->invalidate_authorizer) 3477 ceph_auth_invalidate_authorizer(ac, CEPH_ENTITY_TYPE_MDS);
3479 ac->ops->invalidate_authorizer(ac, CEPH_ENTITY_TYPE_MDS);
3480 3478
3481 return ceph_monc_validate_auth(&mdsc->fsc->client->monc); 3479 return ceph_monc_validate_auth(&mdsc->fsc->client->monc);
3482} 3480}