If the tree is marked as externally locked, we must not take the
ma_lock. Instead, assert that the external lock is held.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
if (!mt_in_rcu(mt))
return;
- mtree_lock(mt);
- mt->ma_flags &= ~MT_FLAGS_USE_RCU;
- mtree_unlock(mt);
+ if (mt_external_lock(mt)) {
+ BUG_ON(!lock_is_held(mt->ma_external_lock));
+ mt->ma_flags &= ~MT_FLAGS_USE_RCU;
+ } else {
+ mtree_lock(mt);
+ mt->ma_flags &= ~MT_FLAGS_USE_RCU;
+ mtree_unlock(mt);
+ }
}
/**
if (mt_in_rcu(mt))
return;
- mtree_lock(mt);
- mt->ma_flags |= MT_FLAGS_USE_RCU;
- mtree_unlock(mt);
+ if (mt_external_lock(mt)) {
+ BUG_ON(!lock_is_held(mt->ma_external_lock));
+ mt->ma_flags |= MT_FLAGS_USE_RCU;
+ } else {
+ mtree_lock(mt);
+ mt->ma_flags |= MT_FLAGS_USE_RCU;
+ mtree_unlock(mt);
+ }
}
void *mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max);