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) ...@@ -164,6 +164,7 @@ brw_fill_bulk (srpc_bulk_t *bk, int pattern, __u64 magic)
#ifdef __KERNEL__ #ifdef __KERNEL__
pg = bk->bk_iovs[i].kiov_page; pg = bk->bk_iovs[i].kiov_page;
#else #else
LASSERT (bk->bk_pages != NULL);
pg = bk->bk_pages[i]; pg = bk->bk_pages[i];
#endif #endif
brw_fill_page(pg, pattern, magic); brw_fill_page(pg, pattern, magic);
...@@ -180,6 +181,7 @@ brw_check_bulk (srpc_bulk_t *bk, int pattern, __u64 magic) ...@@ -180,6 +181,7 @@ brw_check_bulk (srpc_bulk_t *bk, int pattern, __u64 magic)
#ifdef __KERNEL__ #ifdef __KERNEL__
pg = bk->bk_iovs[i].kiov_page; pg = bk->bk_iovs[i].kiov_page;
#else #else
LASSERT (bk->bk_pages != NULL);
pg = bk->bk_pages[i]; pg = bk->bk_pages[i];
#endif #endif
if (brw_check_page(pg, pattern, magic) != 0) { 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) ...@@ -237,14 +239,10 @@ brw_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
LASSERT (sn != NULL); LASSERT (sn != NULL);
#ifndef __KERNEL__
rpc->crpc_bulk.bk_pages = NULL;
#endif
if (rpc->crpc_status != 0) { if (rpc->crpc_status != 0) {
CERROR ("BRW RPC to %s failed with %d\n", CERROR ("BRW RPC to %s failed with %d\n",
libcfs_id2str(rpc->crpc_dest), rpc->crpc_status); libcfs_id2str(rpc->crpc_dest), rpc->crpc_status);
return; goto out;
} }
if (msg->msg_magic != SRPC_MSG_MAGIC) { 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) ...@@ -261,10 +259,10 @@ brw_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
if (reply->brw_status != 0) { if (reply->brw_status != 0) {
atomic_inc(&sn->sn_brw_errors); 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) { if (brw_check_bulk(&rpc->crpc_bulk, reqst->brw_flags, magic) != 0) {
CERROR ("Bulk data from %s is corrupted!\n", 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) ...@@ -273,6 +271,10 @@ brw_client_done_rpc (sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
atomic_inc(&sn->sn_brw_errors); atomic_inc(&sn->sn_brw_errors);
} }
out:
#ifndef __KERNEL__
rpc->crpc_bulk.bk_pages = NULL;
#endif
return; return;
} }
......
...@@ -36,6 +36,7 @@ struct st_timer_data { ...@@ -36,6 +36,7 @@ struct st_timer_data {
struct list_head stt_hash[STTIMER_NSLOTS]; struct list_head stt_hash[STTIMER_NSLOTS];
int stt_shuttingdown; int stt_shuttingdown;
#ifdef __KERNEL__ #ifdef __KERNEL__
cfs_waitq_t stt_waitq;
int stt_nthreads; int stt_nthreads;
#endif #endif
} stt_data; } stt_data;
...@@ -157,9 +158,9 @@ stt_timer_main (void *arg) ...@@ -157,9 +158,9 @@ stt_timer_main (void *arg)
while (!stt_data.stt_shuttingdown) { while (!stt_data.stt_shuttingdown) {
stt_check_timers(&stt_data.stt_prev_slot); stt_check_timers(&stt_data.stt_prev_slot);
set_current_state(CFS_TASK_INTERRUPTIBLE); wait_event_timeout(stt_data.stt_waitq,
cfs_schedule_timeout(CFS_TASK_INTERRUPTIBLE, stt_data.stt_shuttingdown,
cfs_time_seconds(STTIMER_SLOTTIME)); cfs_time_seconds(STTIMER_SLOTTIME));
} }
spin_lock(&stt_data.stt_lock); spin_lock(&stt_data.stt_lock);
...@@ -216,9 +217,10 @@ stt_startup (void) ...@@ -216,9 +217,10 @@ stt_startup (void)
#ifdef __KERNEL__ #ifdef __KERNEL__
stt_data.stt_nthreads = 0; stt_data.stt_nthreads = 0;
cfs_waitq_init(&stt_data.stt_waitq);
rc = stt_start_timer_thread(); rc = stt_start_timer_thread();
if (rc != 0) 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 #endif
return rc; return rc;
...@@ -237,6 +239,7 @@ stt_shutdown (void) ...@@ -237,6 +239,7 @@ stt_shutdown (void)
stt_data.stt_shuttingdown = 1; stt_data.stt_shuttingdown = 1;
#ifdef __KERNEL__ #ifdef __KERNEL__
cfs_waitq_signal(&stt_data.stt_waitq);
lst_wait_until(stt_data.stt_nthreads == 0, stt_data.stt_lock, lst_wait_until(stt_data.stt_nthreads == 0, stt_data.stt_lock,
"waiting for %d threads to terminate\n", "waiting for %d threads to terminate\n",
stt_data.stt_nthreads); 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