Skip to content

Commit 1f16033

Browse files
asjkdave
authored andcommitted
btrfs: warn for any missed cleanup at btrfs_close_one_device
During my recent search for the root cause of a reported bug, I realized that it's a good idea to issue a warning for missed cleanup instead of using debug-only assertions. Since most installations run with debug off, missed cleanups and premature calls to close could go unnoticed. However, these issues are serious enough to warrant reporting and fixing. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 7533583 commit 1f16033

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

fs/btrfs/volumes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,10 +1150,10 @@ static void btrfs_close_one_device(struct btrfs_device *device)
11501150
device->last_flush_error = 0;
11511151

11521152
/* Verify the device is back in a pristine state */
1153-
ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state));
1154-
ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state));
1155-
ASSERT(list_empty(&device->dev_alloc_list));
1156-
ASSERT(list_empty(&device->post_commit_list));
1153+
WARN_ON(test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state));
1154+
WARN_ON(test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state));
1155+
WARN_ON(!list_empty(&device->dev_alloc_list));
1156+
WARN_ON(!list_empty(&device->post_commit_list));
11571157
}
11581158

11591159
static void close_fs_devices(struct btrfs_fs_devices *fs_devices)

0 commit comments

Comments
 (0)