Re: [PATCH] btrfs: drop lockdep assert in close_fs_devices()
From: Anand Jain <hidden>
Date: 2021-09-23 04:04:58
Ignore this patch. The patch 1/7 in this series is not yet integrated. It will fix the issue. [PATCH v2 1/7] btrfs: do not call close_fs_devices in btrfs_rm_device Thanks, Anand On 23/09/2021 11:58, Anand Jain wrote:
quoted hunk ↗ jump to hunk
btrfs/225, btrfs/164 reports warning due to a lockdep assertion failure: [ 5343.002752] ------------[ cut here ]------------ [ 5343.002756] WARNING: CPU: 3 PID: 797246 at fs/btrfs/volumes.c:1165 close_fs_devices+0x200/0x220 [btrfs] [ 5343.002933] Call Trace: [ 5343.002938] btrfs_rm_device.cold+0x147/0x1c0 [btrfs] [ 5343.002981] btrfs_ioctl+0x2dc2/0x3460 [btrfs] [ 5343.003021] ? __do_sys_newstat+0x48/0x70 [ 5343.003028] ? lock_is_held_type+0xe8/0x140 [ 5343.003034] ? __x64_sys_ioctl+0x83/0xb0 [ 5343.003037] __x64_sys_ioctl+0x83/0xb0 [ 5343.003042] do_syscall_64+0x3b/0xc0 [ 5343.003045] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 5343.003048] RIP: 0033:0x7fe125a17d87 The patch [1] removed uuid_mutex in btrfs_rm_device(). So now there is no uuid_mutex in the call chain leading to close_fs_devices() that has lockdep_assert_held(uuid_mutex). [1] [PATCH v2 2/7] btrfs: do not take the uuid_mutex in btrfs_rm_device The lockdep_assert_held(uuid_mutex) in close_fs_devices() was added by the commit 425c6ed6486f (btrfs: do not hold device_list_mutex when closing devices) as it found that device_list_mutex in close_fs_devices() was redundant. In the current code the lockdep_assert_held(uuid_mutex) in close_fs_devices() in incorrect, remove it. Signed-off-by: Anand Jain <redacted> --- David, Pls feel free to either roll this into the patch "[PATCH v2 2/7] btrfs: do not take the uuid_mutex in btrfs_rm_device" or merge it as an independent patch. fs/btrfs/volumes.c | 2 -- 1 file changed, 2 deletions(-)diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9fea27b9f9be..ac4a9f349932 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c@@ -1162,8 +1162,6 @@ static void close_fs_devices(struct btrfs_fs_devices *fs_devices) { struct btrfs_device *device, *tmp; - lockdep_assert_held(&uuid_mutex); - if (--fs_devices->opened > 0) return;