[libvirt] [PATCH] Check for existence of interface prior to setting terminate flag

https://bugzilla.redhat.com/show_bug.cgi?id=903480 During domain destruction it's possible that the learnIPAddressThread has already removed the interface prior to the teardown filter path being run. The teardown code would only be telling the thread to terminate. --- src/nwfilter/nwfilter_learnipaddr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 2b49333..c56d119 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -251,6 +251,14 @@ virNWFilterTerminateLearnReq(const char *ifname) { int ifindex; virNWFilterIPAddrLearnReqPtr req; + /* It's possible that it's already be removed as a result of + * virNWFilterDeregisterLearnReq during learnIPAddressThread() exit + */ + if (virNetDevExists(ifname) != 1) { + virResetLastError(); + return 0; + } + if (virNetDevGetIndex(ifname, &ifindex) < 0) { virResetLastError(); return rc; -- 1.8.1.4

On 05/31/2013 06:06 AM, John Ferlan wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=903480
During domain destruction it's possible that the learnIPAddressThread has already removed the interface prior to the teardown filter path being run. The teardown code would only be telling the thread to terminate. --- src/nwfilter/nwfilter_learnipaddr.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 2b49333..c56d119 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -251,6 +251,14 @@ virNWFilterTerminateLearnReq(const char *ifname) { int ifindex; virNWFilterIPAddrLearnReqPtr req;
+ /* It's possible that it's already be removed as a result of
s/be/been/
+ * virNWFilterDeregisterLearnReq during learnIPAddressThread() exit + */ + if (virNetDevExists(ifname) != 1) { + virResetLastError(); + return 0; + } +
ACK, and okay for 1.0.6. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/31/2013 09:59 AM, Eric Blake wrote:
On 05/31/2013 06:06 AM, John Ferlan wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=903480
During domain destruction it's possible that the learnIPAddressThread has already removed the interface prior to the teardown filter path being run. The teardown code would only be telling the thread to terminate. --- src/nwfilter/nwfilter_learnipaddr.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 2b49333..c56d119 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -251,6 +251,14 @@ virNWFilterTerminateLearnReq(const char *ifname) { int ifindex; virNWFilterIPAddrLearnReqPtr req;
+ /* It's possible that it's already be removed as a result of
s/be/been/
+ * virNWFilterDeregisterLearnReq during learnIPAddressThread() exit + */ + if (virNetDevExists(ifname) != 1) { + virResetLastError(); + return 0; + } +
ACK, and okay for 1.0.6.
Fixed grammar and pushed Tks, John
participants (2)
-
Eric Blake
-
John Ferlan