vfs: apply r352437 to the fast path as well

This one is very hard to run into. If the filesystem is being unmounted or
the mount point is freed the vfs_op_thread_enter will fail. For it to
succeed the mount point itself would have to be reallocated in the time
window between the initial read and the attempt to enter.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2019-09-17 15:53:40 +00:00
parent 8569a95e76
commit d245aa1e72

View File

@ -606,11 +606,13 @@ vop_stdgetwritemount(ap)
return (0);
}
if (vfs_op_thread_enter(mp)) {
if (mp == vp->v_mount)
if (mp == vp->v_mount) {
vfs_mp_count_add_pcpu(mp, ref, 1);
else
vfs_op_thread_exit(mp);
} else {
vfs_op_thread_exit(mp);
mp = NULL;
vfs_op_thread_exit(mp);
}
} else {
MNT_ILOCK(mp);
if (mp == vp->v_mount) {