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)
Oct 20 2024, 1:15 AM
Unknown Object (File)
Sep 24 2024, 3:11 AM
Unknown Object (File)
Sep 23 2024, 10:38 AM
Unknown Object (File)
Sep 22 2024, 10:12 PM
Unknown Object (File)
Sep 20 2024, 9:43 AM
Unknown Object (File)
Sep 18 2024, 11:25 AM
Unknown Object (File)
Sep 8 2024, 3:52 PM
Unknown Object (File)
Sep 8 2024, 9:12 AM
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.