journaler: check return code on _finish_write_head.

If we get an error code and assume we successfully wrote the head,
there are going to be all kinds of issues on replay!

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
This commit is contained in:
Greg Farnum 2011-04-18 14:34:14 -07:00
parent 42a7013907
commit e6393525cf
2 changed files with 4 additions and 3 deletions

View File

@ -309,7 +309,7 @@ public:
Context *oncommit;
C_WriteHead(Journaler *l, Header& h_, Context *c) : ls(l), h(h_), oncommit(c) {}
void finish(int r) {
ls->_finish_write_head(h, oncommit);
ls->_finish_write_head(r, h, oncommit);
}
};
@ -336,8 +336,9 @@ void Journaler::write_head(Context *oncommit)
new C_WriteHead(this, last_written, oncommit));
}
void Journaler::_finish_write_head(Header &wrote, Context *oncommit)
void Journaler::_finish_write_head(int r, Header &wrote, Context *oncommit)
{
assert(r >= 0); // we can't really recover from write errors here
assert(!readonly);
dout(10) << "_finish_write_head " << wrote << dendl;
last_committed = wrote;

View File

@ -138,7 +138,7 @@ private:
// header
utime_t last_wrote_head;
void _finish_write_head(Header &wrote, Context *oncommit);
void _finish_write_head(int r, Header &wrote, Context *oncommit);
class C_WriteHead;
friend class C_WriteHead;