Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
80df5b8c
Commit
80df5b8c
authored
Jan 20, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup bcachefs: Deadlock cycle detector
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
896f1b31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
fs/bcachefs/btree_locking.c
fs/bcachefs/btree_locking.c
+26
-2
No files found.
fs/bcachefs/btree_locking.c
View file @
80df5b8c
...
...
@@ -99,6 +99,12 @@ static void lock_graph_up(struct lock_graph *g)
closure_put
(
&
g
->
g
[
--
g
->
nr
].
trans
->
ref
);
}
static
noinline
void
lock_graph_pop_all
(
struct
lock_graph
*
g
)
{
while
(
g
->
nr
)
lock_graph_up
(
g
);
}
static
void
lock_graph_down
(
struct
lock_graph
*
g
,
struct
btree_trans
*
trans
)
{
closure_get
(
&
trans
->
ref
);
...
...
@@ -274,8 +280,26 @@ int bch2_check_for_deadlock(struct btree_trans *trans, struct printbuf *cycle)
b
=
&
READ_ONCE
(
path
->
l
[
top
->
level
].
b
)
->
c
;
if
(
unlikely
(
IS_ERR_OR_NULL
(
b
)))
{
BUG_ON
(
!
lock_graph_remove_non_waiters
(
&
g
));
if
(
IS_ERR_OR_NULL
(
b
))
{
/*
* If we get here, it means we raced with the
* other thread updating its btree_path
* structures - which means it can't be blocked
* waiting on a lock:
*/
if
(
!
lock_graph_remove_non_waiters
(
&
g
))
{
/*
* If lock_graph_remove_non_waiters()
* didn't do anything, it must be
* because we're being called by debugfs
* checking for lock cycles, which
* invokes us on btree_transactions that
* aren't actually waiting on anything.
* Just bail out:
*/
lock_graph_pop_all
(
&
g
);
}
goto
next
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment