From c30df9c8630b3b05cfbbf5c1700030f47e5b77c7 Mon Sep 17 00:00:00 2001 From: behlendo Date: Wed, 4 Jun 2008 06:00:46 +0000 Subject: Fixes: 1) Ensure mutex_init() never fails in the case of ENOMEM by retrying forever. I don't think I've ever seen this happen but it was clear after code inspection that if it did we would immediately crash. 2) Enable full debugging in check.sh for sanity tests. Might as well get as much debug as we can in the case of a failure. 3) Reworked list of kmem caches tracked by SPL in to a hash with the key based on the address of the kmem_cache_t. This should speed up the constructor/destructor/shrinker lookup needed now for newer kernel which removed the destructor support. 4) Updated kmem_cache_create to handle the case where CONFIG_SLUB is defined. The slub would occasionally merge slab caches which resulted in non-unique keys for our hash lookup in 3). To fix this we detect if the slub is enabled and then set the needed flag to prevent this merging from ever occuring. 5) New kernels removed the proc_dir_entry pointer from items registered by sysctl. This means we can no long be sneaky and manually insert things in to the sysctl tree simply by walking the proc tree. So I'm forced to create a seperate tree for all the things I can't easily support via sysctl interface. I don't like it but it will do for now. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@124 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c --- include/sys/debug.h | 2 +- include/sys/mutex.h | 7 ++++--- include/sys/proc.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'include/sys') diff --git a/include/sys/debug.h b/include/sys/debug.h index 84278e2e1..7385b357c 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -291,7 +291,7 @@ do { \ if (unlikely(!(cond))) { \ spl_debug_msg(NULL, DEBUG_SUBSYSTEM, D_EMERG, \ __FILE__, __FUNCTION__, __LINE__, \ - "ASSERTION(" #cond ") failed:" fmt, \ + "ASSERTION(" #cond ") failed: " fmt, \ ## a); \ SBUG(); \ } \ diff --git a/include/sys/mutex.h b/include/sys/mutex.h index 7ce807a29..a26b2116a 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -78,7 +78,7 @@ extern struct list_head mutex_stats_list; int spl_mutex_init(void); void spl_mutex_fini(void); -extern void __spl_mutex_init(kmutex_t *mp, char *name, int type, void *ibc); +extern int __spl_mutex_init(kmutex_t *mp, char *name, int type, void *ibc); extern void __spl_mutex_destroy(kmutex_t *mp); extern int __mutex_tryenter(kmutex_t *mp); extern void __mutex_enter(kmutex_t *mp); @@ -91,10 +91,11 @@ extern kthread_t *__spl_mutex_owner(kmutex_t *mp); #define mutex_init(mp, name, type, ibc) \ ({ \ + /* May never fail or all subsequent mutex_* calls will ASSERT */\ if ((name) == NULL) \ - __spl_mutex_init(mp, #mp, type, ibc); \ + while(__spl_mutex_init(mp, #mp, type, ibc)); \ else \ - __spl_mutex_init(mp, name, type, ibc); \ + while(__spl_mutex_init(mp, name, type, ibc)); \ }) #define mutex_destroy(mp) __spl_mutex_destroy(mp) #define mutex_tryenter(mp) __mutex_tryenter(mp) diff --git a/include/sys/proc.h b/include/sys/proc.h index 0316a45fd..c6e4a13cf 100644 --- a/include/sys/proc.h +++ b/include/sys/proc.h @@ -49,7 +49,7 @@ #endif /* CONFIG_SYSCTL */ #ifdef DEBUG_KSTAT -extern struct proc_dir_entry *proc_sys_spl_kstat; +extern struct proc_dir_entry *proc_spl_kstat; struct proc_dir_entry *proc_dir_entry_find(struct proc_dir_entry *root, const char *str); int proc_dir_entries(struct proc_dir_entry *root); -- cgit v1.2.3