]> xenbits.xensource.com Git - freebsd.git/commitdiff
vfs: apply r352437 to the fast path as well
authormjg <mjg@FreeBSD.org>
Tue, 17 Sep 2019 15:53:40 +0000 (15:53 +0000)
committermjg <mjg@FreeBSD.org>
Tue, 17 Sep 2019 15:53:40 +0000 (15:53 +0000)
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

sys/kern/vfs_default.c

index 2fd95fbc8b46cba31d32067039ce950dcaeb1140..8aee8abfbe7e524f40cf02d2d803049a03438a75 100644 (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) {