openwrt / openwrt/fstools

Block hotplug is accidentally quadratic

Open
#2 2 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.