]> Git Repo - linux.git/commit - fs/btrfs/ctree.c
Btrfs: resolve tree mod log locking issue in btrfs_next_leaf
authorJan Schmidt <[email protected]>
Fri, 22 Jun 2012 12:51:15 +0000 (14:51 +0200)
committerJan Schmidt <[email protected]>
Wed, 27 Jun 2012 14:34:40 +0000 (16:34 +0200)
commitd42244a0d36ad0939c5f173ebf15841a0678899c
tree3bd49c2f50a0786230f882756c8ee683c73ed9e0
parent19956c7e94a7a58d6df8c4db5ae62f9109a7c663
Btrfs: resolve tree mod log locking issue in btrfs_next_leaf

With the tree mod log, we may end up with two roots (the current root and a
rewinded version of it) both pointing to two leaves, l1 and l2, of which l2
had already been cow-ed in the current transaction. If we don't rewind any
tree blocks, we cannot have two roots both pointing to an already cowed tree
block.

Now there is btrfs_next_leaf, which has a leaf locked and wants a lock on
the next (right) leaf. And there is push_leaf_left, which has a (cowed!)
leaf locked and wants a lock on the previous (left) leaf.

In order to solve this dead lock situation, we use try_lock in
btrfs_next_leaf (only in case it's called with a tree mod log time_seq
paramter) and if we fail to get a lock on the next leaf, we give up our lock
on the current leaf and retry from the very beginning.

Signed-off-by: Jan Schmidt <[email protected]>
fs/btrfs/ctree.c
This page took 0.042682 seconds and 4 git commands to generate.