Thread (39 messages) 39 messages, 5 authors, 2021-09-28
STALE1729d

[PATCH] btrfs: drop lockdep assert in close_fs_devices()

From: Anand Jain <hidden>
Date: 2021-09-23 03:59:02
Subsystem: btrfs file system, filesystems (vfs and infrastructure), the rest · Maintainers: Chris Mason, David Sterba, Alexander Viro, Christian Brauner, Linus Torvalds

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;
 
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help