Skip to content

endpoint: atomically replace header files#12380

Merged
pchaigno merged 1 commit intomasterfrom
pr/tklauser/ep-header-atomic-replace
Jul 2, 2020
Merged

endpoint: atomically replace header files#12380
pchaigno merged 1 commit intomasterfrom
pr/tklauser/ep-header-atomic-replace

Conversation

@tklauser
Copy link
Copy Markdown
Member

@tklauser tklauser commented Jul 2, 2020

Write contents of the header file to a temporary file first. It will
then be atomically renamed to the real file. This makes sure we never
end up with corrupted on inconsistent header files on the filesystem.
The github.com/google/renameio package is used for the atomic replace.

For #12367

Atomically replace endpoint header files to avoid corrupted or inconsistent state.

@tklauser tklauser added release-note/minor This PR changes functionality that users may find relevant to operating Cilium. needs-backport/1.7 labels Jul 2, 2020
@tklauser tklauser requested review from a team as code owners July 2, 2020 09:42
@tklauser
Copy link
Copy Markdown
Member Author

tklauser commented Jul 2, 2020

test-me-please

Copy link
Copy Markdown
Member

@pchaigno pchaigno left a comment

Choose a reason for hiding this comment

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

One comment below for downgrade case. LGTM otherwise!

Comment thread pkg/endpoint/bpf.go Outdated
@tklauser tklauser force-pushed the pr/tklauser/ep-header-atomic-replace branch from 4037d23 to 52c81e5 Compare July 2, 2020 10:12
@tklauser
Copy link
Copy Markdown
Member Author

tklauser commented Jul 2, 2020

test-me-please

Comment thread pkg/endpoint/bpf.go Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented Jul 2, 2020

Coverage Status

Coverage increased (+0.03%) to 36.936% when pulling 93d38c7 on pr/tklauser/ep-header-atomic-replace into 425fbd7 on master.

@tklauser tklauser force-pushed the pr/tklauser/ep-header-atomic-replace branch from 52c81e5 to 652429e Compare July 2, 2020 10:27
@tklauser
Copy link
Copy Markdown
Member Author

tklauser commented Jul 2, 2020

test-me-please

@tklauser
Copy link
Copy Markdown
Member Author

tklauser commented Jul 2, 2020

retest-net-next (vm provisioning fail: https://jenkins.cilium.io/job/Cilium-PR-K8s-oldest-net-next/1075)

Comment thread pkg/endpoint/bpf.go Outdated
Write contents of the header file to a temporary file first. It will
then be atomically renamed to the real file. This makes sure we never
end up with corrupted on inconsistent header files on the filesystem.
Also make sure the symlink to the old header file in the downgrade case
is created atomically. The github.com/google/renameio package is used
for the atomic replace and symlink creation.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser tklauser force-pushed the pr/tklauser/ep-header-atomic-replace branch from 652429e to 93d38c7 Compare July 2, 2020 14:09
@tklauser
Copy link
Copy Markdown
Member Author

tklauser commented Jul 2, 2020

test-me-please

@maintainer-s-little-helper maintainer-s-little-helper Bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants