From ec6f108df54c89481f109ff0c48524c353c061c5 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Thu, 24 Mar 2016 15:09:06 +0530 Subject: [PATCH] os/bluestore: ceph-bluefs-tool fixes Couple of fixes: - check vector size before using - fix assert() failure after write_fd() Fixes: #15261 Signed-off-by: Venky Shankar --- src/os/bluestore/bluefs_tool.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/os/bluestore/bluefs_tool.cc b/src/os/bluestore/bluefs_tool.cc index 02bcb2f6143..37385659176 100644 --- a/src/os/bluestore/bluefs_tool.cc +++ b/src/os/bluestore/bluefs_tool.cc @@ -14,6 +14,11 @@ #include "os/bluestore/BlueFS.h" +void usage(char **argv) +{ + cout << argv[0] << " " << std::endl;; +} + int main(int argc, char **argv) { vector args; @@ -29,6 +34,11 @@ int main(int argc, char **argv) BlueFS fs; + if (args.size() != 4) { + usage(argv); + exit(-1); + } + cout << "args " << args << std::endl; string outdir = args[0]; for (unsigned i = 1; i < args.size(); ++i) { @@ -73,7 +83,7 @@ int main(int argc, char **argv) r = fs.read(h, &h->buf, pos, left, &bl, NULL); assert(r > 0); int rc = bl.write_fd(fd); - assert(rc == r); + assert(rc == 0); pos += r; left -= r; } -- 2.47.3