mds_client.c (a5cbd5fc22d5043a8a76e15d75d031fe24d1f69c) mds_client.c (cd1a677cad994021b19665ed476aea63f5d54f31)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/fs.h>
5#include <linux/wait.h>
6#include <linux/slab.h>
7#include <linux/gfp.h>
8#include <linux/sched.h>

--- 5000 unchanged lines hidden (view full) ---

5009 mutex_lock(&mdsc->mutex);
5010 if (mdsc->mdsmap && epoch <= mdsc->mdsmap->m_epoch) {
5011 dout("handle_map epoch %u <= our %u\n",
5012 epoch, mdsc->mdsmap->m_epoch);
5013 mutex_unlock(&mdsc->mutex);
5014 return;
5015 }
5016
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/ceph/ceph_debug.h>
3
4#include <linux/fs.h>
5#include <linux/wait.h>
6#include <linux/slab.h>
7#include <linux/gfp.h>
8#include <linux/sched.h>

--- 5000 unchanged lines hidden (view full) ---

5009 mutex_lock(&mdsc->mutex);
5010 if (mdsc->mdsmap && epoch <= mdsc->mdsmap->m_epoch) {
5011 dout("handle_map epoch %u <= our %u\n",
5012 epoch, mdsc->mdsmap->m_epoch);
5013 mutex_unlock(&mdsc->mutex);
5014 return;
5015 }
5016
5017 newmap = ceph_mdsmap_decode(&p, end, false);
5017 newmap = ceph_mdsmap_decode(&p, end, ceph_msgr2(mdsc->fsc->client));
5018 if (IS_ERR(newmap)) {
5019 err = PTR_ERR(newmap);
5020 goto bad_unlock;
5021 }
5022
5023 /* swap into place */
5024 if (mdsc->mdsmap) {
5025 oldmap = mdsc->mdsmap;

--- 165 unchanged lines hidden (view full) ---

5191 struct ceph_mds_client *mdsc = s->s_mdsc;
5192 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
5193
5194 ceph_auth_invalidate_authorizer(ac, CEPH_ENTITY_TYPE_MDS);
5195
5196 return ceph_monc_validate_auth(&mdsc->fsc->client->monc);
5197}
5198
5018 if (IS_ERR(newmap)) {
5019 err = PTR_ERR(newmap);
5020 goto bad_unlock;
5021 }
5022
5023 /* swap into place */
5024 if (mdsc->mdsmap) {
5025 oldmap = mdsc->mdsmap;

--- 165 unchanged lines hidden (view full) ---

5191 struct ceph_mds_client *mdsc = s->s_mdsc;
5192 struct ceph_auth_client *ac = mdsc->fsc->client->monc.auth;
5193
5194 ceph_auth_invalidate_authorizer(ac, CEPH_ENTITY_TYPE_MDS);
5195
5196 return ceph_monc_validate_auth(&mdsc->fsc->client->monc);
5197}
5198
5199static int mds_get_auth_request(struct ceph_connection *con,
5200 void *buf, int *buf_len,
5201 void **authorizer, int *authorizer_len)
5202{
5203 struct ceph_mds_session *s = con->private;
5204 struct ceph_auth_client *ac = s->s_mdsc->fsc->client->monc.auth;
5205 struct ceph_auth_handshake *auth = &s->s_auth;
5206 int ret;
5207
5208 ret = ceph_auth_get_authorizer(ac, auth, CEPH_ENTITY_TYPE_MDS,
5209 buf, buf_len);
5210 if (ret)
5211 return ret;
5212
5213 *authorizer = auth->authorizer_buf;
5214 *authorizer_len = auth->authorizer_buf_len;
5215 return 0;
5216}
5217
5218static int mds_handle_auth_reply_more(struct ceph_connection *con,
5219 void *reply, int reply_len,
5220 void *buf, int *buf_len,
5221 void **authorizer, int *authorizer_len)
5222{
5223 struct ceph_mds_session *s = con->private;
5224 struct ceph_auth_client *ac = s->s_mdsc->fsc->client->monc.auth;
5225 struct ceph_auth_handshake *auth = &s->s_auth;
5226 int ret;
5227
5228 ret = ceph_auth_handle_svc_reply_more(ac, auth, reply, reply_len,
5229 buf, buf_len);
5230 if (ret)
5231 return ret;
5232
5233 *authorizer = auth->authorizer_buf;
5234 *authorizer_len = auth->authorizer_buf_len;
5235 return 0;
5236}
5237
5238static int mds_handle_auth_done(struct ceph_connection *con,
5239 u64 global_id, void *reply, int reply_len,
5240 u8 *session_key, int *session_key_len,
5241 u8 *con_secret, int *con_secret_len)
5242{
5243 struct ceph_mds_session *s = con->private;
5244 struct ceph_auth_client *ac = s->s_mdsc->fsc->client->monc.auth;
5245 struct ceph_auth_handshake *auth = &s->s_auth;
5246
5247 return ceph_auth_handle_svc_reply_done(ac, auth, reply, reply_len,
5248 session_key, session_key_len,
5249 con_secret, con_secret_len);
5250}
5251
5252static int mds_handle_auth_bad_method(struct ceph_connection *con,
5253 int used_proto, int result,
5254 const int *allowed_protos, int proto_cnt,
5255 const int *allowed_modes, int mode_cnt)
5256{
5257 struct ceph_mds_session *s = con->private;
5258 struct ceph_mon_client *monc = &s->s_mdsc->fsc->client->monc;
5259 int ret;
5260
5261 if (ceph_auth_handle_bad_authorizer(monc->auth, CEPH_ENTITY_TYPE_MDS,
5262 used_proto, result,
5263 allowed_protos, proto_cnt,
5264 allowed_modes, mode_cnt)) {
5265 ret = ceph_monc_validate_auth(monc);
5266 if (ret)
5267 return ret;
5268 }
5269
5270 return -EACCES;
5271}
5272
5199static struct ceph_msg *mds_alloc_msg(struct ceph_connection *con,
5200 struct ceph_msg_header *hdr, int *skip)
5201{
5202 struct ceph_msg *msg;
5203 int type = (int) le16_to_cpu(hdr->type);
5204 int front_len = (int) le32_to_cpu(hdr->front_len);
5205
5206 if (con->in_msg)

--- 33 unchanged lines hidden (view full) ---

5240 .get_authorizer = get_authorizer,
5241 .add_authorizer_challenge = add_authorizer_challenge,
5242 .verify_authorizer_reply = verify_authorizer_reply,
5243 .invalidate_authorizer = invalidate_authorizer,
5244 .peer_reset = peer_reset,
5245 .alloc_msg = mds_alloc_msg,
5246 .sign_message = mds_sign_message,
5247 .check_message_signature = mds_check_message_signature,
5273static struct ceph_msg *mds_alloc_msg(struct ceph_connection *con,
5274 struct ceph_msg_header *hdr, int *skip)
5275{
5276 struct ceph_msg *msg;
5277 int type = (int) le16_to_cpu(hdr->type);
5278 int front_len = (int) le32_to_cpu(hdr->front_len);
5279
5280 if (con->in_msg)

--- 33 unchanged lines hidden (view full) ---

5314 .get_authorizer = get_authorizer,
5315 .add_authorizer_challenge = add_authorizer_challenge,
5316 .verify_authorizer_reply = verify_authorizer_reply,
5317 .invalidate_authorizer = invalidate_authorizer,
5318 .peer_reset = peer_reset,
5319 .alloc_msg = mds_alloc_msg,
5320 .sign_message = mds_sign_message,
5321 .check_message_signature = mds_check_message_signature,
5322 .get_auth_request = mds_get_auth_request,
5323 .handle_auth_reply_more = mds_handle_auth_reply_more,
5324 .handle_auth_done = mds_handle_auth_done,
5325 .handle_auth_bad_method = mds_handle_auth_bad_method,
5248};
5249
5250/* eof */
5326};
5327
5328/* eof */