Support post-3.13 kthread_create() semantics.

Provide spl_kthread_create() as a wrapper to the kernel's kthread_create()
to provide pre-3.13 semantics.  Re-try if the call is interrupted or if it
would have returned -ENOMEM.  Otherwise return NULL.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #339
This commit is contained in:
Tim Chase
2014-03-26 08:29:24 -05:00
committed by Brian Behlendorf
parent e19101e08f
commit 17a527cb0f
6 changed files with 38 additions and 9 deletions
+4 -4
View File
@@ -108,7 +108,7 @@ splat_condvar_test1(struct file *file, void *arg)
ct[i].ct_cvp = &cv;
ct[i].ct_name = SPLAT_CONDVAR_TEST1_NAME;
ct[i].ct_rc = 0;
ct[i].ct_thread = kthread_create(splat_condvar_test12_thread,
ct[i].ct_thread = spl_kthread_create(splat_condvar_test12_thread,
&ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i);
if (!IS_ERR(ct[i].ct_thread)) {
@@ -173,7 +173,7 @@ splat_condvar_test2(struct file *file, void *arg)
ct[i].ct_cvp = &cv;
ct[i].ct_name = SPLAT_CONDVAR_TEST2_NAME;
ct[i].ct_rc = 0;
ct[i].ct_thread = kthread_create(splat_condvar_test12_thread,
ct[i].ct_thread = spl_kthread_create(splat_condvar_test12_thread,
&ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i);
if (!IS_ERR(ct[i].ct_thread)) {
@@ -254,7 +254,7 @@ splat_condvar_test3(struct file *file, void *arg)
ct[i].ct_cvp = &cv;
ct[i].ct_name = SPLAT_CONDVAR_TEST3_NAME;
ct[i].ct_rc = 0;
ct[i].ct_thread = kthread_create(splat_condvar_test34_thread,
ct[i].ct_thread = spl_kthread_create(splat_condvar_test34_thread,
&ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i);
if (!IS_ERR(ct[i].ct_thread)) {
@@ -324,7 +324,7 @@ splat_condvar_test4(struct file *file, void *arg)
ct[i].ct_cvp = &cv;
ct[i].ct_name = SPLAT_CONDVAR_TEST3_NAME;
ct[i].ct_rc = 0;
ct[i].ct_thread = kthread_create(splat_condvar_test34_thread,
ct[i].ct_thread = spl_kthread_create(splat_condvar_test34_thread,
&ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i);
if (!IS_ERR(ct[i].ct_thread)) {
+2 -2
View File
@@ -215,10 +215,10 @@ splat_rwlock_test1(struct file *file, void *arg)
/* The first thread will be the writer */
if (i == 0)
rwt[i].rwt_thread = kthread_create(splat_rwlock_wr_thr,
rwt[i].rwt_thread = spl_kthread_create(splat_rwlock_wr_thr,
&rwt[i], "%s/%d", SPLAT_RWLOCK_TEST_NAME, i);
else
rwt[i].rwt_thread = kthread_create(splat_rwlock_rd_thr,
rwt[i].rwt_thread = spl_kthread_create(splat_rwlock_rd_thr,
&rwt[i], "%s/%d", SPLAT_RWLOCK_TEST_NAME, i);
if (!IS_ERR(rwt[i].rwt_thread)) {