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: fix reference count, rare race condition etc. #8254

Merged
merged 3 commits into from Mar 26, 2016

Conversation

xiexingguo
Copy link
Member

No description provided.

@xiexingguo
Copy link
Member Author

@liewegas

// we drop the pg_map_lock and give it back to caller.
// This is necessary because we may race with _remove_pg(),
// who will remove the last reference and destruct PG in most case.
out->get("get_pg_or_queue_for_pg");
Copy link
Contributor

Choose a reason for hiding this comment

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

but they are both guarded by osd_lock, i believe?

@tchaikov
Copy link
Contributor

apart from 9f2a1c9 and 8f54967 , the commits look good to me.

@xiexingguo
Copy link
Member Author

@tchaikov Dropped those two changes. Thanks for the review.

@tchaikov
Copy link
Contributor

lgtm

@xiexingguo xiexingguo force-pushed the xxg-wip-osd branch 2 times, most recently from f37425d to 03c5a93 Compare March 23, 2016 00:43
The lock() method will ensure 'dirty_info' will be false,
and within this function's scope I see no possibility to
set 'dirty_info' true. Thus I guess the transaction cleanup
logic before exit is never reachable and therefore shall be
considered as redundant and can be safely removed.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
On returning false, the require_mon_peer() will internally decrease
the reference of the input message.

So the put() method here is duplicated and will cause reference
underflow and thus need to be dropped.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
Theoretically even if _have_pg() returns ture, we still can't assert that
_lookup_lock_pg() will always succeed. This is because when we switch between
these two methods, we will drop pg_map_lock, and thus may let a pg removal
sneak in, which may eventually cause divergence.

However this is a really rare case, and is less likely to happen in a
production environment. But this pr provided a safer way to achieve
the same goal and is a little faster by eliminating a duplicated search
from the pg_map, which makes it meaningful.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
@tchaikov
Copy link
Contributor

lgtm.

@xiexingguo xiexingguo added this to the jewel milestone Mar 24, 2016
@liewegas liewegas merged commit 77cec5d into ceph:master Mar 26, 2016
@xiexingguo xiexingguo deleted the xxg-wip-osd branch March 26, 2016 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants