Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ceph-for-5.11-rc2' of git://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
"A fix for an edge case in MClientRequest encoding and a couple of
trivial fixups for the new msgr2 support"

* tag 'ceph-for-5.11-rc2' of git://github.com/ceph/ceph-client:
libceph: add __maybe_unused to DEFINE_MSGR2_FEATURE
libceph: align session_key and con_secret to 16 bytes
libceph: fix auth_signature buffer allocation in secure mode
ceph: reencode gid_list when reconnecting

+36 -36
+22 -31
fs/ceph/mds_client.c
··· 2475 2475 return r; 2476 2476 } 2477 2477 2478 + static void encode_timestamp_and_gids(void **p, 2479 + const struct ceph_mds_request *req) 2480 + { 2481 + struct ceph_timespec ts; 2482 + int i; 2483 + 2484 + ceph_encode_timespec64(&ts, &req->r_stamp); 2485 + ceph_encode_copy(p, &ts, sizeof(ts)); 2486 + 2487 + /* gid_list */ 2488 + ceph_encode_32(p, req->r_cred->group_info->ngroups); 2489 + for (i = 0; i < req->r_cred->group_info->ngroups; i++) 2490 + ceph_encode_64(p, from_kgid(&init_user_ns, 2491 + req->r_cred->group_info->gid[i])); 2492 + } 2493 + 2478 2494 /* 2479 2495 * called under mdsc->mutex 2480 2496 */ ··· 2507 2491 u64 ino1 = 0, ino2 = 0; 2508 2492 int pathlen1 = 0, pathlen2 = 0; 2509 2493 bool freepath1 = false, freepath2 = false; 2510 - int len, i; 2494 + int len; 2511 2495 u16 releases; 2512 2496 void *p, *end; 2513 2497 int ret; ··· 2533 2517 goto out_free1; 2534 2518 } 2535 2519 2536 - if (legacy) { 2537 - /* Old style */ 2538 - len = sizeof(*head); 2539 - } else { 2540 - /* New style: add gid_list and any later fields */ 2541 - len = sizeof(struct ceph_mds_request_head) + sizeof(u32) + 2542 - (sizeof(u64) * req->r_cred->group_info->ngroups); 2543 - } 2544 - 2520 + len = legacy ? sizeof(*head) : sizeof(struct ceph_mds_request_head); 2545 2521 len += pathlen1 + pathlen2 + 2*(1 + sizeof(u32) + sizeof(u64)) + 2546 2522 sizeof(struct ceph_timespec); 2523 + len += sizeof(u32) + (sizeof(u64) * req->r_cred->group_info->ngroups); 2547 2524 2548 2525 /* calculate (max) length for cap releases */ 2549 2526 len += sizeof(struct ceph_mds_request_release) * ··· 2557 2548 msg->hdr.tid = cpu_to_le64(req->r_tid); 2558 2549 2559 2550 /* 2560 - * The old ceph_mds_request_header didn't contain a version field, and 2551 + * The old ceph_mds_request_head didn't contain a version field, and 2561 2552 * one was added when we moved the message version from 3->4. 2562 2553 */ 2563 2554 if (legacy) { ··· 2618 2609 2619 2610 head->num_releases = cpu_to_le16(releases); 2620 2611 2621 - /* time stamp */ 2622 - { 2623 - struct ceph_timespec ts; 2624 - ceph_encode_timespec64(&ts, &req->r_stamp); 2625 - ceph_encode_copy(&p, &ts, sizeof(ts)); 2626 - } 2627 - 2628 - /* gid list */ 2629 - if (!legacy) { 2630 - ceph_encode_32(&p, req->r_cred->group_info->ngroups); 2631 - for (i = 0; i < req->r_cred->group_info->ngroups; i++) 2632 - ceph_encode_64(&p, from_kgid(&init_user_ns, 2633 - req->r_cred->group_info->gid[i])); 2634 - } 2612 + encode_timestamp_and_gids(&p, req); 2635 2613 2636 2614 if (WARN_ON_ONCE(p > end)) { 2637 2615 ceph_msg_put(msg); ··· 2726 2730 /* remove cap/dentry releases from message */ 2727 2731 rhead->num_releases = 0; 2728 2732 2729 - /* time stamp */ 2730 2733 p = msg->front.iov_base + req->r_request_release_offset; 2731 - { 2732 - struct ceph_timespec ts; 2733 - ceph_encode_timespec64(&ts, &req->r_stamp); 2734 - ceph_encode_copy(&p, &ts, sizeof(ts)); 2735 - } 2734 + encode_timestamp_and_gids(&p, req); 2736 2735 2737 2736 msg->front.iov_len = p - msg->front.iov_base; 2738 2737 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
+2 -2
include/linux/ceph/msgr.h
··· 33 33 #define CEPH_MSGR2_INCARNATION_1 (0ull) 34 34 35 35 #define DEFINE_MSGR2_FEATURE(bit, incarnation, name) \ 36 - static const uint64_t CEPH_MSGR2_FEATURE_##name = (1ULL << bit); \ 37 - static const uint64_t CEPH_MSGR2_FEATUREMASK_##name = \ 36 + static const uint64_t __maybe_unused CEPH_MSGR2_FEATURE_##name = (1ULL << bit); \ 37 + static const uint64_t __maybe_unused CEPH_MSGR2_FEATUREMASK_##name = \ 38 38 (1ULL << bit | CEPH_MSGR2_INCARNATION_##incarnation); 39 39 40 40 #define HAVE_MSGR2_FEATURE(x, name) \
+12 -3
net/ceph/messenger_v2.c
··· 1333 1333 void *buf; 1334 1334 int ret; 1335 1335 1336 - buf = alloc_conn_buf(con, head_onwire_len(SHA256_DIGEST_SIZE, false)); 1336 + buf = alloc_conn_buf(con, head_onwire_len(SHA256_DIGEST_SIZE, 1337 + con_secure(con))); 1337 1338 if (!buf) 1338 1339 return -ENOMEM; 1339 1340 ··· 2033 2032 return -EINVAL; 2034 2033 } 2035 2034 2035 + /* 2036 + * Align session_key and con_secret to avoid GFP_ATOMIC allocation 2037 + * inside crypto_shash_setkey() and crypto_aead_setkey() called from 2038 + * setup_crypto(). __aligned(16) isn't guaranteed to work for stack 2039 + * objects, so do it by hand. 2040 + */ 2036 2041 static int process_auth_done(struct ceph_connection *con, void *p, void *end) 2037 2042 { 2038 - u8 session_key[CEPH_KEY_LEN]; 2039 - u8 con_secret[CEPH_MAX_CON_SECRET_LEN]; 2043 + u8 session_key_buf[CEPH_KEY_LEN + 16]; 2044 + u8 con_secret_buf[CEPH_MAX_CON_SECRET_LEN + 16]; 2045 + u8 *session_key = PTR_ALIGN(&session_key_buf[0], 16); 2046 + u8 *con_secret = PTR_ALIGN(&con_secret_buf[0], 16); 2040 2047 int session_key_len, con_secret_len; 2041 2048 int payload_len; 2042 2049 u64 global_id;