On 21.09.2016 16:20, Jeff Layton wrote: > Good catch. I'm not very fond of the refcounting this here but it > should > serve the purpose and I don't have anything better to suggest. FWIW, I > think the nfsd_mutex is held during all of these operations so we > probably don't need atomics for the refcount.
I've copied idea from netfilters, look at using of masquerade_notifier_refcount Perhaps someday in future we'll replace all such cases by some common primitive.