Page MenuHomeFreeBSD

netexport: Move struct netexport into a .h file and refcnt it
AcceptedPublic

Authored by rmacklem on Fri, Jun 12, 9:10 PM.
Tags
None
Referenced Files
F159422506: D57553.diff
Sat, Jun 13, 9:02 PM
F159422490: D57553.diff
Sat, Jun 13, 9:02 PM
F159395275: D57553.diff
Sat, Jun 13, 4:25 PM

Details

Reviewers
kib
markj
Summary

This patch moves "struct netexport" into a separate
netexport.h file and refcounts the structure, plus adds
a few fields that will be used in a future NFS server
commit.

malloc()/free() is replaced by vfs_netexport_alloc()
and vfs_netexport_free().

Test Plan

Tested with a NFS patch that uses the new fields
and does acquire a refcount on the structure so
that it will not be free'd prematurely.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/kern/vfs_export.c
687

Should be refcount_init()

Use refcount_init() as suggested by kib@.

sys/kern/vfs_export.c
61

Why not group it with the other sys/* includes?

351–353

Is this line resetting the netexport structure? It will clobber the refcount and mutex.

sys/kern/vfs_export.c
61

Because it won't compile.. netexport needs
the radix_node structure defined.

351–353

Ouch!! Good catch. I'll fix this for the next version of
the patch.

Fix the memset() so that it only zeros out
part of the structure, as spotted by markj@.

kib added inline comments.
sys/kern/vfs_export.c
61

I would add a short comment on this line to explain the ordering requirement.

This revision is now accepted and ready to land.Sun, Jun 14, 2:54 AM