Skip to content

fix(ebpf): capture issuer PID at I/O issue, not completion#632

Open
yairfalse wants to merge 1 commit into
mainfrom
fix/storage-pid-capture
Open

fix(ebpf): capture issuer PID at I/O issue, not completion#632
yairfalse wants to merge 1 commit into
mainfrom
fix/storage-pid-capture

Conversation

@yairfalse
Copy link
Copy Markdown
Collaborator

Summary

  • Add issuer PID tracking to the internal storage inflight I/O map.
  • Emit the PID captured at block_rq_issue instead of reading current at completion.

Why

block_rq_complete commonly runs in softirq context, where current may be unrelated to the process that issued the I/O. Capturing the issuer PID at issue time keeps storage anomaly events attributed to the correct process.

Test plan

  • cargo check --workspace passes
  • eBPF program still compiles with: clang -O2 -g -target bpf -D__TARGET_ARCH_x86 -I ebpf/headers -c ebpf/storage_monitor.c -o /tmp/out.o
  • storage_event userspace layout remains unchanged; only internal io_value grows

Copy link
Copy Markdown
Collaborator Author

@yairfalse yairfalse left a comment

Choose a reason for hiding this comment

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

LGTM (review-only — self-authored, can't formally approve).

Verified the struct alignment after adding issuer_pid:

  • issue_ns (u64) at 0, cgroup_id (u64) at 8, bytes (u32) at 16, issuer_pid (u32) at 20, opcode (u8) at 24, padding[7] at 25-31 → 32 bytes total, 8-byte aligned. Clean.

io_value is internal to the BPF program (not crossed to Rust), so the userspace storage_event layout is unchanged. Memory cost is ~80KB extra across the 10k-entry inflight_io LRU map — negligible.

Note for whoever merges: this repo has no CI, so please run clang -O2 -g -target bpf -D__TARGET_ARCH_x86 -I ebpf/headers -c ebpf/storage_monitor.c -o /tmp/out.o locally to confirm the program still compiles before merging.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant