<br><tt><font size=2>libvir-list-bounces@redhat.com wrote on 08/13/2010
03:08:11 PM:<br>
<br>
> [image removed] </font></tt>
<br><tt><font size=2>> <br>
> Re: [libvirt] [PATCH] nwfilter: serialize execution of scripts with
<br>
> ebtables cmds</font></tt>
<br><tt><font size=2>> <br>
> Eric Blake </font></tt>
<br><tt><font size=2>> <br>
> to:</font></tt>
<br><tt><font size=2>> <br>
> Stefan Berger</font></tt>
<br><tt><font size=2>> <br>
> 08/13/2010 03:17 PM</font></tt>
<br><tt><font size=2>> <br>
> Sent by:</font></tt>
<br><tt><font size=2>> <br>
> libvir-list-bounces@redhat.com</font></tt>
<br><tt><font size=2>> <br>
> Cc:</font></tt>
<br><tt><font size=2>> <br>
> libvir-list</font></tt>
<br><tt><font size=2>> <br>
> On 08/13/2010 12:35 PM, Stefan Berger wrote:<br>
> >  While testing the SIGHUP handling and reloading of the
nwfilter driver,<br>
> > I found that when the filters are rebuilt and mutlipe threads
handled<br>
> > the individual interfaces, concurrently running multiple external
bash<br>
> > scripts causes strange failures even though the executed ebtables<br>
> > commands are working on different tables for different interfaces.
I<br>
> > cannot say for sure where the concurrency problems are caused,
but<br>
> > introducing this lock definitely helps.<br>
> > <br>
> > Signed-off-by: Stefan Berger <stefanb@us.ibm.com><br>
> <br>
> ACK.</font></tt>
<br>
<br><tt><font size=2>I'll push this shortly. For the record, here two scripts,
that each execute fine but once run concurrently cause a race.</font></tt>
<br>
<br><tt><font size=2>script 1:</font></tt>
<br>
<br><tt><font size=2>#!/bin/bash</font></tt>
<br><tt><font size=2>dev=xyzdev</font></tt>
<br><tt><font size=2>while test 1; do</font></tt>
<br><tt><font size=2>   ebtables -t nat -A PREROUTING -i ${dev}
-j ACCEPT</font></tt>
<br><tt><font size=2>   if [ $? -ne 0 ]; then</font></tt>
<br><tt><font size=2>       echo "odd!"</font></tt>
<br><tt><font size=2>   fi</font></tt>
<br><tt><font size=2>   ebtables -t nat -D PREROUTING -i ${dev}
-j ACCEPT</font></tt>
<br><tt><font size=2>   if [ $? -ne 0 ]; then</font></tt>
<br><tt><font size=2>       echo "odd!"</font></tt>
<br><tt><font size=2>   fi</font></tt>
<br>
<br><tt><font size=2>script 2:</font></tt>
<br>
<br><tt><font size=2>#!/bin/bash</font></tt>
<br><tt><font size=2>dev=xyzdev2</font></tt>
<br><tt><font size=2>while test 1; do</font></tt>
<br><tt><font size=2>   ebtables -t nat -A PREROUTING -i ${dev}
-j ACCEPT</font></tt>
<br><tt><font size=2>   if [ $? -ne 0 ]; then</font></tt>
<br><tt><font size=2>       echo "odd!"</font></tt>
<br><tt><font size=2>   fi</font></tt>
<br><tt><font size=2>   ebtables -t nat -D PREROUTING -i ${dev}
-j ACCEPT</font></tt>
<br><tt><font size=2>   if [ $? -ne 0 ]; then</font></tt>
<br><tt><font size=2>       echo "odd!"</font></tt>
<br><tt><font size=2>   fi</font></tt>
<br>
<br>
<br><tt><font size=2>Output when run concurrently:</font></tt>
<br>
<br><tt><font size=2>The kernel doesn't support a certain ebtables extension,
consider recompiling your kernel or insmod the extension.</font></tt>
<br><tt><font size=2>odd!</font></tt>
<br><tt><font size=2>The kernel doesn't support a certain ebtables extension,
consider recompiling your kernel or insmod the extension.</font></tt>
<br><tt><font size=2>odd!</font></tt>
<br>
<br>
<br><tt><font size=2>   Stefan</font></tt>
<br>