From 2f5718f4bcf5370a37d5b8e89bdc5f7746237edd Mon Sep 17 00:00:00 2001 From: sageweil Date: Fri, 13 Jul 2007 17:26:05 +0000 Subject: [PATCH] * uninit mem bug in ebofs git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1495 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/ebofs/Ebofs.cc | 12 ++++++------ trunk/ceph/ebofs/Ebofs.h | 6 +++--- trunk/ceph/ebofs/FileJournal.cc | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/trunk/ceph/ebofs/Ebofs.cc b/trunk/ceph/ebofs/Ebofs.cc index b2a076c699417..2f33b2098b34b 100644 --- a/trunk/ceph/ebofs/Ebofs.cc +++ b/trunk/ceph/ebofs/Ebofs.cc @@ -1512,7 +1512,7 @@ void Ebofs::alloc_write(Onode *on, -void Ebofs::apply_write(Onode *on, off_t off, size_t len, bufferlist& bl) +void Ebofs::apply_write(Onode *on, off_t off, size_t len, const bufferlist& bl) { ObjectCache *oc = on->get_oc(&bc); @@ -2319,7 +2319,7 @@ unsigned Ebofs::_apply_transaction(Transaction& t) -int Ebofs::_write(object_t oid, off_t offset, size_t length, bufferlist& bl) +int Ebofs::_write(object_t oid, off_t offset, size_t length, const bufferlist& bl) { dout(7) << "_write " << oid << " " << offset << "~" << length << endl; assert(bl.length() == length); @@ -2384,7 +2384,7 @@ int Ebofs::_write(object_t oid, off_t offset, size_t length, bufferlist& bl) int Ebofs::write(object_t oid, off_t off, size_t len, - bufferlist& bl, Context *onsafe) + const bufferlist& bl, Context *onsafe) { ebofs_lock.Lock(); assert(len > 0); @@ -2399,9 +2399,9 @@ int Ebofs::write(object_t oid, if (journal) { Transaction t; t.write(oid, off, len, bl); - bufferlist bl; - t._encode(bl); - if (journal->submit_entry(bl, onsafe)) break; + bufferlist tbl; + t._encode(tbl); + if (journal->submit_entry(tbl, onsafe)) break; } if (onsafe) commit_waiters[super_epoch].push_back(onsafe); break; diff --git a/trunk/ceph/ebofs/Ebofs.h b/trunk/ceph/ebofs/Ebofs.h index eb20cf8920531..4d95a71f77e4e 100644 --- a/trunk/ceph/ebofs/Ebofs.h +++ b/trunk/ceph/ebofs/Ebofs.h @@ -188,7 +188,7 @@ protected: block_t start, block_t len, interval_set& alloc, block_t& old_bfirst, block_t& old_blast); - void apply_write(Onode *on, off_t off, size_t len, bufferlist& bl); + void apply_write(Onode *on, off_t off, size_t len, const bufferlist& bl); bool attempt_read(Onode *on, off_t off, size_t len, bufferlist& bl, Cond *will_wait_on, bool *will_wait_on_bool); @@ -275,7 +275,7 @@ protected: int read(object_t, off_t off, size_t len, bufferlist& bl); int is_cached(object_t oid, off_t off, size_t len); - int write(object_t oid, off_t off, size_t len, bufferlist& bl, Context *onsafe); + int write(object_t oid, off_t off, size_t len, const bufferlist& bl, Context *onsafe); void trim_from_cache(object_t oid, off_t off, size_t len); int truncate(object_t oid, off_t size, Context *onsafe=0); int truncate_front(object_t oid, off_t size, Context *onsafe=0); @@ -339,7 +339,7 @@ private: int _getattrs(object_t oid, map &aset); bool _write_will_block(); - int _write(object_t oid, off_t off, size_t len, bufferlist& bl); + int _write(object_t oid, off_t off, size_t len, const bufferlist& bl); void _trim_from_cache(object_t oid, off_t off, size_t len); int _truncate(object_t oid, off_t size); int _truncate_front(object_t oid, off_t size); diff --git a/trunk/ceph/ebofs/FileJournal.cc b/trunk/ceph/ebofs/FileJournal.cc index 8bc942c861b92..40a73a442182d 100644 --- a/trunk/ceph/ebofs/FileJournal.cc +++ b/trunk/ceph/ebofs/FileJournal.cc @@ -48,6 +48,7 @@ int FileJournal::create() dout(1) << "open " << fn << " " << st.st_size << " bytes" << endl; // write empty header + memset(&header, 0, sizeof(header)); header.clear(); header.fsid = ebofs->get_fsid(); header.max_size = st.st_size; @@ -274,7 +275,7 @@ bool FileJournal::submit_entry(bufferlist& e, Context *oncommit) << endl; full = true; print_header(); - return false; + return false; } } else { // we haven't wrapped. -- 2.39.5