From 6253aea4b943a193573fb7b76421573d36c6f0e8 Mon Sep 17 00:00:00 2001 From: xiexingguo <258156334@qq.com> Date: Wed, 28 Oct 2015 14:26:42 +0800 Subject: [PATCH] FileJournal:_fdump wrongly returns if journal is currently unreadable. _fdump wrongly returns if journal is currently unreadable, and fix some other errors also. Fixes: #13626 Signed-off-by: xie xingguo --- src/os/FileJournal.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index a6157d03932d..871e875e40ff 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -292,7 +292,7 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize, char *buf; ret = ::posix_memalign((void **)&buf, block_size, write_size); if (ret != 0) { - return ret; + return -ret; } memset(static_cast(buf), 0, write_size); uint64_t i = 0; @@ -629,7 +629,8 @@ int FileJournal::_fdump(Formatter &f, bool simple) if (!pos) { dout(2) << "_dump -- not readable" << dendl; - return false; + err = -EINVAL; + break; } stringstream ss; read_entry_result result = do_read_entry( @@ -643,7 +644,7 @@ int FileJournal::_fdump(Formatter &f, bool simple) dout(2) << "Unable to read past sequence " << seq << " but header indicates the journal has committed up through " << header.committed_up_to << ", journal is corrupt" << dendl; - err = EINVAL; + err = -EINVAL; } dout(25) << ss.str() << dendl; dout(25) << "No further valid entries found, journal is most likely valid" -- 2.47.3