]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vfs_mount.c: Free exports structures in vfs_destroy_mount()
authorRick Macklem <rmacklem@FreeBSD.org>
Sat, 4 Feb 2023 22:45:23 +0000 (14:45 -0800)
committerRick Macklem <rmacklem@FreeBSD.org>
Sat, 4 Feb 2023 22:45:23 +0000 (14:45 -0800)
commitdb5655124ca4047ac397b9421ca4a08868a49ae9
tree3e4f3104e2ebfcd99b50c07c7b8659b61124f87a
parentd94e0bdc1498fa95d1de0b54dfa9af0d73c0fb21
vfs_mount.c: Free exports structures in vfs_destroy_mount()

During testing of exporting file systems in jails, I
noticed that the export structures on a mount
were not being free'd when the mount is dismounted.

This bug appears to have been in the system for a
very long time.  It would have resulted in a slow memory
leak when exported file systems were dismounted.

Prior to r362158, freeing the structures during dismount
would not have been safe, since VFS_CHECKEXP() returned
a pointer into an export structure, which might still have been
used by the NFS server for an in-progress RPC when the file system
is dismounted.  r362158 fixed this, so it should now be safe
to free the structures in vfs_mount_destroy(), which is what
this patch does.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D38385
sys/kern/vfs_export.c
sys/kern/vfs_mount.c
sys/sys/mount.h