mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Add proper error handling to one of the atomic test cases in the event
that a kernel thread cannot be properly spawned. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@168 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
b02e9b2415
commit
55c59e6153
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user