freebsd-dev/include/sys
Chunwei Chen 07012da668 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
2015-04-24 14:57:54 -07:00
..
fm Kernel header installation should respect --prefix 2014-10-28 09:37:06 -07:00
fs Kernel header installation should respect --prefix 2014-10-28 09:37:06 -07:00
arc_impl.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
arc.h Handle block pointers with a corrupt logical size 2014-10-23 09:20:52 -07:00
avl_impl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
avl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
blkptr.h Illumos 4757, 4913 2014-08-01 14:28:05 -07:00
bplist.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
bpobj.h Illumos #3104: eliminate empty bpobjs 2013-01-08 10:35:43 -08:00
bptree.h Illumos 4914 - zfs on-disk bookmark structure should be named *_phys_t 2014-08-06 14:48:41 -07:00
dbuf.h Change KM_PUSHPAGE -> KM_SLEEP 2015-01-16 14:41:26 -08:00
ddt.h Add ddt, ddt_entry, and l2arc_hdr caches 2014-01-07 10:33:11 -08:00
dmu_impl.h Illumos 4757, 4913 2014-08-01 14:28:05 -07:00
dmu_objset.h Illumos 3835 zfs need not store 2 copies of all metadata 2014-07-31 09:49:34 -07:00
dmu_send.h Illumos 4757, 4913 2014-08-01 14:28:05 -07:00
dmu_traverse.h Illumos 4914 - zfs on-disk bookmark structure should be named *_phys_t 2014-08-06 14:48:41 -07:00
dmu_tx.h dmu_tx kstat cleanup 2014-03-04 12:22:24 -08:00
dmu_zfetch.h Fix zstream_t incorrect type 2013-12-10 10:09:27 -08:00
dmu.h Illumos 3693 - restore_object uses at least two transactions to restore an object 2014-10-21 15:26:50 -07:00
dnode.h Illumos 5630 - stale bonus buffer in recycled dnode_t leads to data corruption 2015-03-12 15:40:39 -07:00
dsl_bookmark.h Illumos 4368, 4369. 2014-07-29 10:55:29 -07:00
dsl_dataset.h Change KM_PUSHPAGE -> KM_SLEEP 2015-01-16 14:41:26 -08:00
dsl_deadlist.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
dsl_deleg.h Illumos 4368, 4369. 2014-07-29 10:55:29 -07:00
dsl_destroy.h Illumos #3888 2013-11-04 11:18:14 -08:00
dsl_dir.h Change KM_PUSHPAGE -> KM_SLEEP 2015-01-16 14:41:26 -08:00
dsl_pool.h Illumos 4390 - I/O errors can corrupt space map when deleting fs/vol 2014-08-04 11:50:52 -07:00
dsl_prop.h Illumos #3464 2013-09-04 16:01:24 -07:00
dsl_scan.h Illumos 4914 - zfs on-disk bookmark structure should be named *_phys_t 2014-08-06 14:48:41 -07:00
dsl_synctask.h Illumos #3464 2013-09-04 16:01:24 -07:00
dsl_userhold.h Illumos #3740 2013-11-04 11:17:48 -08:00
efi_partition.h Move partition scanning from userspace to module. 2012-07-17 09:17:31 -07:00
Makefile.am Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
metaslab_impl.h Illumos 4976-4984 - metaslab improvements 2014-08-18 08:40:49 -07:00
metaslab.h Illumos 5213 - panic in metaslab_init due to space_map_open returning ENXIO 2014-11-14 15:37:45 -08:00
nvpair_impl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
nvpair.h Replace __va_list with va_list 2014-08-13 10:35:00 -07:00
range_tree.h Illumos #4374 2014-07-30 09:20:35 -07:00
refcount.h Illumos #3464 2013-09-04 16:01:24 -07:00
rrwlock.h Illumos #3464 2013-09-04 16:01:24 -07:00
sa_impl.h Illumos #4045 write throttle & i/o scheduler performance work 2013-12-06 09:32:43 -08:00
sa.h Revert "SA spill block cache" 2015-01-16 14:41:28 -08:00
sdt.h Swap DTRACE_PROBE* with Linux tracepoints 2014-11-17 11:13:55 -08:00
spa_boot.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
spa_impl.h Use cached feature info in spa_add_feature_stats() 2015-03-05 14:11:10 -08:00
spa.h Illumos 5695 - dmu_sync'ed holes do not retain birth time 2015-03-27 14:51:34 -07:00
space_map.h Illumos 5164-5165 - space map fixes 2014-10-23 15:30:32 -07:00
space_reftree.h Illumos #4101, #4102, #4103, #4105, #4106 2014-07-22 09:39:16 -07:00
trace_acl.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_arc.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_dbgmsg.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_dbuf.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_dmu.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_dnode.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_txg.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_zil.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
trace_zrlock.h Add NULL guard in zfs_zrlock_class event class 2015-03-27 14:45:32 -07:00
trace.h Remove duplicate typedefs from trace.h 2015-01-06 16:53:24 -08:00
txg_impl.h Illumos #4045 write throttle & i/o scheduler performance work 2013-12-06 09:32:43 -08:00
txg.h Illumos 4753 - increase number of outstanding async writes when sync task is waiting 2014-09-23 13:50:55 -07:00
u8_textprep_data.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
u8_textprep.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
uberblock_impl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
uberblock.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
uio_impl.h Add basic uio support 2011-02-10 09:21:43 -08:00
unique.h Illumos #3742 2013-11-04 10:55:25 -08:00
uuid.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
vdev_disk.h cstyle: Resolve C style issues 2013-12-18 16:46:35 -08:00
vdev_file.h Use a dedicated taskq for vdev_file 2014-05-14 16:20:21 -07:00
vdev_impl.h Revert "Pre-allocate vdev I/O buffers" 2015-01-16 14:41:28 -08:00
vdev.h Illumos 4370, 4371 2014-07-28 14:29:58 -07:00
xvattr.h Add xvattr support 2011-03-02 11:43:50 -08:00
zap_impl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
zap_leaf.h Illumos #3742 2013-11-04 10:55:25 -08:00
zap.h Illumos 4171, 4172 2014-07-25 16:40:07 -07:00
zfeature.h Illumos 4370, 4371 2014-07-28 14:29:58 -07:00
zfs_acl.h Illumos #3742 2013-11-04 10:55:25 -08:00
zfs_context.h Mark all ZPL and ioctl functions as PF_FSTRANS 2015-04-03 11:38:59 -07:00
zfs_ctldir.h Linux 3.7 compat, schedule_delayed_work() 2012-12-12 10:47:05 -08:00
zfs_debug.h Swap DTRACE_PROBE* with Linux tracepoints 2014-11-17 11:13:55 -08:00
zfs_delay.h cstyle: Resolve C style issues 2013-12-18 16:46:35 -08:00
zfs_dir.h Prototype/structure update for Linux 2011-02-10 09:27:21 -08:00
zfs_fuid.h Prototype/structure update for Linux 2011-02-10 09:27:21 -08:00
zfs_ioctl.h Illumos 4757, 4913 2014-08-01 14:28:05 -07:00
zfs_onexit.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
zfs_rlock.h Illumos #3742 2013-11-04 10:55:25 -08:00
zfs_sa.h cstyle: Resolve C style issues 2013-12-18 16:46:35 -08:00
zfs_stat.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
zfs_vfsops.h Reduce size of zfs_sb_t: allocate z_hold_mtx separately 2015-03-24 13:17:44 -07:00
zfs_vnops.h Add zfs_iput_async() interface 2014-08-11 16:11:43 -07:00
zfs_znode.h Fix kernel panic due to tsd_exit in ZFS_EXIT(zsb) 2015-04-24 14:57:54 -07:00
zil_impl.h cstyle: Resolve C style issues 2013-12-18 16:46:35 -08:00
zil.h Export symbols for ZIL interface 2014-11-14 14:39:43 -08:00
zio_checksum.h Constify structures containing function pointers 2013-03-04 08:49:32 -08:00
zio_compress.h Illumos #3742 2013-11-04 10:55:25 -08:00
zio_impl.h Illumos #3836 2013-11-05 12:14:56 -08:00
zio.h Revert "Pre-allocate vdev I/O buffers" 2015-01-16 14:41:28 -08:00
zpl.h Restructure per-filesystem reclaim 2015-03-20 10:35:20 -07:00
zrlock.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
zvol.h Remove ZFC_IOC_*_MINOR ioctl()s 2013-12-16 09:15:57 -08:00