Move clear_unrhdr to tmpfs_free_tmp.

Clearing the unr in tmpfs_unmount is not correct. In the case of
multiple references to the tmpfs mount (e.g. when there are lookup
threads using it) it will not be the one to finish tmpfs_free_tmp. In
those cases tmpfs_free_node_locked will be the final one to execute
tmpfs_free_tmp, and until then the unr must be valid.

Reported by:	pho
Approved/reviewed by:	rstone (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12749
This commit is contained in:
Matt Joras 2017-10-23 15:43:38 +00:00
parent 5fca1d90c1
commit ba19246e07
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324921

View File

@ -317,8 +317,6 @@ tmpfs_unmount(struct mount *mp, int mntflags)
TMPFS_NODE_UNLOCK(node);
}
clear_unrhdr(tmp->tm_ino_unr);
mp->mnt_data = NULL;
tmpfs_free_tmp(tmp);
vfs_write_resume(mp, VR_START_WRITE);
@ -344,6 +342,7 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp)
uma_zdestroy(tmp->tm_dirent_pool);
uma_zdestroy(tmp->tm_node_pool);
clear_unrhdr(tmp->tm_ino_unr);
delete_unrhdr(tmp->tm_ino_unr);
mtx_destroy(&tmp->tm_allnode_lock);