osd_client.c (a5cbd5fc22d5043a8a76e15d75d031fe24d1f69c) osd_client.c (cd1a677cad994021b19665ed476aea63f5d54f31)
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/ceph/ceph_debug.h>
4
5#include <linux/module.h>
6#include <linux/err.h>
7#include <linux/highmem.h>
8#include <linux/mm.h>

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

3913 struct rb_node *n;
3914 bool skipped_map = false;
3915 bool was_full;
3916
3917 was_full = ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL);
3918 set_pool_was_full(osdc);
3919
3920 if (incremental)
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/ceph/ceph_debug.h>
4
5#include <linux/module.h>
6#include <linux/err.h>
7#include <linux/highmem.h>
8#include <linux/mm.h>

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

3913 struct rb_node *n;
3914 bool skipped_map = false;
3915 bool was_full;
3916
3917 was_full = ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL);
3918 set_pool_was_full(osdc);
3919
3920 if (incremental)
3921 newmap = osdmap_apply_incremental(&p, end, false, osdc->osdmap);
3921 newmap = osdmap_apply_incremental(&p, end,
3922 ceph_msgr2(osdc->client),
3923 osdc->osdmap);
3922 else
3924 else
3923 newmap = ceph_osdmap_decode(&p, end, false);
3925 newmap = ceph_osdmap_decode(&p, end, ceph_msgr2(osdc->client));
3924 if (IS_ERR(newmap))
3925 return PTR_ERR(newmap);
3926
3927 if (newmap != osdc->osdmap) {
3928 /*
3929 * Preserve ->was_full before destroying the old map.
3930 * For pools that weren't in the old map, ->was_full
3931 * should be false.

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

5570{
5571 struct ceph_osd *osd = con->private;
5572 put_osd(osd);
5573}
5574
5575/*
5576 * authentication
5577 */
3926 if (IS_ERR(newmap))
3927 return PTR_ERR(newmap);
3928
3929 if (newmap != osdc->osdmap) {
3930 /*
3931 * Preserve ->was_full before destroying the old map.
3932 * For pools that weren't in the old map, ->was_full
3933 * should be false.

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

5572{
5573 struct ceph_osd *osd = con->private;
5574 put_osd(osd);
5575}
5576
5577/*
5578 * authentication
5579 */
5580
5578/*
5579 * Note: returned pointer is the address of a structure that's
5580 * managed separately. Caller must *not* attempt to free it.
5581 */
5582static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con,
5583 int *proto, int force_new)
5584{
5585 struct ceph_osd *o = con->private;

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

5635 struct ceph_osd *o = con->private;
5636 struct ceph_osd_client *osdc = o->o_osdc;
5637 struct ceph_auth_client *ac = osdc->client->monc.auth;
5638
5639 ceph_auth_invalidate_authorizer(ac, CEPH_ENTITY_TYPE_OSD);
5640 return ceph_monc_validate_auth(&osdc->client->monc);
5641}
5642
5581/*
5582 * Note: returned pointer is the address of a structure that's
5583 * managed separately. Caller must *not* attempt to free it.
5584 */
5585static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con,
5586 int *proto, int force_new)
5587{
5588 struct ceph_osd *o = con->private;

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

5638 struct ceph_osd *o = con->private;
5639 struct ceph_osd_client *osdc = o->o_osdc;
5640 struct ceph_auth_client *ac = osdc->client->monc.auth;
5641
5642 ceph_auth_invalidate_authorizer(ac, CEPH_ENTITY_TYPE_OSD);
5643 return ceph_monc_validate_auth(&osdc->client->monc);
5644}
5645
5646static int osd_get_auth_request(struct ceph_connection *con,
5647 void *buf, int *buf_len,
5648 void **authorizer, int *authorizer_len)
5649{
5650 struct ceph_osd *o = con->private;
5651 struct ceph_auth_client *ac = o->o_osdc->client->monc.auth;
5652 struct ceph_auth_handshake *auth = &o->o_auth;
5653 int ret;
5654
5655 ret = ceph_auth_get_authorizer(ac, auth, CEPH_ENTITY_TYPE_OSD,
5656 buf, buf_len);
5657 if (ret)
5658 return ret;
5659
5660 *authorizer = auth->authorizer_buf;
5661 *authorizer_len = auth->authorizer_buf_len;
5662 return 0;
5663}
5664
5665static int osd_handle_auth_reply_more(struct ceph_connection *con,
5666 void *reply, int reply_len,
5667 void *buf, int *buf_len,
5668 void **authorizer, int *authorizer_len)
5669{
5670 struct ceph_osd *o = con->private;
5671 struct ceph_auth_client *ac = o->o_osdc->client->monc.auth;
5672 struct ceph_auth_handshake *auth = &o->o_auth;
5673 int ret;
5674
5675 ret = ceph_auth_handle_svc_reply_more(ac, auth, reply, reply_len,
5676 buf, buf_len);
5677 if (ret)
5678 return ret;
5679
5680 *authorizer = auth->authorizer_buf;
5681 *authorizer_len = auth->authorizer_buf_len;
5682 return 0;
5683}
5684
5685static int osd_handle_auth_done(struct ceph_connection *con,
5686 u64 global_id, void *reply, int reply_len,
5687 u8 *session_key, int *session_key_len,
5688 u8 *con_secret, int *con_secret_len)
5689{
5690 struct ceph_osd *o = con->private;
5691 struct ceph_auth_client *ac = o->o_osdc->client->monc.auth;
5692 struct ceph_auth_handshake *auth = &o->o_auth;
5693
5694 return ceph_auth_handle_svc_reply_done(ac, auth, reply, reply_len,
5695 session_key, session_key_len,
5696 con_secret, con_secret_len);
5697}
5698
5699static int osd_handle_auth_bad_method(struct ceph_connection *con,
5700 int used_proto, int result,
5701 const int *allowed_protos, int proto_cnt,
5702 const int *allowed_modes, int mode_cnt)
5703{
5704 struct ceph_osd *o = con->private;
5705 struct ceph_mon_client *monc = &o->o_osdc->client->monc;
5706 int ret;
5707
5708 if (ceph_auth_handle_bad_authorizer(monc->auth, CEPH_ENTITY_TYPE_OSD,
5709 used_proto, result,
5710 allowed_protos, proto_cnt,
5711 allowed_modes, mode_cnt)) {
5712 ret = ceph_monc_validate_auth(monc);
5713 if (ret)
5714 return ret;
5715 }
5716
5717 return -EACCES;
5718}
5719
5643static void osd_reencode_message(struct ceph_msg *msg)
5644{
5645 int type = le16_to_cpu(msg->hdr.type);
5646
5647 if (type == CEPH_MSG_OSD_OP)
5648 encode_request_finish(msg);
5649}
5650

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

5672 .add_authorizer_challenge = add_authorizer_challenge,
5673 .verify_authorizer_reply = verify_authorizer_reply,
5674 .invalidate_authorizer = invalidate_authorizer,
5675 .alloc_msg = alloc_msg,
5676 .reencode_message = osd_reencode_message,
5677 .sign_message = osd_sign_message,
5678 .check_message_signature = osd_check_message_signature,
5679 .fault = osd_fault,
5720static void osd_reencode_message(struct ceph_msg *msg)
5721{
5722 int type = le16_to_cpu(msg->hdr.type);
5723
5724 if (type == CEPH_MSG_OSD_OP)
5725 encode_request_finish(msg);
5726}
5727

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

5749 .add_authorizer_challenge = add_authorizer_challenge,
5750 .verify_authorizer_reply = verify_authorizer_reply,
5751 .invalidate_authorizer = invalidate_authorizer,
5752 .alloc_msg = alloc_msg,
5753 .reencode_message = osd_reencode_message,
5754 .sign_message = osd_sign_message,
5755 .check_message_signature = osd_check_message_signature,
5756 .fault = osd_fault,
5757 .get_auth_request = osd_get_auth_request,
5758 .handle_auth_reply_more = osd_handle_auth_reply_more,
5759 .handle_auth_done = osd_handle_auth_done,
5760 .handle_auth_bad_method = osd_handle_auth_bad_method,
5680};
5761};