aboutsummaryrefslogtreecommitdiffstats
path: root/modules/splat
diff options
context:
space:
mode:
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-11-05 21:43:37 +0000
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-11-05 21:43:37 +0000
commit7ea1cbf5b2b5489ce1a5f408d3e101e0e7447205 (patch)
treee187098e4f9e538d00e03cab687296cf65296c43 /modules/splat
parent36833ea4e40833811269d86112043cf1db933009 (diff)
Add proper error handling for the case where a thread can not be
created. Instead of asserting we simply abort the test, wait for any tasks we created to finish, and return -ESRCH back to the user space component. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@175 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'modules/splat')
-rw-r--r--modules/splat/splat-kmem.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/splat/splat-kmem.c b/modules/splat/splat-kmem.c
index 7e95b4af8..a9792b1a5 100644
--- a/modules/splat/splat-kmem.c
+++ b/modules/splat/splat-kmem.c
@@ -582,7 +582,7 @@ splat_kmem_test8_sc(struct file *file, void *arg, int size, int count)
kthread_t *thr;
struct timespec start, stop, delta;
char cache_name[32];
- int i, j, threads = 32;
+ int i, j, rc = 0, threads = 32;
kcp.kcp_magic = SPLAT_KMEM_TEST_MAGIC;
kcp.kcp_file = file;
@@ -611,7 +611,8 @@ splat_kmem_test8_sc(struct file *file, void *arg, int size, int count)
splat_vprint(file, SPLAT_KMEM_TEST8_NAME,
"Unable to create '%s' cache\n",
SPLAT_KMEM_CACHE_NAME);
- return -ENOMEM;
+ rc = -ENOMEM;
+ break;
}
start = current_kernel_time();
@@ -619,7 +620,10 @@ splat_kmem_test8_sc(struct file *file, void *arg, int size, int count)
for (j = 0; j < threads; j++) {
thr = thread_create(NULL, 0, splat_kmem_test8_thread,
&kcp, 0, &p0, TS_RUN, minclsyspri);
- ASSERT(thr != NULL);
+ if (thr == NULL) {
+ rc = -ESRCH;
+ break;
+ }
spin_lock(&kcp.kcp_lock);
kcp.kcp_threads++;
spin_unlock(&kcp.kcp_lock);
@@ -644,11 +648,14 @@ splat_kmem_test8_sc(struct file *file, void *arg, int size, int count)
kmem_cache_destroy(kcp.kcp_cache);
- if (kcp.kcp_rc)
+ if (!rc && kcp.kcp_rc)
+ rc = kcp.kcp_rc;
+
+ if (rc)
break;
}
- return kcp.kcp_rc;
+ return rc;
}
static int