X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Frecov_thread.c;h=adbaf038566f036803d511028a64216eafff2d2e;hb=2e27af9b3bd15f1e9ffaa397375253ebf60c7d8a;hp=188574b3df5332f5d6e37c9340938bbf6b506b70;hpb=6869932b552ac705f411de3362f01bd50c1f6f7d;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/recov_thread.c b/lustre/ptlrpc/recov_thread.c index 188574b..adbaf03 100644 --- a/lustre/ptlrpc/recov_thread.c +++ b/lustre/ptlrpc/recov_thread.c @@ -76,28 +76,52 @@ enum { LLOG_LCM_FL_EXIT = 1 << 1 }; -/** +static void llcd_print(struct llog_canceld_ctxt *llcd, + const char *func, int line) +{ + CDEBUG(D_RPCTRACE, "Llcd (%p) at %s:%d:\n", llcd, func, line); + CDEBUG(D_RPCTRACE, " size: %d\n", llcd->llcd_size); + CDEBUG(D_RPCTRACE, " ctxt: %p\n", llcd->llcd_ctxt); + CDEBUG(D_RPCTRACE, " lcm : %p\n", llcd->llcd_lcm); + CDEBUG(D_RPCTRACE, " cookiebytes : %d\n", llcd->llcd_cookiebytes); +} + +/** * Allocate new llcd from cache, init it and return to caller. * Bumps number of objects allocated. */ -static struct llog_canceld_ctxt *llcd_alloc(void) +static struct llog_canceld_ctxt *llcd_alloc(struct llog_commit_master *lcm) { struct llog_canceld_ctxt *llcd; - int llcd_size; + int size, overhead; - /* - * Payload of lustre_msg V2 is bigger. + LASSERT(lcm != NULL); + + /* + * We want to send one page of cookies with rpc header. This buffer + * will be assigned later to the rpc, this is why we preserve the + * space for rpc header. */ - llcd_size = CFS_PAGE_SIZE - - lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, NULL); - llcd_size += offsetof(struct llog_canceld_ctxt, llcd_cookies); - OBD_SLAB_ALLOC(llcd, llcd_cache, CFS_ALLOC_STD, llcd_size); + size = CFS_PAGE_SIZE - lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, NULL); + overhead = offsetof(struct llog_canceld_ctxt, llcd_cookies); + OBD_SLAB_ALLOC(llcd, llcd_cache, CFS_ALLOC_STD, size + overhead); if (!llcd) return NULL; - llcd->llcd_size = llcd_size; + CFS_INIT_LIST_HEAD(&llcd->llcd_list); llcd->llcd_cookiebytes = 0; + llcd->llcd_size = size; + + spin_lock(&lcm->lcm_lock); + llcd->llcd_lcm = lcm; + atomic_inc(&lcm->lcm_count); + list_add_tail(&llcd->llcd_list, &lcm->lcm_llcds); + spin_unlock(&lcm->lcm_lock); atomic_inc(&llcd_count); + + CDEBUG(D_RPCTRACE, "Alloc llcd %p on lcm %p (%d)\n", + llcd, lcm, atomic_read(&lcm->lcm_count)); + return llcd; } @@ -106,40 +130,53 @@ static struct llog_canceld_ctxt *llcd_alloc(void) */ static void llcd_free(struct llog_canceld_ctxt *llcd) { - OBD_SLAB_FREE(llcd, llcd_cache, llcd->llcd_size); + struct llog_commit_master *lcm = llcd->llcd_lcm; + int size; + + if (lcm) { + if (atomic_read(&lcm->lcm_count) == 0) { + CERROR("Invalid llcd free %p\n", llcd); + llcd_print(llcd, __FUNCTION__, __LINE__); + LBUG(); + } + spin_lock(&lcm->lcm_lock); + LASSERT(!list_empty(&llcd->llcd_list)); + list_del_init(&llcd->llcd_list); + atomic_dec(&lcm->lcm_count); + spin_unlock(&lcm->lcm_lock); + + CDEBUG(D_RPCTRACE, "Free llcd %p on lcm %p (%d)\n", + llcd, lcm, atomic_read(&lcm->lcm_count)); + } + + LASSERT(atomic_read(&llcd_count) > 0); atomic_dec(&llcd_count); -} -/** - * Copy passed @cookies to @llcd. - */ -static void llcd_copy(struct llog_canceld_ctxt *llcd, - struct llog_cookie *cookies) -{ - memcpy((char *)llcd->llcd_cookies + llcd->llcd_cookiebytes, - cookies, sizeof(*cookies)); - llcd->llcd_cookiebytes += sizeof(*cookies); + size = offsetof(struct llog_canceld_ctxt, llcd_cookies) + + llcd->llcd_size; + OBD_SLAB_FREE(llcd, llcd_cache, size); } /** * Checks if passed cookie fits into llcd free space buffer. Returns * 1 if yes and 0 otherwise. */ -static int llcd_fit(struct llog_canceld_ctxt *llcd, - struct llog_cookie *cookies) +static inline int +llcd_fit(struct llog_canceld_ctxt *llcd, struct llog_cookie *cookies) { - return (llcd->llcd_size - - llcd->llcd_cookiebytes) >= sizeof(*cookies); + return (llcd->llcd_size - llcd->llcd_cookiebytes >= sizeof(*cookies)); } -static void llcd_print(struct llog_canceld_ctxt *llcd, - const char *func, int line) +/** + * Copy passed @cookies to @llcd. + */ +static inline void +llcd_copy(struct llog_canceld_ctxt *llcd, struct llog_cookie *cookies) { - CDEBUG(D_RPCTRACE, "Llcd (%p) at %s:%d:\n", llcd, func, line); - CDEBUG(D_RPCTRACE, " size: %d\n", llcd->llcd_size); - CDEBUG(D_RPCTRACE, " ctxt: %p\n", llcd->llcd_ctxt); - CDEBUG(D_RPCTRACE, " lcm : %p\n", llcd->llcd_lcm); - CDEBUG(D_RPCTRACE, " cookiebytes : %d\n", llcd->llcd_cookiebytes); + LASSERT(llcd_fit(llcd, cookies)); + memcpy((char *)llcd->llcd_cookies + llcd->llcd_cookiebytes, + cookies, sizeof(*cookies)); + llcd->llcd_cookiebytes += sizeof(*cookies); } /** @@ -147,18 +184,19 @@ static void llcd_print(struct llog_canceld_ctxt *llcd, * sending result. Error is passed in @rc. Note, that this will be called * in cleanup time when all inflight rpcs aborted. */ -static int -llcd_interpret(struct ptlrpc_request *req, void *noused, int rc) +static int +llcd_interpret(const struct lu_env *env, + struct ptlrpc_request *req, void *noused, int rc) { struct llog_canceld_ctxt *llcd = req->rq_async_args.pointer_arg[0]; - CDEBUG(D_RPCTRACE, "Sent llcd %p (%d)\n", llcd, rc); + CDEBUG(D_RPCTRACE, "Sent llcd %p (%d) - killing it\n", llcd, rc); llcd_free(llcd); return 0; } - + /** * Send @llcd to remote node. Free llcd uppon completion or error. Sending - * is performed in async style so this function will return asap without + * is performed in async style so this function will return asap without * blocking. */ static int llcd_send(struct llog_canceld_ctxt *llcd) @@ -173,7 +211,7 @@ static int llcd_send(struct llog_canceld_ctxt *llcd) ctxt = llcd->llcd_ctxt; if (!ctxt) { - CERROR("Invalid llcd with NULL ctxt found (%p)\n", + CERROR("Invalid llcd with NULL ctxt found (%p)\n", llcd); llcd_print(llcd, __FUNCTION__, __LINE__); LBUG(); @@ -184,10 +222,10 @@ static int llcd_send(struct llog_canceld_ctxt *llcd) GOTO(exit, rc = 0); lcm = llcd->llcd_lcm; - - /* + + /* * Check if we're in exit stage. Do not send llcd in - * this case. + * this case. */ if (test_bit(LLOG_LCM_FL_EXIT, &lcm->lcm_flags)) GOTO(exit, rc = -ENODEV); @@ -195,9 +233,9 @@ static int llcd_send(struct llog_canceld_ctxt *llcd) CDEBUG(D_RPCTRACE, "Sending llcd %p\n", llcd); import = llcd->llcd_ctxt->loc_imp; - if (!import || (import == LP_POISON) || + if (!import || (import == LP_POISON) || (import->imp_client == LP_POISON)) { - CERROR("Invalid import %p for llcd %p\n", + CERROR("Invalid import %p for llcd %p\n", import, llcd); GOTO(exit, rc = -ENODEV); } @@ -205,12 +243,12 @@ static int llcd_send(struct llog_canceld_ctxt *llcd) OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_RECOV, 10); /* - * No need to get import here as it is already done in + * No need to get import here as it is already done in * llog_receptor_accept(). */ req = ptlrpc_request_alloc(import, &RQF_LOG_CANCEL); if (req == NULL) { - CERROR("Can't allocate request for sending llcd %p\n", + CERROR("Can't allocate request for sending llcd %p\n", llcd); GOTO(exit, rc = -ENOMEM); } @@ -230,12 +268,18 @@ static int llcd_send(struct llog_canceld_ctxt *llcd) /* bug 5515 */ req->rq_request_portal = LDLM_CANCEL_REQUEST_PORTAL; req->rq_reply_portal = LDLM_CANCEL_REPLY_PORTAL; - req->rq_interpret_reply = llcd_interpret; + req->rq_interpret_reply = (ptlrpc_interpterer_t)llcd_interpret; req->rq_async_args.pointer_arg[0] = llcd; + + /* llog cancels will be replayed after reconnect so this will do twice + * first from replay llog, second for resended rpc */ + req->rq_no_delay = req->rq_no_resend = 1; + rc = ptlrpc_set_add_new_req(&lcm->lcm_pc, req); - if (rc) + if (rc) { + ptlrpc_request_free(req); GOTO(exit, rc); - + } RETURN(0); exit: CDEBUG(D_RPCTRACE, "Refused llcd %p\n", llcd); @@ -250,18 +294,15 @@ exit: static int llcd_attach(struct llog_ctxt *ctxt, struct llog_canceld_ctxt *llcd) { - struct llog_commit_master *lcm; - LASSERT(ctxt != NULL && llcd != NULL); LASSERT_SEM_LOCKED(&ctxt->loc_sem); LASSERT(ctxt->loc_llcd == NULL); - lcm = ctxt->loc_lcm; - atomic_inc(&lcm->lcm_count); - CDEBUG(D_RPCTRACE, "Attach llcd %p to ctxt %p (%d)\n", - llcd, ctxt, atomic_read(&lcm->lcm_count)); llcd->llcd_ctxt = llog_ctxt_get(ctxt); - llcd->llcd_lcm = ctxt->loc_lcm; ctxt->loc_llcd = llcd; + + CDEBUG(D_RPCTRACE, "Attach llcd %p to ctxt %p\n", + llcd, ctxt); + return 0; } @@ -271,7 +312,6 @@ llcd_attach(struct llog_ctxt *ctxt, struct llog_canceld_ctxt *llcd) */ static struct llog_canceld_ctxt *llcd_detach(struct llog_ctxt *ctxt) { - struct llog_commit_master *lcm; struct llog_canceld_ctxt *llcd; LASSERT(ctxt != NULL); @@ -281,18 +321,10 @@ static struct llog_canceld_ctxt *llcd_detach(struct llog_ctxt *ctxt) if (!llcd) return NULL; - lcm = ctxt->loc_lcm; - if (atomic_read(&lcm->lcm_count) == 0) { - CERROR("Invalid detach occured %p:%p\n", ctxt, llcd); - llcd_print(llcd, __FUNCTION__, __LINE__); - LBUG(); - } - atomic_dec(&lcm->lcm_count); - ctxt->loc_llcd = NULL; - - CDEBUG(D_RPCTRACE, "Detach llcd %p from ctxt %p (%d)\n", - llcd, ctxt, atomic_read(&lcm->lcm_count)); + CDEBUG(D_RPCTRACE, "Detach llcd %p from ctxt %p\n", + llcd, ctxt); + ctxt->loc_llcd = NULL; llog_ctxt_put(ctxt); return llcd; } @@ -304,10 +336,10 @@ static struct llog_canceld_ctxt *llcd_detach(struct llog_ctxt *ctxt) static struct llog_canceld_ctxt *llcd_get(struct llog_ctxt *ctxt) { struct llog_canceld_ctxt *llcd; - - llcd = llcd_alloc(); + LASSERT(ctxt); + llcd = llcd_alloc(ctxt->loc_lcm); if (!llcd) { - CERROR("Couldn't alloc an llcd for ctxt %p\n", ctxt); + CERROR("Can't alloc an llcd for ctxt %p\n", ctxt); return NULL; } llcd_attach(ctxt, llcd); @@ -336,7 +368,7 @@ static int llcd_push(struct llog_ctxt *ctxt) int rc; /* - * Make sure that this llcd will not be sent again as we detach + * Make sure that this llcd will not be sent again as we detach * it from ctxt. */ llcd = llcd_detach(ctxt); @@ -345,15 +377,13 @@ static int llcd_push(struct llog_ctxt *ctxt) llcd_print(llcd, __FUNCTION__, __LINE__); LBUG(); } - + rc = llcd_send(llcd); if (rc) CERROR("Couldn't send llcd %p (%d)\n", llcd, rc); return rc; } -static atomic_t llog_tcount = ATOMIC_INIT(0); - /** * Start recovery thread which actually deals llcd sending. This * is all ptlrpc standard thread based so there is not much of work @@ -366,13 +396,10 @@ int llog_recov_thread_start(struct llog_commit_master *lcm) rc = ptlrpcd_start(lcm->lcm_name, &lcm->lcm_pc); if (rc) { - CERROR("Error %d while starting recovery thread %s\n", + CERROR("Error %d while starting recovery thread %s\n", rc, lcm->lcm_name); RETURN(rc); } - lcm->lcm_set = lcm->lcm_pc.pc_set; - atomic_inc(&llog_tcount); - RETURN(rc); } EXPORT_SYMBOL(llog_recov_thread_start); @@ -383,25 +410,51 @@ EXPORT_SYMBOL(llog_recov_thread_start); void llog_recov_thread_stop(struct llog_commit_master *lcm, int force) { ENTRY; - - /** - * Let all know that we're stopping. This will also make + + /* + * Let all know that we're stopping. This will also make * llcd_send() refuse any new llcds. */ set_bit(LLOG_LCM_FL_EXIT, &lcm->lcm_flags); - /** + /* * Stop processing thread. No new rpcs will be accepted for * for processing now. */ ptlrpcd_stop(&lcm->lcm_pc, force); - + /* - * No llcds on this @lcm should left. + * By this point no alive inflight llcds should be left. Only + * those forgotten in sync may still be attached to ctxt. Let's + * print them. */ - LASSERTF(atomic_read(&lcm->lcm_count) == 0, - "Busy llcds found on lcm %p - (%d)\n", - lcm, atomic_read(&lcm->lcm_count)); + if (atomic_read(&lcm->lcm_count) != 0) { + struct llog_canceld_ctxt *llcd; + struct list_head *tmp; + + CERROR("Busy llcds found (%d) on lcm %p\n", + atomic_read(&lcm->lcm_count) == 0, lcm); + + spin_lock(&lcm->lcm_lock); + list_for_each(tmp, &lcm->lcm_llcds) { + llcd = list_entry(tmp, struct llog_canceld_ctxt, + llcd_list); + llcd_print(llcd, __FUNCTION__, __LINE__); + } + spin_unlock(&lcm->lcm_lock); + + /* + * No point to go further with busy llcds at this point + * as this is clear bug. It might mean we got hanging + * rpc which holds import ref and this means we will not + * be able to cleanup anyways. + * + * Or we just missed to kill them when they were not + * attached to ctxt. In this case our slab will remind + * us about this a bit later. + */ + LBUG(); + } EXIT; } EXPORT_SYMBOL(llog_recov_thread_stop); @@ -420,14 +473,15 @@ struct llog_commit_master *llog_recov_thread_init(char *name) RETURN(NULL); /* - * Try to create threads with unique names and user id. + * Try to create threads with unique names. */ - snprintf(lcm->lcm_name, sizeof(lcm->lcm_name), - "ll_log_commit_%s_%02d", name, - atomic_read(&llog_tcount)); + snprintf(lcm->lcm_name, sizeof(lcm->lcm_name), + "lcm_%s", name); - strncpy(lcm->lcm_name, name, sizeof(lcm->lcm_name)); atomic_set(&lcm->lcm_count, 0); + atomic_set(&lcm->lcm_refcount, 1); + spin_lock_init(&lcm->lcm_lock); + CFS_INIT_LIST_HEAD(&lcm->lcm_llcds); rc = llog_recov_thread_start(lcm); if (rc) { CERROR("Can't start commit thread, rc %d\n", rc); @@ -447,13 +501,13 @@ void llog_recov_thread_fini(struct llog_commit_master *lcm, int force) { ENTRY; llog_recov_thread_stop(lcm, force); - OBD_FREE_PTR(lcm); + lcm_put(lcm); EXIT; } EXPORT_SYMBOL(llog_recov_thread_fini); -static int llog_obd_repl_generic(struct llog_ctxt *ctxt, - void *handle, void *arg) +static int llog_recov_thread_replay(struct llog_ctxt *ctxt, + void *cb, void *arg) { struct obd_device *obd = ctxt->loc_obd; struct llog_process_cat_args *lpca; @@ -470,7 +524,7 @@ static int llog_obd_repl_generic(struct llog_ctxt *ctxt, if (!lpca) RETURN(-ENOMEM); - lpca->lpca_cb = handle; + lpca->lpca_cb = cb; lpca->lpca_arg = arg; /* @@ -481,7 +535,7 @@ static int llog_obd_repl_generic(struct llog_ctxt *ctxt, OBD_FREE_PTR(lpca); RETURN(-ENODEV); } - rc = cfs_kernel_thread(llog_cat_process_thread, lpca, + rc = cfs_kernel_thread(llog_cat_process_thread, lpca, CLONE_VM | CLONE_FILES); if (rc < 0) { CERROR("Error starting llog_cat_process_thread(): %d\n", rc); @@ -495,45 +549,32 @@ static int llog_obd_repl_generic(struct llog_ctxt *ctxt, RETURN(rc); } -int llog_obd_repl_connect(struct llog_ctxt *ctxt, int count, +int llog_obd_repl_connect(struct llog_ctxt *ctxt, struct llog_logid *logid, struct llog_gen *gen, struct obd_uuid *uuid) { - struct llog_canceld_ctxt *llcd; int rc; ENTRY; - mutex_down(&ctxt->loc_sem); - - /* - * Send back cached llcd before recovery from llog if we have any. + /* + * Send back cached llcd from llog before recovery if we have any. + * This is void is nothing cached is found there. */ - if (ctxt->loc_llcd) { - CWARN("Llcd %p:%p is not empty\n", ctxt->loc_llcd, ctxt); - mutex_up(&ctxt->loc_sem); - llog_sync(ctxt, NULL); - mutex_down(&ctxt->loc_sem); - } - - llcd = llcd_get(ctxt); - if (!llcd) { - mutex_up(&ctxt->loc_sem); - RETURN(-ENOMEM); - } + llog_sync(ctxt, NULL); + /* + * Start recovery in separate thread. + */ + mutex_down(&ctxt->loc_sem); ctxt->loc_gen = *gen; - - rc = llog_obd_repl_generic(ctxt, ctxt->llog_proc_cb, logid); - if (rc != 0) { - llcd_put(ctxt); - CERROR("Error recovery process: %d\n", rc); - } + rc = llog_recov_thread_replay(ctxt, ctxt->llog_proc_cb, logid); mutex_up(&ctxt->loc_sem); + RETURN(rc); } EXPORT_SYMBOL(llog_obd_repl_connect); -/** +/** * Deleted objects have a commit callback that cancels the MDS * log record for the deletion. The commit callback calls this * function. @@ -542,6 +583,7 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm, int count, struct llog_cookie *cookies, int flags) { + struct llog_commit_master *lcm; struct llog_canceld_ctxt *llcd; int rc = 0; ENTRY; @@ -549,7 +591,13 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, LASSERT(ctxt != NULL); mutex_down(&ctxt->loc_sem); - + if (!ctxt->loc_lcm) { + CDEBUG(D_RPCTRACE, "No lcm for ctxt %p\n", ctxt); + GOTO(out, rc = -ENODEV); + } + lcm = ctxt->loc_lcm; + CDEBUG(D_INFO, "cancel on lsm %p\n", lcm); + /* * Let's check if we have all structures alive. We also check for * possible shutdown. Do nothing if we're stopping. @@ -559,13 +607,8 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, GOTO(out, rc = -ENODEV); } - if (ctxt->loc_obd->obd_stopping) { - CDEBUG(D_RPCTRACE, "Obd is stopping for ctxt %p\n", ctxt); - GOTO(out, rc = -ENODEV); - } - - if (test_bit(LLOG_LCM_FL_EXIT, &ctxt->loc_lcm->lcm_flags)) { - CDEBUG(D_RPCTRACE, "Commit thread is stopping for ctxt %p\n", + if (test_bit(LLOG_LCM_FL_EXIT, &lcm->lcm_flags)) { + CDEBUG(D_RPCTRACE, "Commit thread is stopping for ctxt %p\n", ctxt); GOTO(out, rc = -ENODEV); } @@ -574,17 +617,23 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, if (count > 0 && cookies != NULL) { /* - * Get new llcd from ctxt if required. + * Get new llcd from ctxt if required. */ if (!llcd) { llcd = llcd_get(ctxt); if (!llcd) GOTO(out, rc = -ENOMEM); + /* + * Allocation is successful, let's check for stop + * flag again to fall back as soon as possible. + */ + if (test_bit(LLOG_LCM_FL_EXIT, &lcm->lcm_flags)) + GOTO(out, rc = -ENODEV); } /* - * Llcd does not have enough room for @cookies. Let's push - * it out and allocate new one. + * Llcd does not have enough room for @cookies. Let's push + * it out and allocate new one. */ if (!llcd_fit(llcd, cookies)) { rc = llcd_push(ctxt); @@ -593,24 +642,35 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, llcd = llcd_get(ctxt); if (!llcd) GOTO(out, rc = -ENOMEM); + /* + * Allocation is successful, let's check for stop + * flag again to fall back as soon as possible. + */ + if (test_bit(LLOG_LCM_FL_EXIT, &lcm->lcm_flags)) + GOTO(out, rc = -ENODEV); } /* - * Copy cookies to @llcd, no matter old or new allocated one. + * Copy cookies to @llcd, no matter old or new allocated + * one. */ llcd_copy(llcd, cookies); } /* - * Let's check if we need to send copied @cookies asap. If yes - do it. + * Let's check if we need to send copied @cookies asap. If yes + * then do it. */ if (llcd && (flags & OBD_LLOG_FL_SENDNOW)) { + CDEBUG(D_RPCTRACE, "Sync llcd %p\n", llcd); rc = llcd_push(ctxt); if (rc) GOTO(out, rc); } EXIT; out: + if (rc) + llcd_put(ctxt); mutex_up(&ctxt->loc_sem); return rc; } @@ -621,16 +681,26 @@ int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp) int rc = 0; ENTRY; + /* + * Flush any remaining llcd. + */ + mutex_down(&ctxt->loc_sem); if (exp && (ctxt->loc_imp == exp->exp_imp_reverse)) { - CDEBUG(D_RPCTRACE, "Reverse import disconnect\n"); /* - * Check for llcd which might be left attached to @ctxt. - * Let's kill it. + * This is ost->mds connection, we can't be sure that mds + * can still receive cookies, let's killed the cached llcd. */ - mutex_down(&ctxt->loc_sem); + CDEBUG(D_RPCTRACE, "Kill cached llcd\n"); llcd_put(ctxt); mutex_up(&ctxt->loc_sem); } else { + /* + * This is either llog_sync() from generic llog code or sync + * on client disconnect. In either way let's do it and send + * llcds to the target with waiting for completion. + */ + CDEBUG(D_RPCTRACE, "Sync cached llcd\n"); + mutex_up(&ctxt->loc_sem); rc = llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW); } RETURN(rc); @@ -654,7 +724,7 @@ int llog_recov_init(void) { int llcd_size; - llcd_size = CFS_PAGE_SIZE - + llcd_size = CFS_PAGE_SIZE - lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, NULL); llcd_size += offsetof(struct llog_canceld_ctxt, llcd_cookies); llcd_cache = cfs_mem_cache_create("llcd_cache", llcd_size, 0, 0); @@ -670,10 +740,8 @@ int llog_recov_init(void) */ void llog_recov_fini(void) { - int count; - /* - * Kill llcd cache when thread is stopped and we're sure no + * Kill llcd cache when thread is stopped and we're sure no * llcd in use left. */ if (llcd_cache) { @@ -681,9 +749,9 @@ void llog_recov_fini(void) * In 2.6.22 cfs_mem_cache_destroy() will not return error * for busy resources. Let's check it another way. */ - count = atomic_read(&llcd_count); - LASSERTF(count == 0, "Can't destroy llcd cache! Number of " - "busy llcds: %d\n", count); + LASSERTF(atomic_read(&llcd_count) == 0, + "Can't destroy llcd cache! Number of " + "busy llcds: %d\n", atomic_read(&llcd_count)); cfs_mem_cache_destroy(llcd_cache); llcd_cache = NULL; }