-
Notifications
You must be signed in to change notification settings - Fork 39
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
Map removal fix #340
Map removal fix #340
Conversation
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Atul-source Please validate this case.
|
@Atul-source Better to handle the deletion of Map files while loading the eBPF program, instead of handling during stopping of eBPF program, so that we can guarantee that there are no duplicate Maps. |
kf/bpf.go
Outdated
b.Program.Name, b.Program.ProgType, ifaceName, mapFilename, err) | ||
} | ||
if fileExists(mapFilename) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a BPF map is shared by multiple programs, and one program unpins the map while another program is still accessing it, it can lead to unpredictable behavior. To avoid this, you can check if the reference count of the map is less than 1 using v.GetRefCount()
, and then proceed to delete the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is v.GetRefCount() a library function ?
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Sometimes Unpinning the eBPF maps don't remove the files ( internally os.Remove not worked). In this PR I have added a condition when Unpinning doesn't remove the map file the we should Remove it.