Peter reported via email that mountd would take 16seconds to reload the
exports upon receipt of a SIGHUP for his 72,000+ file system server,
which results in a 16sec suspension of the nfsd threads.
D20270 replaced the single linked list of exportlist elements with a hash table of lists.
That should have improved performance somewhat. However, I believe a majority of the
time spent reloading is when mountd.c deletes and reloads all the exports in the kernel.
This patch adds a "-I" option that tells mountd
to only delete/load exports in the kernel for export file entries that
have changed. There will somewhat increased CPU overheads for first doing
the processing of the exports file(s) and then comparing the old and new
to find the changes that need to be done via nmount() for the kernel.
However, the processing of the exports file(s) can be done before the nfsd
threads are suspended (assuming the "-S" option), so hopefully the duration
of the nfsd threads being suspended will be shortened considerably for small
changes (what will typically happen for a reload) to the exports file(s).
Measurements by Peter Erikkson show that the time the nfsd threads are suspended
is reduced from seconds to milliseconds for server with 20000 exported file systems.
There have been several commits done to restructure the code so that this patch is
more straightforward. It is still pretty large, but I don't see an obvious advantage to
committing it in sections.
Basically, with the "-I" option, the old exports structures (a hash table of linked lists
with other structures hanging off the entries in these lists) are kept and a new hash
table of linked lists is created as "pass 1" of the reload. Then the two sets of lists
are traversed looking for any changes. When changes are found, they are handled by
updating the kernel exports, as required.
At the end of this comparison pass, the new hash table of export lists becomes the current
one and the old hash table of lists is free'd up.