zfs/module/spl
Richard Yao 251e7a779b Fix race in spl_kmem_cache_reap_now()
The current code contains a race condition that triggers when bit 2 in
spl.spl_kmem_cache_expire is set, spl_kmem_cache_reap_now() is invoked
and another thread is concurrently accessing its magazine.

spl_kmem_cache_reap_now() currently invokes spl_cache_flush() on each
magazine in the same thread when bit 2 in spl.spl_kmem_cache_expire is
set. This is unsafe because there is one magazine per CPU and the
magazines are lockless, so it is impossible to guarentee that another
CPU is not using its magazine when this function is called.

The solution is to only touch the local CPU's magazine and leave other
CPU's magazines to other CPUs.

Reported-by: DHE
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #274
2013-08-08 09:14:41 -07:00
..
Makefile.in Add script for builtin module building. 2012-07-26 15:13:09 -07:00
spl-atomic.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-condvar.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-cred.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-debug.c Linux 3.11 compat: Replace num_physpages with totalram_pages 2013-08-08 09:14:29 -07:00
spl-err.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-generic.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-kmem.c Fix race in spl_kmem_cache_reap_now() 2013-08-08 09:14:41 -07:00
spl-kobj.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-kstat.c Linux 3.10 compat: Do not rely on struct proc_dir_entry definition 2013-07-08 15:25:18 -07:00
spl-mutex.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-proc.c Linux 3.10 compat: Do not rely on struct proc_dir_entry definition 2013-07-08 15:25:18 -07:00
spl-rwlock.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-taskq.c Fix taskq_wait_id() 2013-05-03 14:32:29 -07:00
spl-thread.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-time.c Modify gethrestime to use current_kernel_time() 2013-07-15 09:17:19 -07:00
spl-tsd.c Linux 3.9 compat: Switch to hlist_for_each{,_rcu} 2013-03-14 10:43:34 -07:00
spl-vnode.c Drop support for 3 argument version of set_fs_pwd 2013-03-14 10:43:31 -07:00
spl-xdr.c Refresh links to web site 2013-03-04 19:09:34 -08:00
spl-zlib.c Refresh links to web site 2013-03-04 19:09:34 -08:00