From 1cf68bcee251de71dd6c993f39410ef5323b17a0 Mon Sep 17 00:00:00 2001 From: sage Date: Tue, 12 Oct 2004 01:51:59 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@114 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/Makefile | 2 +- ceph/TODO | 24 ------------------------ ceph/config.cc | 7 ++++--- ceph/config.h | 1 + ceph/mds/CDir.cc | 2 +- ceph/mds/CDir.h | 4 ++-- ceph/mds/CInode.cc | 2 +- ceph/mds/MDCache.cc | 23 +++++++++++++---------- ceph/messages/MDiscover.h | 4 +++- ceph/messages/MDiscoverReply.h | 24 ++++++++++++++++++------ ceph/msg/FakeMessenger.cc | 32 ++++++++++++++++---------------- 11 files changed, 60 insertions(+), 65 deletions(-) diff --git a/ceph/Makefile b/ceph/Makefile index e70c38e9eaa45..7f799e9ddeeb4 100644 --- a/ceph/Makefile +++ b/ceph/Makefile @@ -12,7 +12,7 @@ MPICFLAGS=${CFLAGS} -I/usr/lib/mpi/include -L/usr/lib/mpi/mpi_gnu/lib MPILIBS= -lelan -lmpi ${LIBS} LEAKTRACER= -LEAKTRACER=$(HOME)/lib/LeakTracer.o +#LEAKTRACER=$(HOME)/lib/LeakTracer.o SRCS=*.cc */*.cc OBJS=osd/OSD.o\ diff --git a/ceph/TODO b/ceph/TODO index 99b9954df00e7..6322b07d2d117 100644 --- a/ceph/TODO +++ b/ceph/TODO @@ -22,30 +22,6 @@ ISSUES - is lock > freeze a bad plan? what happens when we need to lock multiple spots in the hierarchy.. will that cause deadlock? -issues with new model: -1- A has /usr, B has /usr/local, C has nothing. - A exports /usr to C. - while export is in transit, B exports /usr/local to D. - A and C get the notify, A updates its dir_auth, but C doesn't have /usr/local in cache and ignores the notify, ending up with A's old dir_auth for /usr/local (B instead of D). - solution: - freeze first. - then send export_dir_prep, prep with discover info for all nested exports. - -> the notify won't be lost, since _both_ the source and dest have interesting inodes in cache. - -> dir_auth of source is ignored for all but scope-of-export purposes. -- need to modularize, clean up all discover-related methods/structurs. - -/2- A has /usr/local. B, C have nothing. -/ B discovers /usr/local. disocver results are in transit. -/ A exports /usr/local to C. -/ C sends notify to A, B. -/ B ignores dir_auth update because discover hasn't arrived yet. -/ B receives discover. with incorrect dir_auth for /usr/local/. -/ 1. B is not authority, so maybe inaccuracy of dir_auth is unimportant? -/ 2. -/ -> source sends export_warning to all nodes; they don't process the notify until they've seen the matching warning first. forces exporter -> bystander channel to be flushed. - -nononono - FIX diff --git a/ceph/config.cc b/ceph/config.cc index 05d2e651c32da..da086b4c684f2 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -12,7 +12,7 @@ md_config_t g_conf = { - num_mds: 3, + num_mds: 4, num_osd: 10, num_client: 100, @@ -31,8 +31,9 @@ md_config_t g_conf = { mdlog_read_inc: 4096, fake_clock: true, + fakemessenger_serialize: true, - debug: 10, + debug: 12, mdcache_size: MDS_CACHE_SIZE, mdcache_mid: .8, @@ -43,7 +44,7 @@ md_config_t g_conf = { mdbal_replicate_threshold: 500, mdbal_unreplicate_threshold: 200, - mds_heartbeat_op_interval: 5000, + mds_heartbeat_op_interval: 500, mds_verify_export_dirauth: true }; diff --git a/ceph/config.h b/ceph/config.h index abc9e8f4bf3bc..6791a236f4c70 100644 --- a/ceph/config.h +++ b/ceph/config.h @@ -21,6 +21,7 @@ struct md_config_t { int mdlog_read_inc; bool fake_clock; + bool fakemessenger_serialize; int debug; diff --git a/ceph/mds/CDir.cc b/ceph/mds/CDir.cc index 0cd36200b6749..a67cbdf3abb1e 100644 --- a/ceph/mds/CDir.cc +++ b/ceph/mds/CDir.cc @@ -31,7 +31,7 @@ ostream& operator<<(ostream& out, CDir& dir) } if (dir.is_pinned()) { - out << " pins"; + out << " |"; for(set::iterator it = dir.get_ref_set().begin(); it != dir.get_ref_set().end(); it++) diff --git a/ceph/mds/CDir.h b/ceph/mds/CDir.h index 2b3cdc7597631..6164197400af4 100644 --- a/ceph/mds/CDir.h +++ b/ceph/mds/CDir.h @@ -43,7 +43,7 @@ class Context; #define CDIR_STATE_FETCHING 256 // currenting fetching #define CDIR_STATE_IMPORT 1024 // flag set if this is an import. -#define CDIR_STATE_EXPORT 2-48 +#define CDIR_STATE_EXPORT 2048 #define CDIR_STATE_AUTH 4096 // auth for this dir (hashing doesn't count) #define CDIR_STATE_PROXY 8192 @@ -218,7 +218,7 @@ class CDir { friend class CDirExport; public: - CDir(CInode *in, MDS *mds, bool auth=false); + CDir(CInode *in, MDS *mds, bool auth); diff --git a/ceph/mds/CInode.cc b/ceph/mds/CInode.cc index 37e7e01de3534..8cf784e527493 100644 --- a/ceph/mds/CInode.cc +++ b/ceph/mds/CInode.cc @@ -129,7 +129,7 @@ ostream& operator<<(ostream& out, CInode& in) assert(in.get_replica_nonce() >= 0); } if (in.is_pinned()) { - out << "pins"; + out << " |"; for(set::iterator it = in.get_ref_set().begin(); it != in.get_ref_set().end(); it++) diff --git a/ceph/mds/MDCache.cc b/ceph/mds/MDCache.cc index c99045cc23aab..1aa08a4cf863e 100644 --- a/ceph/mds/MDCache.cc +++ b/ceph/mds/MDCache.cc @@ -440,7 +440,8 @@ int MDCache::open_root(Context *c) filepath want; MDiscover *req = new MDiscover(whoami, 0, - want); + want, + false); // there _is_ no base dir for the root inode mds->messenger->send_message(req, MSG_ADDR_MDS(0), MDS_PORT_CACHE, MDS_PORT_CACHE); @@ -772,6 +773,7 @@ void MDCache::handle_discover(MDiscover *dis) reply = new MDiscoverReply(0); reply->add_inode( new CInodeDiscover( root, root->cached_by_add( dis->get_asker() ) ) ); + dout(10) << "added root " << *root << endl; dir = root->dir; @@ -802,7 +804,8 @@ void MDCache::handle_discover(MDiscover *dis) assert(reply); assert(dir); - // add content. + // add content + // do some fidgeting to include a dir if they asked for the base dir, or just root. for (int i = 0; i < dis->get_want().depth() || dis->get_want().depth() == 0; i++) { // add dir if (reply->is_empty() && !dis->wants_base_dir()) { @@ -824,9 +827,9 @@ void MDCache::handle_discover(MDiscover *dis) } */ - dout(7) << "adding dir " << *dir << endl; reply->add_dir( new CDirDiscover( dir, dir->open_by_add( dis->get_asker() ) ) ); + dout(7) << "added dir " << *dir << endl; } if (dis->get_want().depth() == 0) break; @@ -844,10 +847,10 @@ void MDCache::handle_discover(MDiscover *dis) assert(next->is_auth()); // add dentry + inode - dout(7) << "adding dentry " << dn << " + " << *next << endl; reply->add_dentry( dis->get_dentry(i) ); reply->add_inode( new CInodeDiscover(next, next->cached_by_add(dis->get_asker())) ); + dout(7) << "added dentry " << dn << " + " << *next << endl; } else { // don't have it? if (dir->is_complete()) { @@ -897,11 +900,13 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) { // starting point CInode *cur; + list finished; if (m->has_root()) { // nowhere! - dout(7) << "handle_discover_reply root + " << m->get_path() << endl; + dout(7) << "handle_discover_reply root + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << endl; assert(!root); + finished.swap(waiting_for_root); } else { // grab inode cur = get_inode(m->get_base_ino()); @@ -912,11 +917,9 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) return; } - dout(7) << "handle_discover_reply " << *cur << " + " << m->get_path() << endl; + dout(7) << "handle_discover_reply " << *cur << " + " << m->get_path() << ", have " << m->get_num_inodes() << " inodes" << endl; } - list finished; - for (int i=0; iget_num_inodes(); i++) { // dir if (i || m->has_base_dir()) { @@ -4342,9 +4345,9 @@ vector MDCache::hack_add_file(string& fn, CInode *in) { //dout(7) << " got dir " << idir << endl; if (idir->dir == NULL) { - dout(4) << " making " << dirpart << " into a dir" << endl; + dout(4) << " making " << *idir << " into a dir" << endl; idir->inode.isdir = true; - idir->dir = new CDir(idir, mds); + idir->get_or_open_dir(mds); } add_inode( in ); diff --git a/ceph/messages/MDiscover.h b/ceph/messages/MDiscover.h index 1e3b08f6733cf..5a78464a6fe36 100644 --- a/ceph/messages/MDiscover.h +++ b/ceph/messages/MDiscover.h @@ -14,6 +14,7 @@ class MDiscover : public Message { int asker; inodeno_t base_ino; // 0 -> none, want root bool want_base_dir; + bool want_root_inode; filepath want; // ... [/]need/this/stuff @@ -28,7 +29,8 @@ class MDiscover : public Message { MDiscover(int asker, inodeno_t base_ino, filepath& want, - bool want_base_dir = true) : + bool want_base_dir = true, + bool want_root_inode = false) : Message(MSG_MDS_DISCOVER) { this->asker = asker; this->base_ino = base_ino; diff --git a/ceph/messages/MDiscoverReply.h b/ceph/messages/MDiscoverReply.h index a9f93392c3382..f5ee70de97acf 100644 --- a/ceph/messages/MDiscoverReply.h +++ b/ceph/messages/MDiscoverReply.h @@ -87,7 +87,8 @@ class MDiscoverReply : public Message { // ... - virtual int decode_payload(crope r, int off = 0) { + virtual int decode_payload(crope r) { + int off = 0; r.copy(off, sizeof(base_ino), (char*)&base_ino); off += sizeof(base_ino); r.copy(off, sizeof(bool), (char*)&no_base_dir); @@ -103,9 +104,7 @@ class MDiscoverReply : public Message { dirs[i] = new CDirDiscover(); off = dirs[i]->_unrope(r, off); } - - // filepath - off = path._unrope(r, off); + dout(10) << n << " dirs out" << endl; // inodes r.copy(off, sizeof(int), (char*)&n); @@ -114,6 +113,12 @@ class MDiscoverReply : public Message { inodes[i] = new CInodeDiscover(); off = inodes[i]->_unrope(r, off); } + dout(10) << n << " inodes out" << endl; + + // filepath + off = path._unrope(r, off); + dout(10) << path.depth() << " dentries out" << endl; + return off; } virtual crope get_payload() { @@ -122,20 +127,27 @@ class MDiscoverReply : public Message { r.append((char*)&no_base_dir, sizeof(bool)); r.append((char*)&no_base_dentry, sizeof(bool)); + // dirs int n = dirs.size(); r.append((char*)&n, sizeof(int)); for (vector::iterator it = dirs.begin(); it != dirs.end(); it++) r.append((*it)->_rope()); + dout(10) << n << " dirs in" << endl; - r.append(path._rope()); - + // inodes n = inodes.size(); + r.append((char*)&n, sizeof(int)); for (vector::iterator it = inodes.begin(); it != inodes.end(); it++) r.append((*it)->_rope()); + dout(10) << n << " inodes in" << endl; + + // path + r.append(path._rope()); + dout(10) << path.depth() << " dentries in" << endl; return r; } diff --git a/ceph/msg/FakeMessenger.cc b/ceph/msg/FakeMessenger.cc index 6658cea600ba1..4cd61ea8d00f5 100644 --- a/ceph/msg/FakeMessenger.cc +++ b/ceph/msg/FakeMessenger.cc @@ -17,7 +17,7 @@ using namespace std; -#define SERIALIZE +//#define SERIALIZE #include "include/config.h" @@ -49,22 +49,22 @@ int fakemessenger_do_loop() " to " << MSG_ADDR_NICE(m->get_dest()) << ':' << m->get_dest_port() << " ---- " << m << endl; -#ifdef SERIALIZE - int t = m->get_type(); - if (true - || t == MSG_CLIENT_REQUEST - || t == MSG_CLIENT_REPLY - || t == MSG_MDS_DISCOVER - ) { - // serialize - crope buffer = m->get_serialized(); - delete m; - - // decode - m = decode_message(buffer); - assert(m); + if (g_conf.fakemessenger_serialize) { + int t = m->get_type(); + if (true + || t == MSG_CLIENT_REQUEST + || t == MSG_CLIENT_REPLY + || t == MSG_MDS_DISCOVER + ) { + // serialize + crope buffer = m->get_serialized(); + delete m; + + // decode + m = decode_message(buffer); + assert(m); + } } -#endif didone = true; it->second->dispatch(m); -- 2.39.5