HomeFreeBSD

Fix kernel panic due to tsd_exit in ZFS_EXIT(zsb)

Description

Fix kernel panic due to tsd_exit in ZFS_EXIT(zsb)

The following panic would occur under certain heavy load:
[ 4692.202686] Kernel panic - not syncing: thread ffff8800c4f5dd60 terminating with rrw lock ffff8800da1b9c40 held
[ 4692.228053] CPU: 1 PID: 6250 Comm: mmap_deadlock Tainted: P OE 3.18.10 #7

The culprit is that ZFS_EXIT(zsb) would call tsd_exit() every time, which
would purge all tsd data for the thread. However, ZFS_ENTER is designed to be
reentrant, so we cannot allow ZFS_EXIT to blindly purge tsd data.

Instead, we rely on the new behavior of tsd_set. When NULL is passed as the
new value to tsd_set, it will automatically remove the tsd entry specified the
the key for the current thread.

rrw_tsd_key and zfs_allow_log_key already calls tsd_set(key, NULL) when
they're done. The zfs_fsyncer_key relied on ZFS_EXIT(zsb) to call tsd_exit() to
do clean up. Now we explicitly call tsd_set(key, NULL) on them.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3247

Details

Provenance
Chunwei Chen <tuxoko@gmail.com>Authored on Apr 1 2015, 6:18 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Apr 24 2015, 9:57 PM
Parents
rG59199d90832a: Support the "version" property on volumes via the zfs_prop_get_int() API
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG07012da668c2: Fix kernel panic due to tsd_exit in ZFS_EXIT(zsb) (authored by Chunwei Chen <tuxoko@gmail.com>).Apr 24 2015, 9:57 PM