diff options
author | Patrick Valentin <patrick.valentin@bull.net> | 2016-10-02 22:27:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-16 10:24:22 +0200 |
commit | fbe93b34fa2aab20594ae4333d917c1c6080a004 (patch) | |
tree | 25604a2bdd8ee5f26daf79c032bd56f077920e99 /crypto | |
parent | 91171c3414c6c69b580875ade6c84573f2a52977 (diff) | |
download | op-kernel-dev-fbe93b34fa2aab20594ae4333d917c1c6080a004.zip op-kernel-dev-fbe93b34fa2aab20594ae4333d917c1c6080a004.tar.gz |
staging: lustre: obdclass: Add synchro in lu_context_key_degister()
When unloading a module, it may happen that lu_context_key_degister()
removes a key while a thread is either registering it in a new
context (lu_context_init(), lu_context_refill()), or using it when
exiting from a context (lu_context__exit(), lu_context__fini()).
In these cases, we reference a key which no longer exists, and
the system crashes either because we use a *POISON'ed* pointer
in key_fini() -> key->lct_fini(), or because one of the following
assertions fails:
- lu_context_key_degister():
ASSERTION(cfs_atomic_read(&key->lct_used) == 1)
failed: key has instances: 2
- lu_context_exit():
ASSERTION(key != NULL)
- key_fini():
ASSERTION(atomic_read(&key->lct_used) > 1)
This can also leads to SLAB objects which are not freed:
slab error in kmem_cache_destroy(): cache `echo_thread_kmem':
Can't free all objects
Note: ptlrpc service threads need to call lu_context_init/fini in
each loop (for each RPC), and this could be a big performance issue
on fat SMP machines if we add serialization by a spinlock and need
to lock/unlock it for multiple times for each RPC.
So the aim of this patch, which only impacts some low frequently used
functions, is:
1) to add a synchronization in lu_context_key_quiesce(), also called
by lu_context_key_degister(), to wait until all key::lct_init()
methods have completed, by serializing with keys_fill()
2) to add a synchronization in lu_context_key_degister(), to wait
until all transient contexts referencing this key have run
key::lct_fini() method
Signed-off-by: Patrick Valentin <patrick.valentin@bull.net>
Signed-off-by: Gregoire Pichon <gregoire.pichon@bull.net>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6049
Reviewed-on: http://review.whamcloud.com/13164
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'crypto')
0 files changed, 0 insertions, 0 deletions