From 25c7da846dfaeb19189134f699710e0f5fdbf10c Mon Sep 17 00:00:00 2001 From: Daniele Di Proietto Date: Tue, 2 Feb 2016 20:55:48 -0800 Subject: [PATCH] cmap: Explain corner case in CMAP_FOR_EACH comment. Commit d916785ce98c("dpif-netdev: Fix improper use of CMAP_FOR_EACH.") fixes a problem that's worth documenting. Requested-by: Jarno Rajahalme Signed-off-by: Daniele Di Proietto Acked-by: Ben Pfaff --- lib/cmap.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cmap.h b/lib/cmap.h index c653424a8..c7c65af26 100644 --- a/lib/cmap.h +++ b/lib/cmap.h @@ -169,6 +169,11 @@ unsigned long cmap_find_batch(const struct cmap *cmap, unsigned long map, * node being deleted may be visited once or not at all. Other nodes * will be visited once.) * + * - If the cmap is changing, it is not safe to quiesce while iterating. + * Even if the changes are done by the same thread that's performing the + * iteration (Corollary: it is not safe to call cmap_remove() and quiesce + * in the loop body). + * * * Example * ======= -- 2.20.1