]> granicus.if.org Git - spl/commitdiff
Add proper error handling to one of the atomic test cases in the event
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Tue, 4 Nov 2008 22:39:29 +0000 (22:39 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Tue, 4 Nov 2008 22:39:29 +0000 (22:39 +0000)
that a kernel thread cannot be properly spawned.

git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@168 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c

modules/splat/splat-atomic.c

index 05afdb64b2c820236a45a00d1f45f8418b94736a..cc947d095571907391f69d1b53661248d5d5ea52 100644 (file)
@@ -126,9 +126,9 @@ splat_atomic_work(void *priv)
 }
 
 static int
-splat_atomic_test1_cond(atomic_priv_t *ap)
+splat_atomic_test1_cond(atomic_priv_t *ap, int started)
 {
-       return (ap->ap_atomic_exited == SPLAT_ATOMIC_COUNT_64);
+       return (ap->ap_atomic_exited == started);
 }
 
 static int
@@ -137,7 +137,7 @@ splat_atomic_test1(struct file *file, void *arg)
        atomic_priv_t ap;
         DEFINE_WAIT(wait);
        kthread_t *thr;
-       int i;
+       int i, rc = 0;
 
        ap.ap_magic = SPLAT_ATOMIC_TEST_MAGIC;
        ap.ap_file = file;
@@ -153,7 +153,11 @@ splat_atomic_test1(struct file *file, void *arg)
                thr = (kthread_t *)thread_create(NULL, 0, splat_atomic_work,
                                                 &ap, 0, &p0, TS_RUN,
                                                 minclsyspri);
-               ASSERT(thr);
+               if (thr == NULL) {
+                       rc = -ESRCH;
+                       spin_unlock(&ap.ap_lock);
+                       break;
+               }
 
                /* Prepare to wait, the new thread will wake us once it
                 * has made a copy of the unique private passed data */
@@ -162,7 +166,13 @@ splat_atomic_test1(struct file *file, void *arg)
                schedule();
        }
 
-       wait_event_interruptible(ap.ap_waitq, splat_atomic_test1_cond(&ap));
+       wait_event_interruptible(ap.ap_waitq, splat_atomic_test1_cond(&ap, i));
+
+       if (rc) {
+               splat_vprint(file, SPLAT_ATOMIC_TEST1_NAME, "Only started "
+                            "%d/%d test threads\n", i, SPLAT_ATOMIC_COUNT_64);
+               return rc;
+       }
 
        if (ap.ap_atomic != SPLAT_ATOMIC_INIT_VALUE) {
                splat_vprint(file, SPLAT_ATOMIC_TEST1_NAME,