@@ -2948,12 +2948,12 @@ static struct ceph_mds_request_head_legacy *
2948
2948
find_legacy_request_head (void * p , u64 features )
2949
2949
{
2950
2950
bool legacy = !(features & CEPH_FEATURE_FS_BTIME );
2951
- struct ceph_mds_request_head_old * ohead ;
2951
+ struct ceph_mds_request_head * head ;
2952
2952
2953
2953
if (legacy )
2954
2954
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 ;
2957
2957
}
2958
2958
2959
2959
/*
@@ -3023,7 +3023,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
3023
3023
if (legacy )
3024
3024
len = sizeof (struct ceph_mds_request_head_legacy );
3025
3025
else if (request_head_version == 1 )
3026
- len = sizeof (struct ceph_mds_request_head_old );
3026
+ len = offsetofend (struct ceph_mds_request_head , args );
3027
3027
else if (request_head_version == 2 )
3028
3028
len = offsetofend (struct ceph_mds_request_head , ext_num_fwd );
3029
3029
else
@@ -3107,11 +3107,11 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
3107
3107
msg -> hdr .version = cpu_to_le16 (3 );
3108
3108
p = msg -> front .iov_base + sizeof (* lhead );
3109
3109
} 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 ;
3111
3111
3112
3112
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 );
3115
3115
} else if (request_head_version == 2 ) {
3116
3116
struct ceph_mds_request_head * nhead = msg -> front .iov_base ;
3117
3117
@@ -3268,7 +3268,7 @@ static int __prepare_send_request(struct ceph_mds_session *session,
3268
3268
* so we limit to retry at most 256 times.
3269
3269
*/
3270
3270
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 ,
3272
3272
num_retry );
3273
3273
old_max_retry = 1 << (old_max_retry * BITS_PER_BYTE );
3274
3274
if ((old_version && req -> r_attempts >= old_max_retry ) ||
@@ -5693,18 +5693,18 @@ static int ceph_mds_auth_match(struct ceph_mds_client *mdsc,
5693
5693
*
5694
5694
* All the other cases --> mismatch
5695
5695
*/
5696
+ bool path_matched = true;
5696
5697
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;
5701
5701
}
5702
5702
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 )
5706
5707
return 0 ;
5707
- }
5708
5708
}
5709
5709
}
5710
5710
0 commit comments