Skip to content

ksysguard: handle multiple mounts to the same mountpoint gracefully

Jiří Paleček requested to merge jpalecek/ksysguard:multiple-mounts into master

On Linux, it may happen that two mounts are mounted to the same mount point. Two different devices or the same device twice, doesn't matter. As it currently is, ksysguardd handles this case badly. When updating sensors, the checkDiskStat fuction searches the previously known mounts for the items from the current list, by comparing the mount points only. If found, the item from the old list is deleted and the new item is deemed to be preexisting.

However, if there are two items with the same mountpoint, both get deleted on the first occurence of the mountpoint in the list. Therefore, the second one doesn't have any corresponding "old" entry, and is deemed to be newly existing. This means that ksysguardd signals to its client that there are new sensors, and, atop of that, registers the "new" monitors. This eventually leads to the list of monitors expanding to tens of thousands of items. This can cause quite a cpu load eg. in Plasma.

This patch changes the logic so that every mount will only delete one corresponding item from the old list. Thus, the bloat of the list of sensors, at least in case of disk sensors, is prevented.

Note: this is an old patch from phabricator https://phabricator.kde.org/D23592

Merge request reports