Switch vfs.nfsd.issue_delegations to TUNABLE ?

Rick Macklem rmacklem at uoguelph.ca
Fri Dec 1 22:33:28 UTC 2017

I have created D13327 on reviews.freebsd.org with a patch that keeps
track of # of issued write delegations and allows nfsrv_checkgetattr()
to return without acquiring the lock when it is 0.

Hopefully kib@, jhb@ or someone who is familiar with the use
of the atomic ops in the kernel can review it. (Where the counter
code goes should be fine, but I am not sure I got the use of the
atomic ops correct.)

Hopefully Emmanuel can test the patch to see if it fixes his
performance problem.


From: owner-freebsd-current at freebsd.org <owner-freebsd-current at freebsd.org> on behalf of Rick Macklem <rmacklem at uoguelph.ca>
Sent: Wednesday, November 29, 2017 12:28:05 PM
To: Emmanuel Vadot
Cc: Konstantin Belousov; FreeBSD Current; freebsd-fs at freebsd.org
Subject: Re: Switch vfs.nfsd.issue_delegations to TUNABLE ?

Emmanuel Vadot wrote:
[stuff snipped]
> I haven't test by I can say that it will work, I actually wondered at
>first doing that. The problem with this patch is what I tried to
>describe in my first and following mails, since you can turn on and off
>delegation you can still have delegation (so nfsrv_delegatecnt > 0)
>even if the sysctl is == 0. That's why I went to the tunable way, seems
>cleaner to me as disabling delegation doesn't really disable them for
>current client.
Yes, if you have delegations enabled and then disable them, there will
be delegations issued for a "while".
During that time, the code in nfsrv_checkgetattr() does need to check for
Since no new delegations will be issued, the outstanding ones will go
away when the client chooses to return them. (You can force this on the
client by doing a dismount/mount, at least for the FreeBSD client.)
Alternately, rebooting the server forces the clients to "recover" delegations
and, if they are disabled, that fails. (Actually the recover succeeds, but with
a flag set that tells the client it must return them asap.)

All the tunable does is make it impossible to disable them without
rebooting, but otherwise the effect is the same.

I have a patch that keeps a separate counter for write delegations
(which are the ones you care about) using atomics to maintain the
value. (That will be similar but somewhat better than what this patch does.)

[lots more snipped]
freebsd-current at freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"

More information about the freebsd-fs mailing list