Commit 5860beb
btrfs: do not call close_fs_devices in btrfs_rm_device
There's a subtle case where if we're removing the seed device from a
file system we need to free its private copy of the fs_devices. However
we do not need to call close_fs_devices(), because at this point there
are no devices left to close as we've closed the last one. The only
thing that close_fs_devices() does is decrement ->opened, which should
be 1. We want to avoid calling close_fs_devices() here because it has a
lockdep_assert_held(&uuid_mutex), and we are going to stop holding the
uuid_mutex in this path.
So add an assert for the ->opened counter and simply decrement it like
we should, and then clean up like normal. Also add a comment explaining
what we're doing here as I initially removed this code erroneously.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 1923e05 commit 5860beb
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2185 | 2185 | | |
2186 | 2186 | | |
2187 | 2187 | | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
2188 | 2195 | | |
| 2196 | + | |
2189 | 2197 | | |
2190 | | - | |
| 2198 | + | |
2191 | 2199 | | |
2192 | 2200 | | |
2193 | 2201 | | |
| |||
0 commit comments