From 30adf5b7d5acf1423e943423b3a75206bd2374ba Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 9 Jun 2015 12:32:42 +0200 Subject: [PATCH] os/FileJournal.cc: fix do-while loop In case do_submit from libaio fails and returns -EAGAIN the called continue breaks completely out of the loop since the loop statement is always false. In this case there is no second attempt as the code tries. Set the loop condition to true to fix it. Fix for: CID 1297886 (#1 of 1): Structurally dead code (UNREACHABLE) continue_in_do_while_false: A continue statement within a do-while loop only continues execution of the loop body if the loop continuation condition is still true. Since the condition will never be true in a "do ... while (false);" loop the continue statement has the same effect as a break statement. Did you intend execution to continue at the top of the loop? do_while_false_condition: This loop will never continue since the condition false is never true. Signed-off-by: Danny Al-Gaaf --- src/os/FileJournal.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index cf26e5d4f8e71..e0ffe069d8435 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -1451,8 +1451,10 @@ int FileJournal::write_aio_bl(off64_t& pos, bufferlist& bl, uint64_t seq) continue; } assert(0 == "io_submit got unexpected error"); + } else { + break; } - } while (false); + } while (true); pos += aio.len; } write_finish_cond.Signal();