]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
* uninit mem bug in ebofs
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 13 Jul 2007 17:26:05 +0000 (17:26 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 13 Jul 2007 17:26:05 +0000 (17:26 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1495 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/ebofs/Ebofs.cc
trunk/ceph/ebofs/Ebofs.h
trunk/ceph/ebofs/FileJournal.cc

index b2a076c6994172effd1bcbd45caa656210874a9a..2f33b2098b34b23314dc681e8a5e0fa23d037bc3 100644 (file)
@@ -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;
index eb20cf89205316e5476a4a76577951a317dd3b53..4d95a71f77e4e4905cbd2e0f7d80b77d65156e74 100644 (file)
@@ -188,7 +188,7 @@ protected:
                    block_t start, block_t len, 
                    interval_set<block_t>& 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<string,bufferptr> &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);
index 8bc942c861b92ecb605868c75ad613482a1aa121..40a73a442182d17e2495f6009afaf4a889f4dfc0 100644 (file)
@@ -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.