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

network: set link state configuring before setting addresses #11274

Merged
merged 6 commits into from Jan 2, 2019

Conversation

yuwata
Copy link
Member

@yuwata yuwata commented Dec 25, 2018

As link_request_set_neighbors() may set link state 'configured'.

Fixes #11272.

cc @wkennington and @ssahani.

@ssahani
Copy link
Contributor

ssahani commented Dec 26, 2018

It's a bit tricky. We are forcefully making state to be unconfigured before going to the function . Should we do this ? I am still thinking about this.

@yuwata
Copy link
Member Author

yuwata commented Dec 26, 2018

Indeed. I will try to rework this. Thank you for the comment.

@wkennington
Copy link
Contributor

The cause of the original bug doesn't make sense to me. We shouldn't be able to set LINK_STATE_CONFIGURED until we have set all of the addresses, neighbors, and routes as the conditions for making it through link_check_ready() requires all of those to be set.

@wkennington
Copy link
Contributor

Is this not a bug caused by not resetting the *_configured booleans to false before running through the configure routines again?

@yuwata
Copy link
Member Author

yuwata commented Dec 26, 2018

@wkennington and @ssahani Thank you for the comments. I have updated this. PTAL.

@aroig If possible, please test the new version. Thank you.

@yuwata
Copy link
Member Author

yuwata commented Dec 26, 2018

Or, maybe we should drop *_configured. They seem to be equivalent to *_messages == 0, at least for addresses, neighbors, and static_routes.

@aroig
Copy link
Contributor

aroig commented Dec 27, 2018

I confirm that the last changes in this PR fix #11272 for me.

@ssahani
Copy link
Contributor

ssahani commented Dec 27, 2018

I think this should be OK

link->neighbors_configured = true;
link_check_ready(link);
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't get rid of this in case we re-arrange the logic for setting neighbors. All of the other functions perform the same check which should be safe regardless of where it is executed.

Copy link
Member Author

Choose a reason for hiding this comment

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

which should be safe regardless of where it is executed.

Good point.

@@ -794,6 +794,8 @@ static int link_set_routing_policy_rule(Link *link) {
assert(link);
assert(link->network);

link->routing_policy_rules_configured = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

These should all be set to false at the same location in the codebase, likely when networkd determines that we need to reconfigure a link. Otherwise the invariant for link_check_ready() might not hold.

@@ -902,7 +906,7 @@ static int link_request_set_neighbors(Link *link) {
assert(link->network);
assert(link->state != _LINK_STATE_INVALID);

link_set_state(link, LINK_STATE_CONFIGURING);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to leave this once we correct the invariants on link_check_ready(). Just in case we decide to re-arrange the ordering of the link_set_* functions in the future. There is no reason why link_set_neighbors should depend on link_set_addresses setting this state.

@yuwata yuwata added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 28, 2018
@yuwata
Copy link
Member Author

yuwata commented Dec 30, 2018

Force-pushed the 3rd version. I hope all comments by @wkennington are addressed. PTAL. Thank you.

@yuwata yuwata removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 30, 2018
@wkennington
Copy link
Contributor

This looks functionally good, but I'm not terribly happy with having the configuration functions needing to know exactly what to deconfigure. It would be nice if the caller which is performing the link configuration just called link_set_unconfigured or something,

@yuwata
Copy link
Member Author

yuwata commented Jan 1, 2019

@wkennington Hmm, I'd like to keep setting *_configured at the relevant functions for the readability.
Now, except for addresses, all link_request_set_*() set link state CONFIGURING and the relevant _configured flag false. So, when we implement, for example, networkctl set-neighbor or something, then the relevant function just need to parse the input and call link_request_set_neighbors().

@yuwata
Copy link
Member Author

yuwata commented Jan 2, 2019

@wkennington So, anyway, I would like to leave further cleanups in other PRs. Because, initially, this is intended to fix issue #11272. What do you think about?

@yuwata
Copy link
Member Author

yuwata commented Jan 2, 2019

Just rebased and update comments.

@wkennington
Copy link
Contributor

Seems fine to me

@yuwata
Copy link
Member Author

yuwata commented Jan 2, 2019

OK. Let's merge this.

@yuwata yuwata merged commit 788291d into systemd:master Jan 2, 2019
@yuwata yuwata deleted the fix-11272 branch January 2, 2019 23:29
@nfnty
Copy link

nfnty commented Feb 13, 2019

Can this be backported to stable? It's not ok to have networkd crashing repeatedly.

@ssahani
Copy link
Contributor

ssahani commented Feb 13, 2019

Ohhh please provide the dump.

@nfnty
Copy link

nfnty commented Feb 13, 2019

@ssahani Same as #11272.

@ssahani
Copy link
Contributor

ssahani commented Feb 13, 2019

@nfnty you mean including this PR networkd crashing ? If so please provide your minimal conf so that we can fix this in current git.

@nfnty
Copy link

nfnty commented Feb 13, 2019

@ssahani No, I just want this PR to be backported to https://github.com/systemd/systemd-stable, so that distros that use the stable branch get this issue fixed.

@ssahani
Copy link
Contributor

ssahani commented Feb 13, 2019

@nfnty ok . we have not reported any crash till now as per I know @yuwata is there any ? Please test with down stream if you still face it report back. we will work on it . Thanks !

@yuwata
Copy link
Member Author

yuwata commented Feb 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

5 participants