Convert net_namespace to new IDA API
authorMatthew Wilcox <willy@infradead.org>
Sun, 17 Jun 2018 09:37:08 +0000 (05:37 -0400)
committerMatthew Wilcox <willy@infradead.org>
Wed, 22 Aug 2018 03:54:18 +0000 (23:54 -0400)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
net/core/net_namespace.c

index a11e03f920d3a7d9d50a37f699ffd66a26a8a057..f447cebdcea37c6b2e284b210d77dd6a3fed2060 100644 (file)
@@ -973,22 +973,18 @@ static int register_pernet_operations(struct list_head *list,
        int error;
 
        if (ops->id) {
-again:
-               error = ida_get_new_above(&net_generic_ids, MIN_PERNET_OPS_ID, ops->id);
-               if (error < 0) {
-                       if (error == -EAGAIN) {
-                               ida_pre_get(&net_generic_ids, GFP_KERNEL);
-                               goto again;
-                       }
+               error = ida_alloc_min(&net_generic_ids, MIN_PERNET_OPS_ID,
+                               GFP_KERNEL);
+               if (error < 0)
                        return error;
-               }
+               *ops->id = error;
                max_gen_ptrs = max(max_gen_ptrs, *ops->id + 1);
        }
        error = __register_pernet_operations(list, ops);
        if (error) {
                rcu_barrier();
                if (ops->id)
-                       ida_remove(&net_generic_ids, *ops->id);
+                       ida_free(&net_generic_ids, *ops->id);
        }
 
        return error;
@@ -999,7 +995,7 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
        __unregister_pernet_operations(ops);
        rcu_barrier();
        if (ops->id)
-               ida_remove(&net_generic_ids, *ops->id);
+               ida_free(&net_generic_ids, *ops->id);
 }
 
 /**