idr: make idr_remove_all() do removal -before- free_layer()
[sfrench/cifs-2.6.git] / lib / idr.c
index c11c5765cdefd2b5115e4f37e94905ab7364adad..dab4bca86f5d1981027c0be5104a69ce7d05fbe9 100644 (file)
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -449,6 +449,7 @@ void idr_remove_all(struct idr *idp)
 
        n = idp->layers * IDR_BITS;
        p = idp->top;
+       rcu_assign_pointer(idp->top, NULL);
        max = 1 << n;
 
        id = 0;
@@ -467,7 +468,6 @@ void idr_remove_all(struct idr *idp)
                        p = *--paa;
                }
        }
-       rcu_assign_pointer(idp->top, NULL);
        idp->layers = 0;
 }
 EXPORT_SYMBOL(idr_remove_all);