Fix reference count leak for a case where snapshot's mount point is updated.

Such situation is not supported.

This problem was triggered by something like this:

	# zpool create tank da0
	# zfs snapshot tank@snap
	# cd /tank/.zfs/snapshot/snap  (this will mount the snapshot)
	# cd
	# mount -u nosuid /tank/.zfs/snapshot/snap  (refcount leak)
	# zpool export tank
	cannot export 'tank': pool is busy

MFC after:	1 week
This commit is contained in:
pjd 2009-09-08 08:54:15 +00:00
parent 676cac231c
commit 7faac77b19

View File

@ -336,6 +336,13 @@ zfs_register_callbacks(vfs_t *vfsp)
ASSERT(zfsvfs);
os = zfsvfs->z_os;
/*
* This function can be called for a snapshot when we update snapshot's
* mount point, which isn't really supported.
*/
if (dmu_objset_is_snapshot(os))
return (EOPNOTSUPP);
/*
* The act of registering our callbacks will destroy any mount
* options we may have. In order to enable temporary overrides