From d3ef7c44debfa7997367cff009dac1b770aa56a4 Mon Sep 17 00:00:00 2001 From: sage Date: Mon, 27 Jun 2005 07:14:40 +0000 Subject: [PATCH] fixed Context destructor snafu; Messenger serializes itself (no more CheesySerialize) git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@345 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/Makefile | 20 ++++--- ceph/client/Client.cc | 10 +++- ceph/config.cc | 7 +++ ceph/fakefuse.cc | 7 +-- ceph/fakesyn.cc | 7 ++- ceph/include/Context.h | 2 + ceph/include/buffer.h | 5 ++ ceph/include/bufferlist.h | 20 +++++++ ceph/mds/MDCache.cc | 4 +- ceph/mds/MDCache.h | 4 ++ ceph/mds/MDStore.cc | 15 ++++-- ceph/msg/CheesySerializer.h | 6 +-- ceph/msg/Dispatcher.cc | 2 + ceph/msg/Dispatcher.h | 4 +- ceph/msg/FakeMessenger.h | 3 -- ceph/msg/MPIMessenger.cc | 24 --------- ceph/msg/MPIMessenger.h | 4 -- ceph/msg/Messenger.cc | 96 +++++++++++++++++++++++++++++++++ ceph/msg/Messenger.h | 29 +++++----- ceph/msg/TCPMessenger.h | 1 - ceph/osd/OSDMap.h | 2 +- ceph/osdc/Filer.cc | 7 +-- ceph/script/find_bufferleaks.pl | 16 ++++++ ceph/tcpfuse.cc | 4 +- ceph/tcpsyn.cc | 4 +- 25 files changed, 216 insertions(+), 87 deletions(-) diff --git a/ceph/Makefile b/ceph/Makefile index e27ac21aabe..ff64560ec34 100644 --- a/ceph/Makefile +++ b/ceph/Makefile @@ -67,42 +67,40 @@ gprof-helper.so: test/gprof-helper.c import: mds/allmds.o osd/OSD.o msg/FakeMessenger.o import.cc ${COMMON_OBJS} ${CC} ${CFLAGS} ${LIBS} $^ -o $@ -singleclient: mds/allmds.o osd/OSD.o fakesingleclient.o client/Client.o \ -msg/CheesySerializer.o msg/FakeMessenger.o fsck.o ${COMMON_OBJS} +singleclient: mds/allmds.o osd/OSD.o fakesingleclient.o client/Client.o msg/FakeMessenger.o fsck.o ${COMMON_OBJS} ${CC} ${CFLAGS} ${LIBS} $^ -o $@ tp: osd/tp.o ${CC} ${CFLAGS} ${LIBS} $^ -o $@ -fuseclient: client/Client.o client/fuse.o msg/CheesySerializer.o \ -msg/FakeMessenger.o ${COMMON_OBJS} +fuseclient: client/Client.o client/fuse.o msg/FakeMessenger.o ${COMMON_OBJS} ${CC} ${CFLAGS} ${LIBS} -lfuse $^ -o $@ fakemds: test/fakemds.cc msg/FakeMessenger.o fakeclient/FakeClient.o osd/OSD.o mds/allmds.o ${COMMON_OBJS} ${CC} ${CFLAGS} ${LIBS} $^ -o $@ -mpitest: test/mpitest.o msg/MPIMessenger.cc mds/allmds.o osd/OSD.o fakeclient/FakeClient.o msg/CheesySerializer.o ${COMMON_OBJS} +mpitest: test/mpitest.o msg/MPIMessenger.cc mds/allmds.o osd/OSD.o fakeclient/FakeClient.o ${COMMON_OBJS} ${MPICC} ${CFLAGS} $^ -o $@ mttest: test/mttest.cc msg/MTMessenger.cc ${COMMON_OBJS} ${MPICC} ${CFLAGS} ${LIBS} $^ -o $@ -mpifuse: mpifuse.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o client/fuse.o msg/MPIMessenger.cc msg/CheesySerializer.o ${COMMON_OBJS} +mpifuse: mpifuse.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o client/fuse.o msg/MPIMessenger.cc ${COMMON_OBJS} ${MPICC} ${CFLAGS} ${LIBS} -lfuse $^ -o $@ -tcpfuse: tcpfuse.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o client/fuse.o msg/TCPMessenger.cc msg/CheesySerializer.o ${COMMON_OBJS} +tcpfuse: tcpfuse.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o client/fuse.o msg/TCPMessenger.cc ${COMMON_OBJS} ${MPICC} ${CFLAGS} ${LIBS} -lfuse $^ -o $@ -mpisyn: mpisyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/MPIMessenger.cc msg/CheesySerializer.o ${COMMON_OBJS} +mpisyn: mpisyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/MPIMessenger.cc ${COMMON_OBJS} ${MPICC} ${MPICFLAGS} ${MPILIBS} $^ -o $@ -tcpsyn: tcpsyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/TCPMessenger.cc msg/CheesySerializer.o ${COMMON_OBJS} +tcpsyn: tcpsyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/TCPMessenger.cc ${COMMON_OBJS} ${MPICC} ${MPICFLAGS} ${MPILIBS} $^ -o $@ -fakesyn: fakesyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/FakeMessenger.o msg/CheesySerializer.o ${COMMON_OBJS} +fakesyn: fakesyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/FakeMessenger.o ${COMMON_OBJS} ${CC} -pg ${CFLAGS} ${LIBS} $^ -o $@ -fakefuse: fakefuse.cc mds/allmds.o client/Client.o osd/OSD.o client/fuse.o msg/FakeMessenger.cc msg/CheesySerializer.o ${COMMON_OBJS} +fakefuse: fakefuse.cc mds/allmds.o client/Client.o osd/OSD.o client/fuse.o msg/FakeMessenger.cc ${COMMON_OBJS} ${CC} -pg ${CFLAGS} ${LIBS} -lfuse $^ -o $@ testmpi: test/testmpi.cc msg/MPIMessenger.cc config.o common/Timer.o common/clock.o msg/Messenger.o msg/Dispatcher.o msg/error.o diff --git a/ceph/client/Client.cc b/ceph/client/Client.cc index 375755dc32a..44cd13df00d 100644 --- a/ceph/client/Client.cc +++ b/ceph/client/Client.cc @@ -372,6 +372,7 @@ int Client::flush_inode_buffers(Inode *in) Cond *cond = new Cond; in->waitfor_flushed.push_back(cond); cond->Wait(client_lock); + delete cond; assert(in->inflight_buffers.empty()); dout(7) << "inflight buffers flushed" << endl; } else { @@ -979,8 +980,14 @@ int Client::open(const char *path, int mode) Fh *f = new Fh; memset(f, 0, sizeof(*f)); f->mds = reply->get_source(); - f->inode = inode_map[trace[trace.size()-1]->inode.ino]; f->caps = reply->get_file_caps(); + + // inode + f->inode = inode_map[trace[trace.size()-1]->inode.ino]; + assert(f->inode); + f->inode->get(); + + // put in map assert(fh_map.count(fh) == 0); fh_map[fh] = f; @@ -1018,6 +1025,7 @@ int Client::close(fileh_t fh) /* mds may ack our close() after reissuing same fh to another open; remove from fh_map _before_ sending request. */ fh_map.erase(fh); + put_inode( in ); delete f; release_inode_buffers(in); diff --git a/ceph/config.cc b/ceph/config.cc index 745185656ee..428e3d96640 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -11,6 +11,11 @@ //#define MDS_CACHE_SIZE 25000 // +// hack hack hack ugly FIXME +long buffer_total_alloc = 0; + + + md_config_t g_conf = { num_mds: 2, num_osd: 5, @@ -124,6 +129,8 @@ void parse_config_options(int argc, char **argv, g_conf.debug_mds_balancer = atoi(argv[++i]); else if (strcmp(argv[i], "--debug_mds_log") == 0) g_conf.debug_mds_log = atoi(argv[++i]); + else if (strcmp(argv[i], "--debug_buffer") == 0) + g_conf.debug_buffer = atoi(argv[++i]); else if (strcmp(argv[i], "--log") == 0) g_conf.log_name = argv[++i]; diff --git a/ceph/fakefuse.cc b/ceph/fakefuse.cc index 9e5315f4975..556bf16952e 100644 --- a/ceph/fakefuse.cc +++ b/ceph/fakefuse.cc @@ -16,7 +16,7 @@ using namespace std; #include "common/Timer.h" #include "msg/FakeMessenger.h" -#include "msg/CheesySerializer.h" + @@ -91,10 +91,7 @@ int main(int oargc, char **oargv) { // create client Client *client[NUMCLIENT]; for (int i=0; iinit(); diff --git a/ceph/fakesyn.cc b/ceph/fakesyn.cc index 8e834e2d7d3..7e75ec9b1c5 100644 --- a/ceph/fakesyn.cc +++ b/ceph/fakesyn.cc @@ -14,7 +14,6 @@ using namespace std; #include "client/SyntheticClient.h" #include "msg/FakeMessenger.h" -#include "msg/CheesySerializer.h" #include "common/Timer.h" @@ -32,7 +31,8 @@ public: int main(int oargc, char **oargv) { - cerr << "fakesyn starting" << endl; + //cerr << "fakesyn starting" << endl; + int argc; char **argv; parse_config_options(oargc, oargv, @@ -116,8 +116,7 @@ int main(int oargc, char **oargv) SyntheticClient *syn[NUMCLIENT]; for (int i=0; i using namespace __gnu_cxx; + +// debug crap +#include "include/config.h" +#define bdbout(x) if (x <= g_conf.debug_buffer) cout + + + class bufferlist { private: list _buffers; public: // cons/des + bufferlist() { + bdbout(1) << "bufferlist.cons " << this << endl; + } + bufferlist(bufferlist& bl) { + bdbout(1) << "bufferlist.cons " << this << endl; + _buffers = bl._buffers; + } ~bufferlist() { + bdbout(1) << "bufferlist.des " << this << endl; + } + /* + bufferlist& operator=(bufferlist& bl) { + assert(0); // actually, this should be fine. } + */ // sort-of-like-assignment-op void claim(bufferlist& bl) { diff --git a/ceph/mds/MDCache.cc b/ceph/mds/MDCache.cc index 3cc376027a2..4fdc1605c1d 100644 --- a/ceph/mds/MDCache.cc +++ b/ceph/mds/MDCache.cc @@ -77,8 +77,6 @@ using namespace std; - - MDCache::MDCache(MDS *m) { mds = m; @@ -1141,7 +1139,6 @@ int MDCache::path_traverse(filepath& origpath, mds->mdstore->fetch_dir(cur->dir, ondelay); mds->logger->inc("cmiss"); - mds->logger->inc("rdir"); if (onfinish) delete onfinish; return 1; @@ -1496,6 +1493,7 @@ void MDCache::request_cleanup(Message *req) mds->logger->set("ctop", lru.lru_get_top()); mds->logger->set("cbot", lru.lru_get_bot()); mds->logger->set("cptail", lru.lru_get_pintail()); + mds->logger->set("buf",buffer_total_alloc); if (g_conf.log_pins) { // pin diff --git a/ceph/mds/MDCache.h b/ceph/mds/MDCache.h index 873c75ecf3d..293f53234e1 100644 --- a/ceph/mds/MDCache.h +++ b/ceph/mds/MDCache.h @@ -173,6 +173,10 @@ class MDCache { void destroy_inode(CInode *in); void touch_inode(CInode *in) { + // touch parent(s) too + if (in->get_parent_dir()) touch_inode(in->get_parent_dir()->inode); + + // top or mid, depending on whether i'm auth if (in->is_auth()) lru.lru_touch(in); else diff --git a/ceph/mds/MDStore.cc b/ceph/mds/MDStore.cc index 48e7cdccbbf..4e46214b78b 100644 --- a/ceph/mds/MDStore.cc +++ b/ceph/mds/MDStore.cc @@ -72,6 +72,9 @@ bool MDStore::fetch_dir( CDir *dir, dir->state_set(CDIR_STATE_FETCHING); + // stats + mds->logger->inc("fdir"); + // create return context MDFetchDirContext *fin = new MDFetchDirContext( this, dir->ino() ); @@ -259,6 +262,9 @@ bool MDStore::commit_dir( CDir *dir, dir->state_set(CDIR_STATE_COMMITTING); dir->set_committing_version(); + // stats + mds->logger->inc("cdir"); + if (dir->is_hashed()) { // hashed do_commit_dir( dir, fin, mds->get_nodeid() ); @@ -559,7 +565,8 @@ void MDStore::do_fetch_dir( CDir *dir, // read first bit mds->filer->read(dir->ino(), - FILE_OBJECT_SIZE, 0, + FILE_OBJECT_SIZE, 0, // get first object's bit + //16, 0, // just get front bit &fin->bl, fin ); } @@ -720,8 +727,10 @@ void MDStore::do_fetch_dir_2( bufferlist& bl, } dout(15) << "parsed " << parsed << endl; - c->finish(0); - delete c; + if (c) { + c->finish(0); + delete c; + } } diff --git a/ceph/msg/CheesySerializer.h b/ceph/msg/CheesySerializer.h index ca528fa66fb..99698795d6e 100644 --- a/ceph/msg/CheesySerializer.h +++ b/ceph/msg/CheesySerializer.h @@ -31,7 +31,7 @@ class CheesySerializer : public Messenger, messenger->set_dispatcher(this); last_pcid = 1; } - ~CheesySerializer() { + virtual ~CheesySerializer() { if (messenger) delete messenger; } @@ -47,10 +47,6 @@ class CheesySerializer : public Messenger, Message *sendrecv(Message *m, msg_addr_t dest, int port=0); // blocks for matching reply - /* - void trigger_timer(class Timer *t) { - messenger->trigger_timer(t); - }*/ }; #endif diff --git a/ceph/msg/Dispatcher.cc b/ceph/msg/Dispatcher.cc index a75cf8fad66..2fdd3bcb744 100644 --- a/ceph/msg/Dispatcher.cc +++ b/ceph/msg/Dispatcher.cc @@ -4,8 +4,10 @@ #include "mds/MDS.h" +/* int Dispatcher::send_message(Message *m, msg_addr_t dest, int dest_port) { assert(0); //return dis_messenger->send_message(m, dest, dest_port, MDS_PORT_SERVER); // on my port! } +*/ diff --git a/ceph/msg/Dispatcher.h b/ceph/msg/Dispatcher.h index 85aaacbe8cb..2fd8aca73bf 100644 --- a/ceph/msg/Dispatcher.h +++ b/ceph/msg/Dispatcher.h @@ -11,6 +11,8 @@ class Dispatcher { int dis_port; public: + virtual ~Dispatcher() { } + // how i receive messages virtual void dispatch(Message *m) = 0; @@ -21,7 +23,7 @@ class Dispatcher { } // this is how i send messages - int send_message(Message *m, msg_addr_t dest, int dest_port); + //int send_message(Message *m, msg_addr_t dest, int dest_port); }; #endif diff --git a/ceph/msg/FakeMessenger.h b/ceph/msg/FakeMessenger.h index 0df62302f19..2a713959440 100644 --- a/ceph/msg/FakeMessenger.h +++ b/ceph/msg/FakeMessenger.h @@ -27,9 +27,6 @@ class FakeMessenger : public Messenger { // msg interface virtual int send_message(Message *m, msg_addr_t dest, int port=0, int fromport=0); - // use CheesySerializer for now! - virtual Message* sendrecv(Message *m, msg_addr_t dest, int port=0) { assert(0); }; - // events //virtual void trigger_timer(Timer *t); diff --git a/ceph/msg/MPIMessenger.cc b/ceph/msg/MPIMessenger.cc index 71a3efbdd6c..9748998da38 100644 --- a/ceph/msg/MPIMessenger.cc +++ b/ceph/msg/MPIMessenger.cc @@ -585,30 +585,6 @@ int MPIMessenger::send_message(Message *m, msg_addr_t dest, int port, int frompo -Message *MPIMessenger::sendrecv(Message *m, msg_addr_t dest, int port) -{ -#ifdef FUNNEL_MPI - - assert(0); // use CheesySerializer - -#else - int fromport = 0; - - // set envelope - m->set_source(myaddr, fromport); - m->set_dest(dest, port); - - int rank = MPI_DEST_TO_RANK(dest, mpi_world); - - // get a tag to uniquely identify this procedure call - int my_tag = get_thread_tag(); - m->set_pcid(my_tag); - - mpi_send(m, TAG_UNSOLICITED); - - return mpi_recv(my_tag); -#endif -} diff --git a/ceph/msg/MPIMessenger.h b/ceph/msg/MPIMessenger.h index 415a797b883..4ddfc57ac8a 100644 --- a/ceph/msg/MPIMessenger.h +++ b/ceph/msg/MPIMessenger.h @@ -26,10 +26,6 @@ class MPIMessenger : public Messenger { // message interface virtual int send_message(Message *m, msg_addr_t dest, int port=0, int fromport=0); - virtual Message* sendrecv(Message *m, msg_addr_t dest, int port=0); - - // events - //virtual void trigger_timer(Timer *t); }; /** diff --git a/ceph/msg/Messenger.cc b/ceph/msg/Messenger.cc index c34b88cd682..bc4121ac6c1 100644 --- a/ceph/msg/Messenger.cc +++ b/ceph/msg/Messenger.cc @@ -67,6 +67,11 @@ using namespace std; #include "messages/MLock.h" +#include "include/config.h" +#undef dout +#define dout(l) if (l<=g_conf.debug) cout << "messenger: " +#define DEBUGLVL 10 // debug level of output + ostream& operator<<(ostream& out, Message& m) { @@ -78,6 +83,97 @@ ostream& operator<<(ostream& out, Message& m) } +// --------- +// incoming messages + + +void Messenger::dispatch(Message *m) +{ + assert(dispatcher); + + long pcid = m->get_pcid(); + + _lock.Lock(); + + // was i expecting it? + if (call_cond.count(pcid)) { + // yes, this is a reply to a pending call. + dout(DEBUGLVL) << "dispatch got reply for " << pcid << " " << m << endl; + call_reply[pcid] = m; // set reply + int r = call_cond[pcid]->Signal(); + //cout << "post = " << r << endl; + _lock.Unlock(); + } else { + // no, this is an unsolicited message. + _lock.Unlock(); + dout(DEBUGLVL) << "dispatch got unsolicited message pcid " << pcid << " m " << m << endl; + dispatcher->dispatch(m); + } +} + + + +// --------- +// outgoing messages + +Message *Messenger::sendrecv(Message *m, msg_addr_t dest, int port) +{ + int fromport = 0; + + Cond cond; + + // make up a pcid that is unique (to me!) + /* NOTE: since request+replies are matched up on pcid's alone, it means that + two nodes using this mechanism can't do calls of each other or else their + pcid's might overlap. + This should be fine. only the Client uses this so far (not MDS). + If OSDs want to use this, though, this must be made smarter!!! + */ + long pcid = ++last_pcid; + m->set_pcid(pcid); + + _lock.Lock(); + + dout(DEBUGLVL) << "sendrecv sending " << m << " on pcid " << pcid << endl; + + // add call records + assert(call_cond.count(pcid) == 0); // pcid should be UNIQUE + call_cond[pcid] = &cond; + call_reply[pcid] = 0; // no reply yet + + // send. drop locks in case send_message is bad and blocks + _lock.Unlock(); + send_message(m, dest, port, fromport); + _lock.Lock(); + + // wait? + if (call_reply[pcid] == 0) { + dout(DEBUGLVL) << "sendrecv waiting for reply on pcid " << pcid << endl; + //cout << "wait start, value = " << sem->Value() << endl; + + cond.Wait(_lock); + } else { + dout(DEBUGLVL) << "sendrecv reply is already here on pcid " << pcid << endl; + } + + // pick up reply + Message *reply = call_reply[pcid]; + //assert(reply); + call_reply.erase(pcid); // remove from call map + call_cond.erase(pcid); + + dout(DEBUGLVL) << "sendrecv got reply " << reply << " on pcid " << pcid << endl; + //delete sem; + + _lock.Unlock(); + + return reply; +} + + + + + Message * decode_message(msg_envelope_t& env, bufferlist& payload) diff --git a/ceph/msg/Messenger.h b/ceph/msg/Messenger.h index 63d679b9e89..08229846269 100644 --- a/ceph/msg/Messenger.h +++ b/ceph/msg/Messenger.h @@ -2,12 +2,15 @@ #ifndef __MESSENGER_H #define __MESSENGER_H -#include -#include +#include using namespace std; #include "Message.h" #include "Dispatcher.h" +#include "common/Mutex.h" +#include "common/Cond.h" + + class MDS; class Timer; @@ -17,30 +20,32 @@ class Messenger { Dispatcher *dispatcher; msg_addr_t _myaddr; + // procedure call fun + long last_pcid; + Mutex _lock; // protect call_sem, call_reply + map call_cond; + map call_reply; + public: Messenger(msg_addr_t w) : dispatcher(0), _myaddr(w) { } + virtual ~Messenger() { } msg_addr_t get_myaddr() { return _myaddr; } virtual int shutdown() = 0; - // dispatching incoming messages + // setup void set_dispatcher(Dispatcher *d) { dispatcher = d; } Dispatcher *get_dispatcher() { return dispatcher; } - virtual void dispatch(Message *m) { - assert(dispatcher); - dispatcher->dispatch(m); - } + + // dispatch incoming messages + virtual void dispatch(Message *m); // send message virtual int send_message(Message *m, msg_addr_t dest, int port=0, int fromport=0) = 0; // make a procedure call - virtual Message* sendrecv(Message *m, msg_addr_t dest, int port=0) = 0; - - // events - //virtual void trigger_timer(Timer *t) = 0; - + virtual Message* sendrecv(Message *m, msg_addr_t dest, int port=0); }; diff --git a/ceph/msg/TCPMessenger.h b/ceph/msg/TCPMessenger.h index b88ddf927f5..22a5b5355a0 100644 --- a/ceph/msg/TCPMessenger.h +++ b/ceph/msg/TCPMessenger.h @@ -27,7 +27,6 @@ class TCPMessenger : public Messenger { // message interface virtual int send_message(Message *m, msg_addr_t dest, int port=0, int fromport=0); - virtual Message* sendrecv(Message *m, msg_addr_t dest, int port=0) { assert(0); } }; /** diff --git a/ceph/osd/OSDMap.h b/ceph/osd/OSDMap.h index e665e7edc0d..d16a6ab9a5d 100644 --- a/ceph/osd/OSDMap.h +++ b/ceph/osd/OSDMap.h @@ -29,7 +29,7 @@ using namespace __gnu_cxx; #define NUM_RUSH_REPLICAS 4 // this should be big enough to cope w/ failing disks. #define MAX_REPLICAS 3 -#define FILE_OBJECT_SIZE (1<<20) // 1 MB object size +#define FILE_OBJECT_SIZE (1<<20) // 1 MB object size #define OID_BLOCK_BITS 30 // 1mb * 10^9 = 1 petabyte files #define OID_INO_BITS (64-30) // 2^34 =~ 16 billion files diff --git a/ceph/osdc/Filer.cc b/ceph/osdc/Filer.cc index 475897b279c..25a80cfe3bc 100644 --- a/ceph/osdc/Filer.cc +++ b/ceph/osdc/Filer.cc @@ -131,7 +131,7 @@ Filer::handle_osd_read_reply(MOSDOpReply *m) PendingOSDRead_t *p = op_reads[ tid ]; op_reads.erase( tid ); - // copy result into buffer + // what buffer offset are we? size_t off = p->read_off[tid]; dout(7) << "got frag at " << off << " len " << m->get_length() << endl; @@ -142,7 +142,7 @@ Filer::handle_osd_read_reply(MOSDOpReply *m) // all done p->read_result->clear(); if (p->read_data.size()) { - dout(20) << "assembling frags" << endl; + dout(15) << "assembling frags" << endl; /** BUG this doesn't handle holes properly **/ @@ -158,9 +158,10 @@ Filer::handle_osd_read_reply(MOSDOpReply *m) // FIXME: pad if hole? if (it->second->length()) p->read_result->claim_append(*(it->second)); + delete it->second; } } else { - dout(20) << " only one frag" << endl; + dout(15) << " only one frag" << endl; // only one fragment, easy p->read_result->claim( m->get_data() ); } diff --git a/ceph/script/find_bufferleaks.pl b/ceph/script/find_bufferleaks.pl index 8c5fd2a989a..152515d5e78 100755 --- a/ceph/script/find_bufferleaks.pl +++ b/ceph/script/find_bufferleaks.pl @@ -2,6 +2,7 @@ use strict; my %buffers; +my %bufferlists; my %ref; my %mal; my $l = 1; @@ -22,6 +23,17 @@ while (<>) { delete $ref{$x}; } + if (/^bufferlist\.cons /) { + my ($x) = /(0x\S+)/; + $bufferlists{$x} = 1; + } + if (/^bufferlist\.des /) { + my ($x) = /(0x\S+)/; + warn "des without cons at $l: $_" unless $bufferlists{$x}; + delete $bufferlists{$x}; + } + + if (/^buffer\.malloc /) { my ($x) = /(0x\S+)/; $mal{$x} = 1; @@ -44,6 +56,10 @@ while (<>) { $l++; } +for my $x (keys %bufferlists) { + print "leaked bufferlist $x\n"; +} + for my $x (keys %buffers) { print "leaked buffer $x ref $ref{$x}\n"; } diff --git a/ceph/tcpfuse.cc b/ceph/tcpfuse.cc index b9697968166..87f0b2e1899 100644 --- a/ceph/tcpfuse.cc +++ b/ceph/tcpfuse.cc @@ -14,7 +14,6 @@ using namespace std; #include "client/fuse.h" #include "msg/TCPMessenger.h" -#include "msg/CheesySerializer.h" #include "common/Timer.h" @@ -95,8 +94,7 @@ int main(int oargc, char **oargv) { for (int i=0; i