summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2014-10-26 00:11:29 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2014-11-18 08:08:59 +0100
commitab37682708b57c664acdf7b9122773bc71d25bde (patch)
treed8d51bb34824662eb08015173d18794434fdc134 /tests
parent1ad6ec25d566c8e1c8fe2f16d265f8f0cafdc76a (diff)
Fix parallel resizing and listing of the same set
When elements added to a hash:* type of set and resizing triggered, parallel listing could start to list the original set (before resizing) and "continue" with listing the new set. Fix it by references and using the original hash table for listing. Therefore the destroying the original hash table may happen from the resizing or listing functions.
Diffstat (limited to 'tests')
-rw-r--r--tests/hash:ip.t4
-rwxr-xr-xtests/resize-and-list.sh11
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/hash:ip.t b/tests/hash:ip.t
index 2ad6831..a3ab1e2 100644
--- a/tests/hash:ip.t
+++ b/tests/hash:ip.t
@@ -58,6 +58,10 @@
0 ipset -W test resize-test
# IP: Check listing, which requires multiple messages
0 n=`ipset -S test | wc -l` && test $n -eq 8161
+# IP: Flush sets
+0 ipset -F
+# IP: Run resize and listing parallel
+0 ./resize-and-list.sh
# IP: Destroy sets
0 ipset -X
# IP: Create set to add a range
diff --git a/tests/resize-and-list.sh b/tests/resize-and-list.sh
new file mode 100755
index 0000000..209408a
--- /dev/null
+++ b/tests/resize-and-list.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+./resize.sh &
+n=0
+while [ $n -ne 8161 ]; do
+ echo $n
+ n=`ipset -S resize-test | wc -l`
+done
+ipset x
+
+ \ No newline at end of file