Skip to content

Commit 626d1a1

Browse files
committed
Merge tag 'ceph-for-6.14-rc1' of https://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "A fix for a memory leak from Antoine (marked for stable) and two cleanups from Liang and Slava" * tag 'ceph-for-6.14-rc1' of https://github.com/ceph/ceph-client: ceph: exchange hardcoded value on NAME_MAX ceph: streamline request head structures in MDS client ceph: fix memory leak in ceph_mds_auth_match()
2 parents 69b8923 + 3981be1 commit 626d1a1

File tree

3 files changed

+17
-31
lines changed

3 files changed

+17
-31
lines changed

fs/ceph/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
412412

413413
void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
414414
{
415-
char name[100];
415+
char name[NAME_MAX];
416416

417417
doutc(fsc->client, "begin\n");
418418
fsc->debugfs_congestion_kb =

fs/ceph/mds_client.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,12 +2948,12 @@ static struct ceph_mds_request_head_legacy *
29482948
find_legacy_request_head(void *p, u64 features)
29492949
{
29502950
bool legacy = !(features & CEPH_FEATURE_FS_BTIME);
2951-
struct ceph_mds_request_head_old *ohead;
2951+
struct ceph_mds_request_head *head;
29522952

29532953
if (legacy)
29542954
return (struct ceph_mds_request_head_legacy *)p;
2955-
ohead = (struct ceph_mds_request_head_old *)p;
2956-
return (struct ceph_mds_request_head_legacy *)&ohead->oldest_client_tid;
2955+
head = (struct ceph_mds_request_head *)p;
2956+
return (struct ceph_mds_request_head_legacy *)&head->oldest_client_tid;
29572957
}
29582958

29592959
/*
@@ -3023,7 +3023,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
30233023
if (legacy)
30243024
len = sizeof(struct ceph_mds_request_head_legacy);
30253025
else if (request_head_version == 1)
3026-
len = sizeof(struct ceph_mds_request_head_old);
3026+
len = offsetofend(struct ceph_mds_request_head, args);
30273027
else if (request_head_version == 2)
30283028
len = offsetofend(struct ceph_mds_request_head, ext_num_fwd);
30293029
else
@@ -3107,11 +3107,11 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
31073107
msg->hdr.version = cpu_to_le16(3);
31083108
p = msg->front.iov_base + sizeof(*lhead);
31093109
} else if (request_head_version == 1) {
3110-
struct ceph_mds_request_head_old *ohead = msg->front.iov_base;
3110+
struct ceph_mds_request_head *nhead = msg->front.iov_base;
31113111

31123112
msg->hdr.version = cpu_to_le16(4);
3113-
ohead->version = cpu_to_le16(1);
3114-
p = msg->front.iov_base + sizeof(*ohead);
3113+
nhead->version = cpu_to_le16(1);
3114+
p = msg->front.iov_base + offsetofend(struct ceph_mds_request_head, args);
31153115
} else if (request_head_version == 2) {
31163116
struct ceph_mds_request_head *nhead = msg->front.iov_base;
31173117

@@ -3268,7 +3268,7 @@ static int __prepare_send_request(struct ceph_mds_session *session,
32683268
* so we limit to retry at most 256 times.
32693269
*/
32703270
if (req->r_attempts) {
3271-
old_max_retry = sizeof_field(struct ceph_mds_request_head_old,
3271+
old_max_retry = sizeof_field(struct ceph_mds_request_head,
32723272
num_retry);
32733273
old_max_retry = 1 << (old_max_retry * BITS_PER_BYTE);
32743274
if ((old_version && req->r_attempts >= old_max_retry) ||
@@ -5693,18 +5693,18 @@ static int ceph_mds_auth_match(struct ceph_mds_client *mdsc,
56935693
*
56945694
* All the other cases --> mismatch
56955695
*/
5696+
bool path_matched = true;
56965697
char *first = strstr(_tpath, auth->match.path);
5697-
if (first != _tpath) {
5698-
if (free_tpath)
5699-
kfree(_tpath);
5700-
return 0;
5698+
if (first != _tpath ||
5699+
(tlen > len && _tpath[len] != '/')) {
5700+
path_matched = false;
57015701
}
57025702

5703-
if (tlen > len && _tpath[len] != '/') {
5704-
if (free_tpath)
5705-
kfree(_tpath);
5703+
if (free_tpath)
5704+
kfree(_tpath);
5705+
5706+
if (!path_matched)
57065707
return 0;
5707-
}
57085708
}
57095709
}
57105710

include/linux/ceph/ceph_fs.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -504,20 +504,6 @@ struct ceph_mds_request_head_legacy {
504504

505505
#define CEPH_MDS_REQUEST_HEAD_VERSION 3
506506

507-
struct ceph_mds_request_head_old {
508-
__le16 version; /* struct version */
509-
__le64 oldest_client_tid;
510-
__le32 mdsmap_epoch; /* on client */
511-
__le32 flags; /* CEPH_MDS_FLAG_* */
512-
__u8 num_retry, num_fwd; /* count retry, fwd attempts */
513-
__le16 num_releases; /* # include cap/lease release records */
514-
__le32 op; /* mds op code */
515-
__le32 caller_uid, caller_gid;
516-
__le64 ino; /* use this ino for openc, mkdir, mknod,
517-
etc. (if replaying) */
518-
union ceph_mds_request_args_ext args;
519-
} __attribute__ ((packed));
520-
521507
struct ceph_mds_request_head {
522508
__le16 version; /* struct version */
523509
__le64 oldest_client_tid;

0 commit comments

Comments
 (0)