diff options
-rw-r--r-- | sys/kern/vfs_default.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index bf33115..0232ff3 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -353,10 +353,12 @@ vop_stdgetwritemount(ap) * harmful to return with a ref to our previous mountpoint. */ mp = ap->a_vp->v_mount; - vfs_ref(mp); - if (mp != ap->a_vp->v_mount) { - vfs_rel(mp); - mp = NULL; + if (mp != NULL) { + vfs_ref(mp); + if (mp != ap->a_vp->v_mount) { + vfs_rel(mp); + mp = NULL; + } } *(ap->a_mpp) = mp; return (0); |