HomeFreeBSD

getmntinfo(3): Scale faster, and return sooner

Description

getmntinfo(3): Scale faster, and return sooner

getmntinfo(3) is designed around a relatively static or slow growing set of
current mounts. It tried to detect a race with somewhat concurrent mount
and re-call getfsstat(2) in that case, looping indefinitely. It also
allocated space for a single extra mount as slop.

In the case where the user has a large number of mounts and is adding them
at a rapid pace, it fell over.

This patch makes two functional changes:

  1. Allocate even more slop. Double whatever the last getfsstat(2) returned.
  1. Abort and return some known results after looping a few times (arbitrarily, 3). If the list is constantly changing, we can't guarantee we return a full result to the user at any point anyways.

While here, add very basic functional tests for getmntinfo(3) to the libc
suite.

PR: 221743
Submitted by: Peter Eriksson <peter AT ifm.liu.se> (earlier version)
Sponsored by: Dell EMC Isilon

Details

Provenance
cemAuthored on Aug 25 2017, 4:38 PM
Parents
rG88e2cc9eb56b: Replace makefs' hand-rolled unescaping with strunvis
Branches
Unknown
Tags
Unknown

Event Timeline