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

rbd-nbd: restart parent process logger after forking #12222

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tools/rbd_nbd/rbd-nbd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,9 @@ static int do_map()
}

if (forker.is_parent()) {
global_init_postfork_start(g_ceph_context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can move this line out above if (forker.is_parent()) block, so it always gets called after fork()? and remove the call at line 636 in the if (g_conf->daemonize) block. so both child and parent's logger can be started, and can be stopped properly by the dtor of g_ceph_context?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daemon process fails if you do that -- this is what works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tested the proposed using rbd-nbd map rbd, it does not crash. maybe i am missing something?

Copy link
Author

@dillaman dillaman Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashing is one thing (which should have been tested before the breaking commit was merged), but passing all the tests is another (rbd-nbd workunit and fsx in nbd mode).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me both versions look working. Anyway, I think the current initialization code in do_map already a bit confusing and it would be nice to try clean it up (as a separate PR, I could try this), so now any version that just fixes the issue could be ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dillaman oic! i will try to run the rbd tests next time when i am touching rbd related code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tchaikov Thanks! Yes, please changes to RBD should be tested and reviewed.

if (forker.parent_wait(err) != 0) {
return -ENXIO;
return -ENXIO;
}
return 0;
}
Expand Down