]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
idr test suite: Create anchor before launching throbber
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 1 Apr 2021 11:46:49 +0000 (07:46 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:53:50 +0000 (09:53 +0200)
BugLink: https://bugs.launchpad.net/bugs/1926993
[ Upstream commit 094ffbd1d8eaa27ed426feb8530cb1456348b018 ]

The throbber could race with creation of the anchor entry and cause the
IDR to have zero entries in it, which would cause the test to fail.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
tools/testing/radix-tree/idr-test.c

index 4a9b451b7ba031b2dab8ec7cd985f3fdb52144eb..6ce7460f3c7a9caf60da686f22693bd2ebba0346 100644 (file)
@@ -301,11 +301,11 @@ void idr_find_test_1(int anchor_id, int throbber_id)
        pthread_t throbber;
        time_t start = time(NULL);
 
-       pthread_create(&throbber, NULL, idr_throbber, &throbber_id);
-
        BUG_ON(idr_alloc(&find_idr, xa_mk_value(anchor_id), anchor_id,
                                anchor_id + 1, GFP_KERNEL) != anchor_id);
 
+       pthread_create(&throbber, NULL, idr_throbber, &throbber_id);
+
        rcu_read_lock();
        do {
                int id = 0;