Skip to content

Commit fc45fa6

Browse files
authored
Merge pull request #535 from bpfman/revert-493-reverse-unload-order
Revert "Reverse program unload order to respect map ownership"
2 parents 868321d + 7b89f5a commit fc45fa6

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

controllers/bpfman-agent/cl_application_program.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,7 @@ func (r *ClBpfApplicationReconciler) load(ctx context.Context) error {
764764
}
765765

766766
func (r *ClBpfApplicationReconciler) unload(ctx context.Context) {
767-
// Unload in reverse order because the first program is the map owner
768-
// and subsequent programs may share its maps. Dependents must be
769-
// unloaded before the map owner.
770-
for i := len(r.currentAppState.Status.Programs) - 1; i >= 0; i-- {
771-
program := r.currentAppState.Status.Programs[i]
767+
for i, program := range r.currentAppState.Status.Programs {
772768
if program.ProgramId != nil {
773769
err := bpfmanagentinternal.UnloadBpfmanProgram(ctx, r.BpfmanClient, *program.ProgramId)
774770
if err != nil {

controllers/bpfman-agent/ns_application_program.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,7 @@ func (r *NsBpfApplicationReconciler) load(ctx context.Context) error {
681681
}
682682

683683
func (r *NsBpfApplicationReconciler) unload(ctx context.Context) {
684-
// Unload in reverse order because the first program is the map owner
685-
// and subsequent programs may share its maps. Dependents must be
686-
// unloaded before the map owner.
687-
for i := len(r.currentAppState.Status.Programs) - 1; i >= 0; i-- {
688-
program := r.currentAppState.Status.Programs[i]
684+
for i, program := range r.currentAppState.Status.Programs {
689685
if program.ProgramId != nil {
690686
err := bpfmanagentinternal.UnloadBpfmanProgram(ctx, r.BpfmanClient, *program.ProgramId)
691687
if err != nil {

0 commit comments

Comments
 (0)