Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2024 15:14:25 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3bae3e545e2e - stable/14 - ifnet: Restore curvnet earlier
Message-ID:  <202407051514.465FEPE0098987@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=3bae3e545e2ef7ee26a94090fdc6962a127310a4

commit 3bae3e545e2ef7ee26a94090fdc6962a127310a4
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-06-27 04:38:04 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-07-05 15:11:51 +0000

    ifnet: Restore curvnet earlier
    
    This improves readability a little. As a side effect, a redundant
    CURVNET_RESTORE is removed.
    
    No functional change intended.
    
    Reviewed by:    glebius
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45595
    
    (cherry picked from commit ef4f4a44d9134ddadede0e2e6e658d0688c5ab3c)
---
 sys/net/if.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index 7c282277cb59..b38784622e92 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1345,8 +1345,8 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, char *ifname, int jid)
 	/* XXX Lock interfaces to avoid races. */
 	CURVNET_SET_QUIET(pr->pr_vnet);
 	difp = ifunit(ifname);
+	CURVNET_RESTORE();
 	if (difp != NULL) {
-		CURVNET_RESTORE();
 		prison_free(pr);
 		return (EEXIST);
 	}
@@ -1356,16 +1356,13 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, char *ifname, int jid)
 	shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet);
 	if (shutdown) {
 		sx_xunlock(&ifnet_detach_sxlock);
-		CURVNET_RESTORE();
 		prison_free(pr);
 		return (EBUSY);
 	}
-	CURVNET_RESTORE();
 
 	found = if_unlink_ifnet(ifp, true);
 	if (! found) {
 		sx_xunlock(&ifnet_detach_sxlock);
-		CURVNET_RESTORE();
 		prison_free(pr);
 		return (ENODEV);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407051514.465FEPE0098987>