Block hotplug is accidentally quadratic
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 4
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
The cache_load call in mount_action ignores the device name parameter: https://github.com/openwrt/fstools/blob/bfe882d5ff4eeebb8f57c8a0f9b9e767a57870d8/block.c#L1256
As such, each hotplug event (specifically, each /sbin/block hotplug invoked via /etc/hotplug.d/block/10-mount via /sbin/hotplug-call through the machinations of /etc/hotplug.json) probes all the block devices named here:
https://github.com/openwrt/fstools/blob/bfe882d5ff4eeebb8f57c8a0f9b9e767a57870d8/block.c#L580-L596
That's rather a lot, if not all, of the block devices on the system, making the total block hotplug sequence accidentally quadratic.
I hope this is the right place to raise this issue, and I've also documented a bit about how I found this over in this forum thread, but if it belongs somewhere else, please let me know.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in block.c at mount_action around line 1256 and trace cache_load, then compare it with the device-name handling around lines 580-596. Reproduce the /sbin/block hotplug path through /etc/hotplug.d/block/10-mount and verify that each event no longer probes unrelated block devices; confirm the hotplug sequence completes without the repeated enumeration described here.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100