diff options
| -rw-r--r-- | fs/ceph/mds_client.c | 14 | ||||
| -rw-r--r-- | net/ceph/osd_client.c | 15 |
2 files changed, 16 insertions, 13 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index b71ffd2c8094..462281742aef 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
| @@ -3406,16 +3406,14 @@ static int get_authorizer(struct ceph_connection *con, | |||
| 3406 | int ret = 0; | 3406 | int ret = 0; |
| 3407 | 3407 | ||
| 3408 | if (force_new && auth->authorizer) { | 3408 | if (force_new && auth->authorizer) { |
| 3409 | ac->ops->destroy_authorizer(ac, auth->authorizer); | 3409 | if (ac->ops && ac->ops->destroy_authorizer) |
| 3410 | ac->ops->destroy_authorizer(ac, auth->authorizer); | ||
| 3410 | auth->authorizer = NULL; | 3411 | auth->authorizer = NULL; |
| 3411 | } | 3412 | } |
| 3412 | if (auth->authorizer == NULL) { | 3413 | if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) { |
| 3413 | if (ac->ops->create_authorizer) { | 3414 | ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS, auth); |
| 3414 | ret = ac->ops->create_authorizer(ac, | 3415 | if (ret) |
| 3415 | CEPH_ENTITY_TYPE_MDS, auth); | 3416 | return ret; |
| 3416 | if (ret) | ||
| 3417 | return ret; | ||
| 3418 | } | ||
| 3419 | } | 3417 | } |
| 3420 | 3418 | ||
| 3421 | *proto = ac->protocol; | 3419 | *proto = ac->protocol; |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 2da4b9e97dc1..f640bdf027e7 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -664,10 +664,10 @@ static void put_osd(struct ceph_osd *osd) | |||
| 664 | { | 664 | { |
| 665 | dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref), | 665 | dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref), |
| 666 | atomic_read(&osd->o_ref) - 1); | 666 | atomic_read(&osd->o_ref) - 1); |
| 667 | if (atomic_dec_and_test(&osd->o_ref)) { | 667 | if (atomic_dec_and_test(&osd->o_ref) && osd->o_auth.authorizer) { |
| 668 | struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; | 668 | struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; |
| 669 | 669 | ||
| 670 | if (osd->o_auth.authorizer) | 670 | if (ac->ops && ac->ops->destroy_authorizer) |
| 671 | ac->ops->destroy_authorizer(ac, osd->o_auth.authorizer); | 671 | ac->ops->destroy_authorizer(ac, osd->o_auth.authorizer); |
| 672 | kfree(osd); | 672 | kfree(osd); |
| 673 | } | 673 | } |
| @@ -2119,10 +2119,11 @@ static int get_authorizer(struct ceph_connection *con, | |||
| 2119 | int ret = 0; | 2119 | int ret = 0; |
| 2120 | 2120 | ||
| 2121 | if (force_new && auth->authorizer) { | 2121 | if (force_new && auth->authorizer) { |
| 2122 | ac->ops->destroy_authorizer(ac, auth->authorizer); | 2122 | if (ac->ops && ac->ops->destroy_authorizer) |
| 2123 | ac->ops->destroy_authorizer(ac, auth->authorizer); | ||
| 2123 | auth->authorizer = NULL; | 2124 | auth->authorizer = NULL; |
| 2124 | } | 2125 | } |
| 2125 | if (auth->authorizer == NULL) { | 2126 | if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) { |
| 2126 | ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_OSD, auth); | 2127 | ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_OSD, auth); |
| 2127 | if (ret) | 2128 | if (ret) |
| 2128 | return ret; | 2129 | return ret; |
| @@ -2144,6 +2145,10 @@ static int verify_authorizer_reply(struct ceph_connection *con, int len) | |||
| 2144 | struct ceph_osd_client *osdc = o->o_osdc; | 2145 | struct ceph_osd_client *osdc = o->o_osdc; |
| 2145 | struct ceph_auth_client *ac = osdc->client->monc.auth; | 2146 | struct ceph_auth_client *ac = osdc->client->monc.auth; |
| 2146 | 2147 | ||
| 2148 | /* | ||
| 2149 | * XXX If ac->ops or ac->ops->verify_authorizer_reply is null, | ||
| 2150 | * XXX which do we do: succeed or fail? | ||
| 2151 | */ | ||
| 2147 | return ac->ops->verify_authorizer_reply(ac, o->o_auth.authorizer, len); | 2152 | return ac->ops->verify_authorizer_reply(ac, o->o_auth.authorizer, len); |
| 2148 | } | 2153 | } |
| 2149 | 2154 | ||
| @@ -2153,7 +2158,7 @@ static int invalidate_authorizer(struct ceph_connection *con) | |||
| 2153 | struct ceph_osd_client *osdc = o->o_osdc; | 2158 | struct ceph_osd_client *osdc = o->o_osdc; |
| 2154 | struct ceph_auth_client *ac = osdc->client->monc.auth; | 2159 | struct ceph_auth_client *ac = osdc->client->monc.auth; |
| 2155 | 2160 | ||
| 2156 | if (ac->ops->invalidate_authorizer) | 2161 | if (ac->ops && ac->ops->invalidate_authorizer) |
| 2157 | ac->ops->invalidate_authorizer(ac, CEPH_ENTITY_TYPE_OSD); | 2162 | ac->ops->invalidate_authorizer(ac, CEPH_ENTITY_TYPE_OSD); |
| 2158 | 2163 | ||
| 2159 | return ceph_monc_validate_auth(&osdc->client->monc); | 2164 | return ceph_monc_validate_auth(&osdc->client->monc); |
