mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 23:20:32 -04:00
Revert "bcachefs: Fix bch2_btree_node_upgrade()"
This reverts commit 62448afee7.
six_lock_tryupgrade fails only if there is an intent lock held,
it won't fail no matter how many read locks are held.
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
committed by
Kent Overstreet
parent
c72deb03ff
commit
9c13cc9c7d
@@ -512,7 +512,6 @@ bool bch2_btree_node_upgrade(struct btree_trans *trans,
|
||||
struct btree_path *path, unsigned level)
|
||||
{
|
||||
struct btree *b = path->l[level].b;
|
||||
struct six_lock_count count = bch2_btree_node_lock_counts(trans, path, &b->c, level);
|
||||
|
||||
if (!is_btree_node(path, level))
|
||||
return false;
|
||||
@@ -536,24 +535,11 @@ bool bch2_btree_node_upgrade(struct btree_trans *trans,
|
||||
if (race_fault())
|
||||
return false;
|
||||
|
||||
if (btree_node_locked(path, level)) {
|
||||
bool ret;
|
||||
if (btree_node_locked(path, level)
|
||||
? six_lock_tryupgrade(&b->c.lock)
|
||||
: six_relock_type(&b->c.lock, SIX_LOCK_intent, path->l[level].lock_seq))
|
||||
goto success;
|
||||
|
||||
six_lock_readers_add(&b->c.lock, -count.n[SIX_LOCK_read]);
|
||||
ret = six_lock_tryupgrade(&b->c.lock);
|
||||
six_lock_readers_add(&b->c.lock, count.n[SIX_LOCK_read]);
|
||||
|
||||
if (ret)
|
||||
goto success;
|
||||
} else {
|
||||
if (six_relock_type(&b->c.lock, SIX_LOCK_intent, path->l[level].lock_seq))
|
||||
goto success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do we already have an intent lock via another path? If so, just bump
|
||||
* lock count:
|
||||
*/
|
||||
if (btree_node_lock_seq_matches(path, b, level) &&
|
||||
btree_node_lock_increment(trans, &b->c, level, BTREE_NODE_INTENT_LOCKED)) {
|
||||
btree_node_unlock(trans, path, level);
|
||||
|
||||
Reference in New Issue
Block a user