Bug #48618 » 0001-SQUASH-fix-reencoding-of-MClientRequest-for-retransm.patch
fs/ceph/mds_client.c | ||
---|---|---|
return r;
|
||
}
|
||
static struct ceph_mds_request_head_old *
|
||
find_old_request_head(void *p, bool legacy)
|
||
{
|
||
struct ceph_mds_request_head *new_head;
|
||
if (legacy)
|
||
return (struct ceph_mds_request_head_old *)p;
|
||
new_head = (struct ceph_mds_request_head *)p;
|
||
return (struct ceph_mds_request_head_old *)&new_head->oldest_client_tid;
|
||
}
|
||
static void encode_payload_tail(void **p, struct ceph_mds_request *req, bool legacy)
|
||
{
|
||
struct ceph_timespec ts;
|
||
ceph_encode_timespec64(&ts, &req->r_stamp);
|
||
ceph_encode_copy(p, &ts, sizeof(ts));
|
||
/* gid list */
|
||
if (!legacy) {
|
||
int i;
|
||
ceph_encode_32(p, req->r_cred->group_info->ngroups);
|
||
for (i = 0; i < req->r_cred->group_info->ngroups; i++)
|
||
ceph_encode_64(p, from_kgid(&init_user_ns,
|
||
req->r_cred->group_info->gid[i]));
|
||
}
|
||
}
|
||
/*
|
||
* called under mdsc->mutex
|
||
*/
|
||
... | ... | |
u64 ino1 = 0, ino2 = 0;
|
||
int pathlen1 = 0, pathlen2 = 0;
|
||
bool freepath1 = false, freepath2 = false;
|
||
int len, i;
|
||
int len;
|
||
u16 releases;
|
||
void *p, *end;
|
||
int ret;
|
||
... | ... | |
*/
|
||
if (legacy) {
|
||
msg->hdr.version = cpu_to_le16(3);
|
||
head = msg->front.iov_base;
|
||
p = msg->front.iov_base + sizeof(*head);
|
||
} else {
|
||
struct ceph_mds_request_head *new_head = msg->front.iov_base;
|
||
msg->hdr.version = cpu_to_le16(4);
|
||
new_head->version = cpu_to_le16(CEPH_MDS_REQUEST_HEAD_VERSION);
|
||
head = (struct ceph_mds_request_head_old *)&new_head->oldest_client_tid;
|
||
p = msg->front.iov_base + sizeof(*new_head);
|
||
}
|
||
head = find_old_request_head(msg->front.iov_base, legacy);
|
||
end = msg->front.iov_base + msg->front.iov_len;
|
||
head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch);
|
||
... | ... | |
head->num_releases = cpu_to_le16(releases);
|
||
/* time stamp */
|
||
{
|
||
struct ceph_timespec ts;
|
||
ceph_encode_timespec64(&ts, &req->r_stamp);
|
||
ceph_encode_copy(&p, &ts, sizeof(ts));
|
||
}
|
||
/* gid list */
|
||
if (!legacy) {
|
||
ceph_encode_32(&p, req->r_cred->group_info->ngroups);
|
||
for (i = 0; i < req->r_cred->group_info->ngroups; i++)
|
||
ceph_encode_64(&p, from_kgid(&init_user_ns,
|
||
req->r_cred->group_info->gid[i]));
|
||
}
|
||
encode_payload_tail(&p, req, legacy);
|
||
if (WARN_ON_ONCE(p > end)) {
|
||
ceph_msg_put(msg);
|
||
... | ... | |
complete_all(&req->r_completion);
|
||
}
|
||
static struct ceph_mds_request_head_old *
|
||
find_old_request_head(void *p, u64 features)
|
||
{
|
||
bool legacy = !(features & CEPH_FEATURE_FS_BTIME);
|
||
struct ceph_mds_request_head *new_head;
|
||
if (legacy)
|
||
return (struct ceph_mds_request_head_old *)p;
|
||
new_head = (struct ceph_mds_request_head *)p;
|
||
return (struct ceph_mds_request_head_old *)&new_head->oldest_client_tid;
|
||
}
|
||
/*
|
||
* called under mdsc->mutex
|
||
*/
|
||
... | ... | |
struct ceph_mds_request_head_old *rhead;
|
||
struct ceph_msg *msg;
|
||
int flags = 0;
|
||
bool legacy = !(session->s_con.peer_features & CEPH_FEATURE_FS_BTIME);
|
||
req->r_attempts++;
|
||
if (req->r_inode) {
|
||
... | ... | |
* d_move mangles the src name.
|
||
*/
|
||
msg = req->r_request;
|
||
rhead = find_old_request_head(msg->front.iov_base,
|
||
session->s_con.peer_features);
|
||
rhead = find_old_request_head(msg->front.iov_base, legacy);
|
||
flags = le32_to_cpu(rhead->flags);
|
||
flags |= CEPH_MDS_FLAG_REPLAY;
|
||
... | ... | |
/* remove cap/dentry releases from message */
|
||
rhead->num_releases = 0;
|
||
/* time stamp */
|
||
/* verify that we haven't got mixed-feature MDSs */
|
||
if (legacy)
|
||
WARN_ON_ONCE(le16_to_cpu(msg->hdr.version) >= 4);
|
||
else
|
||
WARN_ON_ONCE(le16_to_cpu(msg->hdr.version) < 4);
|
||
p = msg->front.iov_base + req->r_request_release_offset;
|
||
{
|
||
struct ceph_timespec ts;
|
||
ceph_encode_timespec64(&ts, &req->r_stamp);
|
||
ceph_encode_copy(&p, &ts, sizeof(ts));
|
||
}
|
||
encode_payload_tail(&p, req, legacy);
|
||
msg->front.iov_len = p - msg->front.iov_base;
|
||
msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
|
||
... | ... | |
}
|
||
req->r_request = msg;
|
||
rhead = find_old_request_head(msg->front.iov_base,
|
||
session->s_con.peer_features);
|
||
rhead = find_old_request_head(msg->front.iov_base, legacy);
|
||
rhead->oldest_client_tid = cpu_to_le64(__get_oldest_tid(mdsc));
|
||
if (test_bit(CEPH_MDS_R_GOT_UNSAFE, &req->r_req_flags))
|
||
flags |= CEPH_MDS_FLAG_REPLAY;
|
- « Previous
- 1
- 2
- Next »