Blame SOURCES/0029-tests-shell-Improve-concurrent-noflush-restore-test-.patch

87db66
From 674cce10a34e90f2791a3d58789793eef29e8f8b Mon Sep 17 00:00:00 2001
87db66
From: Phil Sutter <phil@nwl.cc>
87db66
Date: Mon, 26 Oct 2020 17:25:03 +0100
87db66
Subject: [PATCH] tests: shell: Improve concurrent noflush restore test a bit
87db66
87db66
The described issue happens only if chain FOO does not exist at program
87db66
start so flush the ruleset after each iteration to make sure this is the
87db66
case. Sadly the bug is still not 100% reproducible on my testing VM.
87db66
87db66
While being at it, add a paragraph describing what exact situation the
87db66
test is trying to provoke.
87db66
87db66
Fixes: dac904bdcd9a1 ("nft: Fix for concurrent noflush restore calls")
87db66
Signed-off-by: Phil Sutter <phil@nwl.cc>
87db66
(cherry picked from commit ed8c8b9316451a4499eeb592d2cf7d782bbe4e9a)
87db66
Signed-off-by: Phil Sutter <psutter@redhat.com>
87db66
---
87db66
 .../ipt-restore/0016-concurrent-restores_0         | 14 ++++++++++++++
87db66
 1 file changed, 14 insertions(+)
87db66
87db66
diff --git a/iptables/tests/shell/testcases/ipt-restore/0016-concurrent-restores_0 b/iptables/tests/shell/testcases/ipt-restore/0016-concurrent-restores_0
87db66
index 53ec12fa368af..aa746ab458a3c 100755
87db66
--- a/iptables/tests/shell/testcases/ipt-restore/0016-concurrent-restores_0
87db66
+++ b/iptables/tests/shell/testcases/ipt-restore/0016-concurrent-restores_0
87db66
@@ -1,5 +1,14 @@
87db66
 #!/bin/bash
87db66
 
87db66
+# test for iptables-restore --noflush skipping an explicitly requested chain
87db66
+# flush because the chain did not exist when cache was fetched. In order to
87db66
+# expect for that chain to appear when refreshing the transaction (due to a
87db66
+# concurrent ruleset change), the chain flush job has to be present in batch
87db66
+# job list (although disabled at first).
87db66
+# The input line requesting chain flush is ':FOO - [0:0]'. RS1 and RS2 contents
87db66
+# are crafted to cause EBUSY when deleting the BAR* chains if FOO is not
87db66
+# flushed in the same transaction.
87db66
+
87db66
 set -e
87db66
 
87db66
 RS="*filter
87db66
@@ -45,7 +54,12 @@ RS2="$RS
87db66
 COMMIT
87db66
 "
87db66
 
87db66
+NORS="*filter
87db66
+COMMIT
87db66
+"
87db66
+
87db66
 for n in $(seq 1 10); do
87db66
+	$XT_MULTI iptables-restore <<< "$NORS"
87db66
 	$XT_MULTI iptables-restore --noflush -w <<< "$RS1" &
87db66
 	$XT_MULTI iptables-restore --noflush -w <<< "$RS2" &
87db66
 	wait -n
87db66
-- 
87db66
2.28.0
87db66