Skip to contentSkip to conversation

containers: fixed deadlock in netns/netns_childns.sh

PATCH In review Matus Marhefka 1 participant 2 messages Oct 10, 2014 – Nov 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 containers: fixed deadlock in netns/netns_childns.sh

In certain situations there was a possibility of deadlock in a communication over named pipes (FIFO3, FIFO4) between netns_delchild.sh (executed from netns_parentns.sh) and netns_rename_net.sh (executed from netns_childns.sh).

The deadlock was caused by failing to start sshd or pinging parent namespace in netns_childns.sh. In case one of these situations occured, netns_childns.sh terminated without executing the netns_rename_net.sh and causing the netns_delchild.sh to wait endlessly for data from pipes (FIFO3 and FIFO4).

---
 testcases/kernel/containers/netns/netns_childns.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
testcases/kernel/containers/netns/netns_childns.sh +4 -5
index 9ad9190..f691f48 100755
@@ -71,6 +71,10 @@ else
     status=1
 fi
 
+if [ -f "$childscrpt" ]; then
+    . "$childscrpt"
+fi
+
 if [ $status -eq 0 ] ; then
 
     # checking if parent ns responding
@@ -81,13 +85,8 @@ if [ $status -eq 0 ] ; then
         exit $status
     fi
 
-    if [ -f "$childscrpt" ]; then
-        . "$childscrpt"
-    fi
-
     cleanup $sshpid $vnet1
     debug "INFO: Done with executing child script $0, status is $status"
-
 fi
 
 exit $status
Signature · 13 lines
1.8.3.1


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Please consider this patch as irrelevant.
I will post a better solution for possible deadlocks in network namespaces tests by using timeouts on read/write FIFO operations.

Thanks,
Matus Marhefka

----- Original Message -----
From: "Matus Marhefka" <[email protected]>
To: [email protected]
Sent: Friday, October 10, 2014 4:01:14 PM
Subject: [LTP] [PATCH] containers: fixed deadlock in netns/netns_childns.sh

In certain situations there was a possibility of deadlock in a communication over named pipes (FIFO3, FIFO4) between netns_delchild.sh (executed from netns_parentns.sh) and netns_rename_net.sh (executed from netns_childns.sh).

The deadlock was caused by failing to start sshd or pinging parent namespace in netns_childns.sh. In case one of these situations occured, netns_childns.sh terminated without executing the netns_rename_net.sh and causing the netns_delchild.sh to wait endlessly for data from pipes (FIFO3 and FIFO4).

---
 testcases/kernel/containers/netns/netns_childns.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
testcases/kernel/containers/netns/netns_childns.sh +4 -5
index 9ad9190..f691f48 100755
@@ -71,6 +71,10 @@ else
     status=1
 fi
 
+if [ -f "$childscrpt" ]; then
+    . "$childscrpt"
+fi
+
 if [ $status -eq 0 ] ; then
 
     # checking if parent ns responding
@@ -81,13 +85,8 @@ if [ $status -eq 0 ] ; then
         exit $status
     fi
 
-    if [ -f "$childscrpt" ]; then
-        . "$childscrpt"
-    fi
-
     cleanup $sshpid $vnet1
     debug "INFO: Done with executing child script $0, status is $status"
-
 fi
 
 exit $status
Signature · 24 lines
1.8.3.1


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list