Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wm devices don't work under current amd64



In article <m2o9z1mo9r.fsf%thuvia.hamartun.priv.no@localhost>,
Tom Ivar Helbekkmo  <tih%hamartun.priv.no@localhost> wrote:
>Tom Ivar Helbekkmo <tih%hamartun.priv.no@localhost> writes:
>
>> Masanobu SAITOH <msaitoh%execsw.org@localhost> writes:
>>
>>>  Please test the latest -current. knakahara found a problem:
>>
>> That worked fine!  No longer any need for the tcpdump hack.  :)
>>
>> (I didn't get the latest -current; I just added those patches to 7.99.39.)
>
>Correction: it works *almost* fine.  Turns out that those patches alone
>let my main amd64 system boot without the tcpdump hack, and work well
>as, among other things, an NFS server.  However, another amd64 system
>that doesn't use VLANs, and is an NFS client, is unable to write to NFS
>file systems if it runs a kernel with the patch applied.
>
>Patch on NFS server, not on client: no problem.
>Patch on NFS server and client: writing to NFS hangs.
>Patch on NFS client, not on server: writing to NFS hangs.
>
>I guess the patch depends on other changes after 7.99.39...
>
>Just to be sure we agree what we're discussing, this is the patch:

Perhaps we want a lock?

Index: if_vlan.c
===================================================================
RCS file: /cvsroot/src/sys/net/if_vlan.c,v
retrieving revision 1.94
diff -u -u -r1.94 if_vlan.c
--- if_vlan.c	13 Jan 2017 06:11:56 -0000	1.94
+++ if_vlan.c	20 Jan 2017 22:05:49 -0000
@@ -313,10 +313,11 @@
 		ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
 		ifv->ifv_mintu = ETHERMIN;
 
-		if (ec->ec_nvlans++ == 0) {
+		mutex_enter(ec->ec_lock);
+		if (ec->ec_nvlans == 0) {
 			if ((error = ether_enable_vlan_mtu(p)) >= 0) {
 				if (error) {
-					ec->ec_nvlans--;
+					mutex_exit(ec->ec_lock);
 					return error;
 				}
 				ifv->ifv_mtufudge = 0;
@@ -348,6 +349,8 @@
 			     IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_TCPv6_Rx|
 			     IFCAP_CSUM_UDPv6_Tx|IFCAP_CSUM_UDPv6_Rx);
                 }
+		ec->ec_nvlans++;
+		mutex_exit(ec->ec_lock);
 		/*
 		 * We inherit the parent's Ethernet address.
 		 */
@@ -403,8 +406,10 @@
 	case IFT_ETHER:
 	    {
 		struct ethercom *ec = (void *)p;
+		mutex_enter(ec->ec_lock);
 		if (--ec->ec_nvlans == 0)
 			(void)ether_disable_vlan_mtu(p);
+		mutex_exit(ec->ec_lock);
 
 		ether_ifdetach(ifp);
 		/* Restore vlan_ioctl overwritten by ether_ifdetach */



Home | Main Index | Thread Index | Old Index