summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorjdike <[email protected]>2019-08-19 19:04:26 -0400
committerBrian Behlendorf <[email protected]>2019-08-19 16:04:26 -0700
commit3beb0a7694df5d1d4314179147aaa1d40b63fe76 (patch)
tree02551bfeb4b838d31ebc9a98c36bf4edd5281f51 /module
parentff4b68eedc307e6e9b7f3890b809cbb0e9d73856 (diff)
Fix lockdep circular locking false positive involving sa_lock
There are two different deadlock scenarios, but they share a common link, which is thread 1 holding sa_lock and trying to get zap->zap_rwlock: zap_lockdir_impl+0x858/0x16c0 [zfs] zap_lockdir+0xd2/0x100 [zfs] zap_lookup_norm+0x7f/0x100 [zfs] zap_lookup+0x12/0x20 [zfs] sa_setup+0x902/0x1380 [zfs] zfsvfs_init+0x3d6/0xb20 [zfs] zfsvfs_create+0x5dd/0x900 [zfs] zfs_domount+0xa3/0xe20 [zfs] and thread 2 trying to get sa_lock, either in sa_setup: sa_setup+0x742/0x1380 [zfs] zfsvfs_init+0x3d6/0xb20 [zfs] zfsvfs_create+0x5dd/0x900 [zfs] zfs_domount+0xa3/0xe20 [zfs] or in sa_build_index: sa_build_index+0x13d/0x790 [zfs] sa_handle_get_from_db+0x368/0x500 [zfs] zfs_znode_sa_init.isra.0+0x24b/0x330 [zfs] zfs_znode_alloc+0x3da/0x1a40 [zfs] zfs_zget+0x39a/0x6e0 [zfs] zfs_root+0x101/0x160 [zfs] zfs_domount+0x91f/0xea0 [zfs] From there, there are different locking paths back to something holding zap->zap_rwlock. The deadlock scenarios involve multiple different ZFS filesystems being mounted. sa_lock is common to these scenarios, and the sa struct involved is private to a mount. Therefore, these must be referring to different sa_lock instances and these deadlocks can't occur in practice. The fix, from Brian Behlendorf, is to remove sa_lock from lockdep coverage by initializing it with MUTEX_NOLOCKDEP. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Jeff Dike <[email protected]> Closes #9110
Diffstat (limited to 'module')
-rw-r--r--module/zfs/sa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/sa.c b/module/zfs/sa.c
index 4999fef34..f718e7662 100644
--- a/module/zfs/sa.c
+++ b/module/zfs/sa.c
@@ -1014,7 +1014,7 @@ sa_setup(objset_t *os, uint64_t sa_obj, sa_attr_reg_t *reg_attrs, int count,
}
sa = kmem_zalloc(sizeof (sa_os_t), KM_SLEEP);
- mutex_init(&sa->sa_lock, NULL, MUTEX_DEFAULT, NULL);
+ mutex_init(&sa->sa_lock, NULL, MUTEX_NOLOCKDEP, NULL);
sa->sa_master_obj = sa_obj;
os->os_sa = sa;