diff options
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 89971e137aab..200bc87eceb1 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 | } |
@@ -3395,39 +3395,33 @@ out: | |||
3395 | /* | 3395 | /* |
3396 | * authentication | 3396 | * authentication |
3397 | */ | 3397 | */ |
3398 | static int get_authorizer(struct ceph_connection *con, | 3398 | |
3399 | void **buf, int *len, int *proto, | 3399 | /* |
3400 | void **reply_buf, int *reply_len, int force_new) | 3400 | * Note: returned pointer is the address of a structure that's |
3401 | * managed separately. Caller must *not* attempt to free it. | ||
3402 | */ | ||
3403 | static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con, | ||
3404 | int *proto, int force_new) | ||
3401 | { | 3405 | { |
3402 | struct ceph_mds_session *s = con->private; | 3406 | struct ceph_mds_session *s = con->private; |
3403 | struct ceph_mds_client *mdsc = s->s_mdsc; | 3407 | struct ceph_mds_client *mdsc = s->s_mdsc; |
3404 | struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; | 3408 | struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; |
3405 | int ret = 0; | 3409 | struct ceph_auth_handshake *auth = &s->s_auth; |
3406 | |||
3407 | if (force_new && s->s_authorizer) { | ||
3408 | ac->ops->destroy_authorizer(ac, s->s_authorizer); | ||
3409 | s->s_authorizer = NULL; | ||
3410 | } | ||
3411 | if (s->s_authorizer == NULL) { | ||
3412 | if (ac->ops->create_authorizer) { | ||
3413 | ret = ac->ops->create_authorizer( | ||
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); | ||
3420 | if (ret) | ||
3421 | return ret; | ||
3422 | } | ||
3423 | } | ||
3424 | 3410 | ||
3411 | if (force_new && auth->authorizer) { | ||
3412 | if (ac->ops && ac->ops->destroy_authorizer) | ||
3413 | ac->ops->destroy_authorizer(ac, auth->authorizer); | ||
3414 | auth->authorizer = NULL; | ||
3415 | } | ||
3416 | if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) { | ||
3417 | int ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS, | ||
3418 | auth); | ||
3419 | if (ret) | ||
3420 | return ERR_PTR(ret); | ||
3421 | } | ||
3425 | *proto = ac->protocol; | 3422 | *proto = ac->protocol; |
3426 | *buf = s->s_authorizer_buf; | 3423 | |
3427 | *len = s->s_authorizer_buf_len; | 3424 | return auth; |
3428 | *reply_buf = s->s_authorizer_reply_buf; | ||
3429 | *reply_len = s->s_authorizer_reply_buf_len; | ||
3430 | return 0; | ||
3431 | } | 3425 | } |
3432 | 3426 | ||
3433 | 3427 | ||
@@ -3437,7 +3431,7 @@ static int verify_authorizer_reply(struct ceph_connection *con, int len) | |||
3437 | struct ceph_mds_client *mdsc = s->s_mdsc; | 3431 | struct ceph_mds_client *mdsc = s->s_mdsc; |
3438 | struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; | 3432 | struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth; |
3439 | 3433 | ||
3440 | return ac->ops->verify_authorizer_reply(ac, s->s_authorizer, len); | 3434 | return ac->ops->verify_authorizer_reply(ac, s->s_auth.authorizer, len); |
3441 | } | 3435 | } |
3442 | 3436 | ||
3443 | static int invalidate_authorizer(struct ceph_connection *con) | 3437 | static int invalidate_authorizer(struct ceph_connection *con) |