Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 May 2011 09:20:14 GMT
From:      Janne Snabb <snabb@epipe.com>
To:        freebsd-xen@FreeBSD.org
Subject:   Re: kern/154302: better do-something-smart.patch
Message-ID:  <201105220920.p4M9KEfO098221@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/154302; it has been noted by GNATS.

From: Janne Snabb <snabb@epipe.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/154302: better do-something-smart.patch
Date: Sun, 22 May 2011 09:16:19 +0000 (UTC)

 Here is a new patch which is hopefully neat enough to be committed. 
 
 Could someone with a commit bit consider this? Lots of people are
 having trouble beacuse of this bug. It can be argued that the bug
 is in Xen and not in FreeBSD, but in reality we do need a work-around
 in FreeBSD. (Or if not, the panic message should be "something
 smarter". :)
 
 --- do-something-smart.patch begins here ---
 Index: sys/dev/xen/netfront/netfront.c
 ===================================================================
 --- sys/dev/xen/netfront/netfront.c	(revision 222131)
 +++ sys/dev/xen/netfront/netfront.c	(working copy)
 @@ -408,9 +408,27 @@
  
  	error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL,
  	    (void **) &macstr);
 -	if (error)
 -		return (error);
  
 +	if (error) {
 +		/*
 +		 * Try to read the 'mac' node from the backend side in case
 +		 * it does not exist (ENOENT) in the frontend side. This
 +		 * happens with various Xen versions if 'type=ioemu' is set
 +		 * in the vif configuration. See PR 154302 for more details.
 +		 * Otherwise return the error to the caller.
 +		 */
 +		if (error != ENOENT)
 +			return (error);
 +
 +		if (xs_read(XST_NIL, xenbus_get_otherend_path(dev), "mac",
 +		    NULL, (void **) &macstr) != 0)
 +			/*
 +			 * Return the error code of the frontend read (it
 +			 * is always ENOENT at this point).
 +			 */
 +			return (error);
 +	}
 +
  	s = macstr;
  	for (i = 0; i < ETHER_ADDR_LEN; i++) {
  		mac[i] = strtoul(s, &e, 16);
 --- do-something-smart.patch ends here ---
 
 --
 Janne Snabb / EPIPE Communications
 snabb@epipe.com - http://epipe.com/



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