Skip to content

Commit 8bee181

Browse files
Allow lua rcu to be used when a RCU read lock is held
1 parent 07c0687 commit 8bee181

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

rcu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ static int rcu_delete_element(struct element *e, int idx) {
160160
printk("deleted key %s on bucket %d", e->key, idx);
161161

162162
spin_unlock(&bucket_lock[idx]);
163-
synchronize_rcu();
163+
if (!rcu_read_lock_held())
164+
synchronize_rcu();
164165

165166
if (e->value.type == LUA_TSTRING)
166167
kfree(e->value.s);
@@ -205,7 +206,8 @@ static int rcu_replace_element(lua_State *L, struct element *e,
205206
hlist_replace_rcu(&e->node, &new_e->node);
206207

207208
spin_unlock(&bucket_lock[idx]);
208-
synchronize_rcu();
209+
if (!rcu_read_lock_held())
210+
synchronize_rcu();
209211

210212
if (e->value.type == LUA_TSTRING)
211213
kfree(e->value.s);

0 commit comments

Comments
 (0)