]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/netfilter/nft_set_hash.c
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / net / netfilter / nft_set_hash.c
index a3dface3e6e6895e3d778c9378d4579b5723811d..e36069fb76aebd4140098f38a3758135e78b8d43 100644 (file)
@@ -167,6 +167,19 @@ static void nft_hash_activate(const struct net *net, const struct nft_set *set,
        nft_set_elem_clear_busy(&he->ext);
 }
 
+static bool nft_hash_deactivate_one(const struct net *net,
+                                   const struct nft_set *set, void *priv)
+{
+       struct nft_hash_elem *he = priv;
+
+       if (!nft_set_elem_mark_busy(&he->ext) ||
+           !nft_is_active(net, &he->ext)) {
+               nft_set_elem_change_active(net, set, &he->ext);
+               return true;
+       }
+       return false;
+}
+
 static void *nft_hash_deactivate(const struct net *net,
                                 const struct nft_set *set,
                                 const struct nft_set_elem *elem)
@@ -181,13 +194,10 @@ static void *nft_hash_deactivate(const struct net *net,
 
        rcu_read_lock();
        he = rhashtable_lookup_fast(&priv->ht, &arg, nft_hash_params);
-       if (he != NULL) {
-               if (!nft_set_elem_mark_busy(&he->ext) ||
-                   !nft_is_active(net, &he->ext))
-                       nft_set_elem_change_active(net, set, &he->ext);
-               else
-                       he = NULL;
-       }
+       if (he != NULL &&
+           !nft_hash_deactivate_one(net, set, he))
+               he = NULL;
+
        rcu_read_unlock();
 
        return he;
@@ -202,7 +212,7 @@ static void nft_hash_remove(const struct nft_set *set,
        rhashtable_remove_fast(&priv->ht, &he->node, nft_hash_params);
 }
 
-static void nft_hash_walk(const struct nft_ctx *ctx, const struct nft_set *set,
+static void nft_hash_walk(const struct nft_ctx *ctx, struct nft_set *set,
                          struct nft_set_iter *iter)
 {
        struct nft_hash *priv = nft_set_priv(set);
@@ -387,6 +397,7 @@ static struct nft_set_ops nft_hash_ops __read_mostly = {
        .insert         = nft_hash_insert,
        .activate       = nft_hash_activate,
        .deactivate     = nft_hash_deactivate,
+       .deactivate_one = nft_hash_deactivate_one,
        .remove         = nft_hash_remove,
        .lookup         = nft_hash_lookup,
        .update         = nft_hash_update,