Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osd: FileJournal: fix return code of create method #6988

Merged
merged 1 commit into from Dec 22, 2015

Conversation

xiexingguo
Copy link
Member

Shall return negative error code instead.

Fixes: #14134
Signed-off-by: xie xingguo xie.xingguo@zte.com.cn

Shall return negative error code instead.

Fixes: ceph#14134
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
@dzafman
Copy link
Contributor

dzafman commented Dec 22, 2015

LGTM We could call this code clean-up and leave it at that. Was this seen my someone or just through code inspection? I see that in the OSD's main() it won't notice the error as it should without this change.

@dzafman dzafman self-assigned this Dec 22, 2015
@xiexingguo
Copy link
Member Author

@dzafman Through code inspection.

@xiexingguo
Copy link
Member Author

@dzafman
It seems that the following call stack will be problematic:
main(from ceph_osd.cc)->FileStore::mkjournal()->FileJournal::create()

You may check the following code logic

if (mkjournal) {
common_init_finish(g_ceph_context);
int err = store->mkjournal();
if (err < 0) {
derr << TEXT_RED << " ** ERROR: error creating fresh journal " << g_conf->osd_journal
<< " for object store " << g_conf->osd_data
<< ": " << cpp_strerror(-err) << TEXT_NORMAL << dendl;
exit(1);
}
derr << "created new journal " << g_conf->osd_journal
<< " for object store " << g_conf->osd_data << dendl;
exit(0);
}

As you can see, the above code logic is not able to capture a positive error code returned by mkjournal().

dzafman added a commit that referenced this pull request Dec 22, 2015
FileJournal: fix return code of create method

Reviewed-by: David Zafman <dzafman@redhat.com>
@dzafman dzafman merged commit f14fe56 into ceph:master Dec 22, 2015
@xiexingguo xiexingguo deleted the xxg-wip-14134 branch December 22, 2015 23:36
@ghost ghost changed the title FileJournal: fix return code of create method osd: FileJournal: fix return code of create method Feb 10, 2016
@ghost ghost added bug-fix core labels Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants