linux: fix reading zram values#2045
Conversation
This is a follow-up on an earlier commit 'linux: avoid repeated zram ENOENT probes'. Actually `/sys/block/zramN` are symlinks, so setting O_NOFOLLOW breaks this. Let's drop the option. Fixes: 9fe974b
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe zram device scanner’s Suggested reviewers: Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Well, alternatively we could look into Wondering if the paths and/or symlinks changed with recent linux versions? |
Komzpa
left a comment
There was a problem hiding this comment.
Thanks for catching this and for opening #2045.
/sys/block/zramN has been zram's documented sysfs interface since the
original 2010 sysfs conversion,
and the current kernel ABI still documents
disksize and mm_stat there.
On current kernels, entries under /sys/block are symlinks, so
openat(..., O_DIRECTORY | O_PATH | O_NOFOLLOW) fails with ENOTDIR before
the relative disksize and mm_stat reads can run. Dropping O_NOFOLLOW
fixes that while retaining the dirfd-relative reads.
I would keep /sys/block: switching to /sys/devices/virtual/block would bind
htop to the backing sysfs topology instead of the documented userspace ABI.
The one-line fix looks correct to me. Thank you!
|
Thanks for revealing the details. Sounds like keeping the documented path is the correct approach. |
This is a follow-up on an earlier commit 'linux: avoid repeated zram ENOENT probes'.
Actually
/sys/block/zramNare symlinks, so setting O_NOFOLLOW breaks this. Let's drop the option.Fixes: 9fe974b