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

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