kernel client
- some bugs
- open path needs to call fill_trace/fill_inode such that ci->i_max_size gets filled in
- - echo blah >> mnt/blah "appends" from offset zero, regardless of file size
- cap handler probably needs i_mutex or something when updating file sizes
- which means it probably needs to be done in a different worker thread (NOT the messenger's)
- prevent client_reply from racing against a subsequent file_caps.
- audit use of kmalloc vs spinlocks
- convert most everything in ceph_fs.h to le32/le64 notation, cleaning up userspace appropriately
- vfs
- - generate paths relative to the appropriate vfsmount root?
- - getattr should do an lstat?
- - d_revalidate?
- - test truncate
+ - can we use dentry_path(), if it gets merged into mainline?
- fix file open vs file_cap race
- preemptively release caps as part of request if doing utimes/etc. on an open file?
- mds client
end = req->front.iov_base + req->front.iov_len;
/* encode head */
- ceph_encode_inst(&head->client_inst, &mdsc->client->msgr->inst);
+ head->client_inst = mdsc->client->msgr->inst;
/* tid, oldest_client_tid set by do_request */
head->mdsmap_epoch = cpu_to_le64(mdsc->mdsmap->m_epoch);
head->num_fwd = 0;
if (mds >= m->m_max_mds)
goto bad;
*p += sizeof(struct ceph_entity_name);
- if ((err = ceph_decode_addr(p, end, &m->m_addr[mds])) != 0)
+ if ((err = ceph_decode_copy(p, end, &m->m_addr[mds],
+ sizeof(*m->m_addr))) != 0)
goto bad;
}
static void prepare_write_connect(struct ceph_messenger *msgr, struct ceph_connection *con)
{
- ceph_encode_addr(&con->out_addr, &msgr->inst.addr);
- con->out_kvec[0].iov_base = &con->out_addr;
- con->out_kvec[0].iov_len = sizeof(con->out_addr);
+ con->out_kvec[0].iov_base = &msgr->inst.addr;
+ con->out_kvec[0].iov_len = sizeof(msgr->inst.addr);
con->out32 = cpu_to_le32(con->connect_seq);
con->out_kvec[1].iov_base = &con->out32;
con->out_kvec[1].iov_len = 4;
con->out_kvec_left = 2;
- con->out_kvec_bytes = sizeof(con->out_addr) + 4;
+ con->out_kvec_bytes = sizeof(msgr->inst.addr) + 4;
con->out_kvec_cur = con->out_kvec;
set_bit(WRITE_PENDING, &con->state);
}
static void prepare_write_accept_announce(struct ceph_messenger *msgr, struct ceph_connection *con)
{
- ceph_encode_addr(&con->out_addr, &msgr->inst.addr);
- con->out_kvec[0].iov_base = &con->out_addr;
- con->out_kvec[0].iov_len = sizeof(con->out_addr);
+ con->out_kvec[0].iov_base = &msgr->inst.addr;
+ con->out_kvec[0].iov_len = sizeof(msgr->inst.addr);
con->out_kvec_left = 1;
- con->out_kvec_bytes = sizeof(con->out_addr);
+ con->out_kvec_bytes = sizeof(msgr->inst.addr);
con->out_kvec_cur = con->out_kvec;
set_bit(WRITE_PENDING, &con->state);
}
struct list_head out_queue;
struct list_head out_sent; /* sending/sent but unacked; resend if connection drops */
- struct ceph_entity_addr out_addr;
__le32 out32;
struct kvec out_kvec[4],
*out_kvec_cur;
return 0;
}
-static __inline__ int ceph_decode_addr(void **p, void *end, struct ceph_entity_addr *v) {
- int err;
- if (*p + sizeof(*v) > end)
- return -EINVAL;
- if ((err = ceph_decode_32(p, end, &v->erank)) != 0)
- return -EINVAL;
- if ((err = ceph_decode_32(p, end, &v->nonce)) != 0)
- return -EINVAL;
- ceph_decode_copy(p, end, &v->ipaddr, sizeof(v->ipaddr));
- return 0;
-}
-static __inline__ void ceph_encode_addr(struct ceph_entity_addr *to, struct ceph_entity_addr *from)
-{
- to->erank = cpu_to_le32(from->erank);
- to->nonce = cpu_to_le32(from->nonce);
- to->ipaddr = from->ipaddr;
-}
-
-static __inline__ int ceph_decode_name(void **p, void *end, struct ceph_entity_name *v) {
- if (unlikely(*p + sizeof(*v) > end))
- return -EINVAL;
- v->type = le32_to_cpu(*(__u32*)*p);
- *p += sizeof(__u32);
- v->num = le32_to_cpu(*(__u32*)*p);
- *p += sizeof(__u32);
- return 0;
-}
-
-/* hmm, these are actually identical, yeah? */
-static __inline__ void ceph_decode_inst(struct ceph_entity_inst *to)
-{
- le32_to_cpus(&to->name.type);
- le32_to_cpus(&to->name.num);
- le32_to_cpus(&to->addr.erank);
- le32_to_cpus(&to->addr.nonce);
-}
-static __inline__ void ceph_encode_inst(struct ceph_entity_inst *to, struct ceph_entity_inst *from)
-{
- to->name.type = cpu_to_le32(from->name.type);
- to->name.num = cpu_to_le32(from->name.num);
- ceph_encode_addr(&to->addr, &from->addr);
-}
-
static __inline__ int ceph_encode_64(void **p, void *end, __u64 v) {
BUG_ON(*p + sizeof(v) > end);
*(__u64*)*p = cpu_to_le64(v);
}
memcpy(m->mon_inst, p, end-p);
for (i=0; i<m->num_mon; i++) {
- ceph_decode_inst(&m->mon_inst[i]);
dout(30, "monmap_decode mon%d is %x:%d\n", i,
ntohl(m->mon_inst[i].addr.ipaddr.sin_addr.s_addr),
ntohs(m->mon_inst[i].addr.ipaddr.sin_port));
/* encode head */
head->op = cpu_to_le32(op);
- ceph_encode_inst(&head->client_inst, &osdc->client->msgr->inst);
+ head->client_inst = osdc->client->msgr->inst;
head->client_inc = 1; /* always, for now. */
-
+
return req;
}
struct ceph_entity_addr addr;
if ((err = ceph_decode_32(p, end, &osd)) < 0)
goto bad;
- if ((err = ceph_decode_addr(p, end, &addr)) < 0)
+ if ((err = ceph_decode_copy(p, end, &addr,
+ sizeof(addr))) < 0)
goto bad;
dout(1, "osd%d up\n", osd);
BUG_ON(osd >= map->max_osd);