Disable VFS_HOLD placed on mnt_vnodecovered during the mount of a snapshot

and VFS_RELE on a non-existing hold on snapshot parent's z_vfs.

This disables the changes from OpenSolaris onnv-revision 9234:bffdc4fc05c4
(bug IDs: 6792139, 6794830) - not applicable to FreeBSD.

This fixes the process hang if umounting a manually mounted snapshot.

Reported by:	Alexander Zagrebin <alexz@visp.ru>
Approved by:	delphij (mentor)
MFC after:	1 week
This commit is contained in:
Martin Matuska 2010-11-13 21:09:18 +00:00
parent a84e1b3b24
commit 8db47aa15e

View File

@ -1218,12 +1218,14 @@ zfs_mount(vfs_t *vfsp)
error = zfs_domount(vfsp, osname);
PICKUP_GIANT();
#ifdef sun
/*
* Add an extra VFS_HOLD on our parent vfs so that it can't
* disappear due to a forced unmount.
*/
if (error == 0 && ((zfsvfs_t *)vfsp->vfs_data)->z_issnap)
VFS_HOLD(mvp->v_vfsp);
#endif /* sun */
out:
return (error);
@ -1766,12 +1768,14 @@ zfs_freevfs(vfs_t *vfsp)
{
zfsvfs_t *zfsvfs = vfsp->vfs_data;
#ifdef sun
/*
* If this is a snapshot, we have an extra VFS_HOLD on our parent
* from zfs_mount(). Release it here.
*/
if (zfsvfs->z_issnap)
VFS_RELE(zfsvfs->z_parent->z_vfs);
#endif /* sun */
zfsvfs_free(zfsvfs);