git: 026502d9edd8 - main - UFS quotaoff: start write before unbusying

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 29 Jun 2022 09:37:34 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=026502d9edd84c0e18110c4c35d03852a1146c8e

commit 026502d9edd84c0e18110c4c35d03852a1146c8e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-06-27 17:16:29 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-29 09:36:59 +0000

    UFS quotaoff: start write before unbusying
    
    Otherwise the mount point could be unmounted meantime.
    
    Reported and tested by: pho
    Reviewed by:    jah
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D35638
---
 sys/ufs/ufs/ufs_vfsops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 33ef7bc2c3d1..ef0ff43a56cc 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -129,9 +129,9 @@ ufs_quotactl(mp, cmds, id, arg, mp_busy)
 		vfs_ref(mp);
 		KASSERT(*mp_busy,
 		    ("%s called without busied mount", __func__));
+		vn_start_write(NULL, &mp, V_WAIT | V_MNTREF);
 		vfs_unbusy(mp);
 		*mp_busy = false;
-		vn_start_write(NULL, &mp, V_WAIT | V_MNTREF);
 		error = quotaoff(td, mp, type);
 		vn_finished_write(mp);
 		break;