Page MenuHomeFreeBSD

dounmount: do not release the mount point's reference on the covered vnode
ClosedPublic

Authored by avg on Sep 12 2017, 6:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 9 2024, 6:05 PM
Unknown Object (File)
Dec 22 2023, 11:54 PM
Unknown Object (File)
Dec 7 2023, 12:12 AM
Unknown Object (File)
Dec 1 2023, 11:20 AM
Unknown Object (File)
Aug 17 2023, 11:04 PM
Unknown Object (File)
Aug 16 2023, 2:49 PM
Unknown Object (File)
Aug 8 2023, 10:10 AM
Unknown Object (File)
Aug 4 2023, 6:00 PM
Subscribers

Details

Summary

As long as mnt_ref is not zero there can be a consumer that might try
to access mnt_vnodecovered. For this reason the covered vnode must not
be freed until mnt_ref goes to zero.
So, move the release of the covered vnode to vfs_mount_destroy.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

There is also one use of vfs_mount_destroy() in zfs, but I did not looked at it. You should know it much better.

sys/kern/vfs_mount.c
826 ↗(On Diff #32946)

Look at this fragment. I believe that you need vref(vp) before the call to vfs_mount_destroy() at line 822.

sys/kern/vfs_mount.c
826 ↗(On Diff #32946)

Maybe setting mnt_vnodecovered to NULL would be a better solution?
The mp should not be visible to any external consumers yet.
The same would apply to mount_snapshot in ZFS code.

sys/kern/vfs_mount.c
826 ↗(On Diff #32946)

Fine with me.

clear mnt_vnodecovered before calling vfs_mount_destroy in case of the mount failure,
that's safe to do because the new struct mount is not visible to the outside world

This revision is now accepted and ready to land.Sep 12 2017, 11:09 AM
This revision was automatically updated to reflect the committed changes.