Skip to content
Snippets Groups Projects
Commit 03fe49ee authored by Isaac Huang's avatar Isaac Huang
Browse files

- signal timer thread at exit.

-   reset crpc_bulk.bk_pages should happen after brw_check_bulk is done.
parent 96ab88b1
No related branches found
No related tags found
No related merge requests found
......@@ -164,6 +164,7 @@ brw_fill_bulk (srpc_bulk_t *bk, int pattern, __u64 magic)
#ifdef __KERNEL__
pg = bk->bk_iovs[i].kiov_page;
#else
LASSERT (bk->bk_pages != NULL);
pg = bk->bk_pages[i];
#endif
brw_fill_page(pg, pattern, magic);
......@@ -180,6 +181,7 @@ brw_check_bulk (srpc_bulk_t *bk, int pattern, __u64 magic)
#ifdef __KERNEL__
pg = bk->bk_iovs[i].kiov_page;
#else
LASSERT (bk->bk_pages != NULL);
pg = bk->bk_pages[i];
#endif
if (brw_check_page(pg, pattern, magic) != 0) {
......@@ -237,14 +239,10 @@ brw_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
LASSERT (sn != NULL);
#ifndef __KERNEL__
rpc->crpc_bulk.bk_pages = NULL;
#endif
if (rpc->crpc_status != 0) {
CERROR ("BRW RPC to %s failed with %d\n",
libcfs_id2str(rpc->crpc_dest), rpc->crpc_status);
return;
goto out;
}
if (msg->msg_magic != SRPC_MSG_MAGIC) {
......@@ -261,10 +259,10 @@ brw_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
if (reply->brw_status != 0) {
atomic_inc(&sn->sn_brw_errors);
return;
goto out;
}
if (reqst->brw_rw == LST_BRW_WRITE) return;
if (reqst->brw_rw == LST_BRW_WRITE) goto out;
if (brw_check_bulk(&rpc->crpc_bulk, reqst->brw_flags, magic) != 0) {
CERROR ("Bulk data from %s is corrupted!\n",
......@@ -273,6 +271,10 @@ brw_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
atomic_inc(&sn->sn_brw_errors);
}
out:
#ifndef __KERNEL__
rpc->crpc_bulk.bk_pages = NULL;
#endif
return;
}
......
......@@ -36,6 +36,7 @@ struct st_timer_data {
struct list_head stt_hash[STTIMER_NSLOTS];
int stt_shuttingdown;
#ifdef __KERNEL__
cfs_waitq_t stt_waitq;
int stt_nthreads;
#endif
} stt_data;
......@@ -157,9 +158,9 @@ stt_timer_main (void *arg)
while (!stt_data.stt_shuttingdown) {
stt_check_timers(&stt_data.stt_prev_slot);
set_current_state(CFS_TASK_INTERRUPTIBLE);
cfs_schedule_timeout(CFS_TASK_INTERRUPTIBLE,
cfs_time_seconds(STTIMER_SLOTTIME));
wait_event_timeout(stt_data.stt_waitq,
stt_data.stt_shuttingdown,
cfs_time_seconds(STTIMER_SLOTTIME));
}
spin_lock(&stt_data.stt_lock);
......@@ -216,9 +217,10 @@ stt_startup (void)
#ifdef __KERNEL__
stt_data.stt_nthreads = 0;
cfs_waitq_init(&stt_data.stt_waitq);
rc = stt_start_timer_thread();
if (rc != 0)
CERROR ("Can't spawn timer, stt_startup() has failed: %d\n", rc);
CERROR ("Can't spawn timer thread: %d\n", rc);
#endif
return rc;
......@@ -237,6 +239,7 @@ stt_shutdown (void)
stt_data.stt_shuttingdown = 1;
#ifdef __KERNEL__
cfs_waitq_signal(&stt_data.stt_waitq);
lst_wait_until(stt_data.stt_nthreads == 0, stt_data.stt_lock,
"waiting for %d threads to terminate\n",
stt_data.stt_nthreads);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment