diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/ptlrpc')
24 files changed, 311 insertions, 638 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 4146e8b29a6d..38cc931a189c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -267,7 +267,7 @@ static void ptlrpc_at_adj_service(struct ptlrpc_request *req, if (oldse != 0) CDEBUG(D_ADAPTTO, "The RPC service estimate for %s ptl %d " "has changed from %d to %d\n", - req->rq_import->imp_obd->obd_name,req->rq_request_portal, + req->rq_import->imp_obd->obd_name, req->rq_request_portal, oldse, at_get(&at->iat_service_estimate[idx])); } @@ -289,7 +289,7 @@ static void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req, at = &req->rq_import->imp_at; /* Network latency is total time less server processing time */ - nl = max_t(int, now - req->rq_sent - service_time, 0) +1/*st rounding*/; + nl = max_t(int, now - req->rq_sent - service_time, 0) + 1/*st rounding*/; if (service_time > now - req->rq_sent + 3 /* bz16408 */) CWARN("Reported service time %u > total measured time " CFS_DURATION_T"\n", service_time, @@ -313,14 +313,14 @@ static int unpack_reply(struct ptlrpc_request *req) rc = ptlrpc_unpack_rep_msg(req, req->rq_replen); if (rc) { DEBUG_REQ(D_ERROR, req, "unpack_rep failed: %d", rc); - return(-EPROTO); + return -EPROTO; } } rc = lustre_unpack_rep_ptlrpc_body(req, MSG_PTLRPC_BODY_OFF); if (rc) { DEBUG_REQ(D_ERROR, req, "unpack ptlrpc body failed: %d", rc); - return(-EPROTO); + return -EPROTO; } return 0; } @@ -394,7 +394,7 @@ void ptlrpc_request_cache_fini(void) kmem_cache_destroy(request_cache); } -struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags) +struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags) { struct ptlrpc_request *req; @@ -578,7 +578,7 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request, else { rc = sptlrpc_req_get_ctx(request); if (rc) - GOTO(out_free, rc); + goto out_free; } sptlrpc_req_set_flavor(request, opcode); @@ -587,7 +587,7 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request, lengths, bufs); if (rc) { LASSERT(!request->rq_pool); - GOTO(out_ctx, rc); + goto out_ctx; } lustre_msg_add_version(request->rq_reqmsg, version); @@ -721,7 +721,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp, */ static struct ptlrpc_request * ptlrpc_request_alloc_internal(struct obd_import *imp, - struct ptlrpc_request_pool * pool, + struct ptlrpc_request_pool *pool, const struct req_format *format) { struct ptlrpc_request *request; @@ -751,7 +751,7 @@ EXPORT_SYMBOL(ptlrpc_request_alloc); * initialize its buffer structure according to capsule template \a format. */ struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp, - struct ptlrpc_request_pool * pool, + struct ptlrpc_request_pool *pool, const struct req_format *format) { return ptlrpc_request_alloc_internal(imp, pool, format); @@ -1585,7 +1585,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) continue; if (req->rq_phase == RQ_PHASE_INTERPRET) - GOTO(interpret, req->rq_status); + goto interpret; /* * Note that this also will start async reply unlink. @@ -1604,7 +1604,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) if (req->rq_status == 0) req->rq_status = -EIO; ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); - GOTO(interpret, req->rq_status); + goto interpret; } else { continue; } @@ -1617,7 +1617,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) if (req->rq_status == 0) req->rq_status = -EIO; ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); - GOTO(interpret, req->rq_status); + goto interpret; } /* ptlrpc_set_wait->l_wait_event sets lwi_allow_intr @@ -1633,7 +1633,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) req->rq_wait_ctx)) { req->rq_status = -EINTR; ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); - GOTO(interpret, req->rq_status); + goto interpret; } if (req->rq_phase == RQ_PHASE_RPC) { @@ -1662,7 +1662,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); spin_unlock(&imp->imp_lock); - GOTO(interpret, req->rq_status); + goto interpret; } if (ptlrpc_no_resend(req) && !req->rq_wait_ctx) { @@ -1670,7 +1670,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); spin_unlock(&imp->imp_lock); - GOTO(interpret, req->rq_status); + goto interpret; } list_del_init(&req->rq_list); @@ -1780,7 +1780,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) */ if (req->rq_bulk == NULL || req->rq_status < 0) { ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); - GOTO(interpret, req->rq_status); + goto interpret; } ptlrpc_rqphase_move(req, RQ_PHASE_BULK); @@ -2041,8 +2041,6 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set) struct ptlrpc_request *req; int deadline; - SIGNAL_MASK_ASSERT(); /* XXX BUG 1511 */ - list_for_each(tmp, &set->set_requests) { req = list_entry(tmp, struct ptlrpc_request, rq_set_chain); @@ -2132,7 +2130,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) * interrupts are allowed. Wait until all * complete, or an in-flight req times out. */ - lwi = LWI_TIMEOUT(cfs_time_seconds(timeout? timeout : 1), + lwi = LWI_TIMEOUT(cfs_time_seconds(timeout ? timeout : 1), ptlrpc_expired_set, set); rc = l_wait_event(set->set_waitq, ptlrpc_check_set(NULL, set), &lwi); @@ -2186,7 +2184,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) } if (set->set_interpret != NULL) { - int (*interpreter)(struct ptlrpc_request_set *set,void *,int) = + int (*interpreter)(struct ptlrpc_request_set *set, void *, int) = set->set_interpret; rc = interpreter (set, set->set_arg, rc); } else { @@ -2222,7 +2220,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked) } LASSERTF(!request->rq_receiving_reply, "req %p\n", request); - LASSERTF(request->rq_rqbd == NULL, "req %p\n",request);/* client-side */ + LASSERTF(request->rq_rqbd == NULL, "req %p\n", request);/* client-side */ LASSERTF(list_empty(&request->rq_list), "req %p\n", request); LASSERTF(list_empty(&request->rq_set_chain), "req %p\n", request); LASSERTF(list_empty(&request->rq_exp_list), "req %p\n", request); @@ -2491,7 +2489,7 @@ void ptlrpc_free_committed(struct obd_import *imp) } if (req->rq_import_generation < imp->imp_generation) { DEBUG_REQ(D_RPCTRACE, req, "free request with old gen"); - GOTO(free_req, 0); + goto free_req; } /* not yet committed */ @@ -2692,7 +2690,7 @@ struct ptlrpc_replay_async_args { */ static int ptlrpc_replay_interpret(const struct lu_env *env, struct ptlrpc_request *req, - void * data, int rc) + void *data, int rc) { struct ptlrpc_replay_async_args *aa = data; struct obd_import *imp = req->rq_import; @@ -2701,13 +2699,16 @@ static int ptlrpc_replay_interpret(const struct lu_env *env, if (!ptlrpc_client_replied(req)) { CERROR("request replay timed out, restarting recovery\n"); - GOTO(out, rc = -ETIMEDOUT); + rc = -ETIMEDOUT; + goto out; } if (lustre_msg_get_type(req->rq_repmsg) == PTL_RPC_MSG_ERR && (lustre_msg_get_status(req->rq_repmsg) == -ENOTCONN || - lustre_msg_get_status(req->rq_repmsg) == -ENODEV)) - GOTO(out, rc = lustre_msg_get_status(req->rq_repmsg)); + lustre_msg_get_status(req->rq_repmsg) == -ENODEV)) { + rc = lustre_msg_get_status(req->rq_repmsg); + goto out; + } /** VBR: check version failure */ if (lustre_msg_get_status(req->rq_repmsg) == -EOVERFLOW) { @@ -2742,7 +2743,8 @@ static int ptlrpc_replay_interpret(const struct lu_env *env, "Reported transno %llu is bigger than the replayed one: %llu", req->rq_transno, lustre_msg_get_transno(req->rq_reqmsg)); - GOTO(out, rc = -EINVAL); + rc = -EINVAL; + goto out; } DEBUG_REQ(D_HA, req, "got rep"); diff --git a/drivers/staging/lustre/lustre/ptlrpc/connection.c b/drivers/staging/lustre/lustre/ptlrpc/connection.c index adff1ab4f5a4..2a875ab57911 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/connection.c +++ b/drivers/staging/lustre/lustre/ptlrpc/connection.c @@ -41,7 +41,7 @@ #include "ptlrpc_internal.h" -static struct cfs_hash *conn_hash = NULL; +static struct cfs_hash *conn_hash; static cfs_hash_ops_t conn_hash_ops; struct ptlrpc_connection * @@ -52,7 +52,7 @@ ptlrpc_connection_get(lnet_process_id_t peer, lnet_nid_t self, conn = cfs_hash_lookup(conn_hash, &peer); if (conn) - GOTO(out, conn); + goto out; OBD_ALLOC_PTR(conn); if (!conn) @@ -173,7 +173,7 @@ conn_keycmp(const void *key, struct hlist_node *hnode) const lnet_process_id_t *conn_key; LASSERT(key != NULL); - conn_key = (lnet_process_id_t*)key; + conn_key = (lnet_process_id_t *)key; conn = hlist_entry(hnode, struct ptlrpc_connection, c_hash); return conn_key->nid == conn->c_peer.nid && diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index c3ec21d5d29f..32dfffa76a5e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -186,7 +186,8 @@ void client_bulk_callback(lnet_event_t *ev) if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB, CFS_FAIL_ONCE)) ev->status = -EIO; - if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB2,CFS_FAIL_ONCE)) + if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB2, + CFS_FAIL_ONCE)) ev->status = -EIO; CDEBUG((ev->status == 0) ? D_NET : D_ERROR, @@ -481,7 +482,7 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, } } - CDEBUG(D_NET,"%s->%s\n", uuid->uuid, libcfs_id2str(*peer)); + CDEBUG(D_NET, "%s->%s\n", uuid->uuid, libcfs_id2str(*peer)); return rc; } @@ -541,7 +542,7 @@ int ptlrpc_ni_init(void) rc = LNetNIInit(pid); if (rc < 0) { CDEBUG(D_NET, "Can't init network interface: %d\n", rc); - return (-ENOENT); + return -ENOENT; } /* CAVEAT EMPTOR: how we process portals events is _radically_ @@ -557,7 +558,7 @@ int ptlrpc_ni_init(void) CERROR("Failed to allocate event queue: %d\n", rc); LNetNIFini(); - return (-ENOMEM); + return -ENOMEM; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index f522fc5d3a93..2e7e7171ca63 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -93,7 +93,7 @@ do { \ static int ptlrpc_connect_interpret(const struct lu_env *env, struct ptlrpc_request *request, - void * data, int rc); + void *data, int rc); int ptlrpc_import_recovery_state_machine(struct obd_import *imp); /* Only this function is allowed to change the import state when it is @@ -297,7 +297,8 @@ void ptlrpc_invalidate_import(struct obd_import *imp) timeout = 1; } - CDEBUG(D_RPCTRACE,"Sleeping %d sec for inflight to error out\n", + CDEBUG(D_RPCTRACE, + "Sleeping %d sec for inflight to error out\n", timeout); /* Wait for all requests to error out and call completion @@ -668,11 +669,11 @@ int ptlrpc_connect_import(struct obd_import *imp) rc = import_select_connection(imp); if (rc) - GOTO(out, rc); + goto out; rc = sptlrpc_import_sec_adapt(imp, NULL, NULL); if (rc) - GOTO(out, rc); + goto out; /* Reset connect flags to the originally requested flags, in case * the server is updated on-the-fly we will get the new features. */ @@ -685,17 +686,19 @@ int ptlrpc_connect_import(struct obd_import *imp) rc = obd_reconnect(NULL, imp->imp_obd->obd_self_export, obd, &obd->obd_uuid, &imp->imp_connect_data, NULL); if (rc) - GOTO(out, rc); + goto out; request = ptlrpc_request_alloc(imp, &RQF_MDS_CONNECT); - if (request == NULL) - GOTO(out, rc = -ENOMEM); + if (request == NULL) { + rc = -ENOMEM; + goto out; + } rc = ptlrpc_request_bufs_pack(request, LUSTRE_OBD_VERSION, imp->imp_connect_op, bufs, NULL); if (rc) { ptlrpc_request_free(request); - GOTO(out, rc); + goto out; } /* Report the rpc service time to the server so that it knows how long @@ -803,7 +806,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, imp->imp_force_reconnect = ptlrpc_busy_reconnect(rc); spin_unlock(&imp->imp_lock); ptlrpc_maybe_ping_import_soon(imp); - GOTO(out, rc); + goto out; } spin_unlock(&imp->imp_lock); @@ -821,7 +824,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, CERROR("%s: no connect data from server\n", imp->imp_obd->obd_name); rc = -EPROTO; - GOTO(out, rc); + goto out; } spin_lock(&imp->imp_lock); @@ -843,9 +846,10 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) != ocd->ocd_connect_flags) { CERROR("%s: Server didn't granted asked subset of flags: asked=%#llx grranted=%#llx\n", - imp->imp_obd->obd_name,imp->imp_connect_flags_orig, + imp->imp_obd->obd_name, imp->imp_connect_flags_orig, ocd->ocd_connect_flags); - GOTO(out, rc = -EPROTO); + rc = -EPROTO; + goto out; } if (!exp) { @@ -853,7 +857,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, connect attempt */ CERROR("%s: missing export after connect\n", imp->imp_obd->obd_name); - GOTO(out, rc = -ENODEV); + rc = -ENODEV; + goto out; } old_connect_flags = exp_connect_flags(exp); exp->exp_connect_data = *ocd; @@ -892,7 +897,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, ptlrpc_activate_import(imp); } - GOTO(finish, rc = 0); + rc = 0; + goto finish; } /* Determine what recovery state to move the import to. */ @@ -904,7 +910,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, obd2cli_tgt(imp->imp_obd), imp->imp_connection->c_remote_uuid.uuid, imp->imp_dlm_handle.cookie); - GOTO(out, rc = -ENOTCONN); + rc = -ENOTCONN; + goto out; } if (memcmp(&imp->imp_remote_handle, @@ -921,7 +928,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, * participate since we can reestablish all of our state * with server again */ if ((MSG_CONNECT_RECOVERING & msg_flags)) { - CDEBUG(level,"%s@%s changed server handle from %#llx to %#llx but is still in recovery\n", + CDEBUG(level, "%s@%s changed server handle from %#llx to %#llx but is still in recovery\n", obd2cli_tgt(imp->imp_obd), imp->imp_connection->c_remote_uuid.uuid, imp->imp_remote_handle.cookie, @@ -944,7 +951,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, if (!(MSG_CONNECT_RECOVERING & msg_flags)) { IMPORT_SET_STATE(imp, LUSTRE_IMP_EVICTED); - GOTO(finish, rc = 0); + rc = 0; + goto finish; } } else { @@ -1024,10 +1032,18 @@ finish: spin_unlock(&imp->imp_lock); - if (!ocd->ocd_ibits_known && - ocd->ocd_connect_flags & OBD_CONNECT_IBITS) - CERROR("Inodebits aware server returned zero compatible" - " bits?\n"); + if ((imp->imp_connect_flags_orig & OBD_CONNECT_IBITS) && + !(ocd->ocd_connect_flags & OBD_CONNECT_IBITS)) { + LCONSOLE_WARN("%s: MDS %s does not support ibits " + "lock, either very old or invalid: " + "requested %llx, replied %llx\n", + imp->imp_obd->obd_name, + imp->imp_connection->c_remote_uuid.uuid, + imp->imp_connect_flags_orig, + ocd->ocd_connect_flags); + rc = -EPROTO; + goto out; + } if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && (ocd->ocd_version > LUSTRE_VERSION_CODE + @@ -1096,7 +1112,7 @@ finish: * Enforce ADLER for backward compatibility*/ cli->cl_supp_cksum_types = OBD_CKSUM_ADLER; } - cli->cl_cksum_type =cksum_type_select(cli->cl_supp_cksum_types); + cli->cl_cksum_type = cksum_type_select(cli->cl_supp_cksum_types); if (ocd->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) cli->cl_max_pages_per_rpc = @@ -1209,7 +1225,7 @@ out: */ static int completed_replay_interpret(const struct lu_env *env, struct ptlrpc_request *req, - void * data, int rc) + void *data, int rc) { atomic_dec(&req->rq_import->imp_replay_inflight); if (req->rq_status == 0 && @@ -1370,7 +1386,7 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) IMPORT_SET_STATE(imp, LUSTRE_IMP_REPLAY_LOCKS); rc = ldlm_replay_locks(imp); if (rc) - GOTO(out, rc); + goto out; } rc = 0; } @@ -1380,7 +1396,7 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) IMPORT_SET_STATE(imp, LUSTRE_IMP_REPLAY_WAIT); rc = signal_completed_replay(imp); if (rc) - GOTO(out, rc); + goto out; } } @@ -1398,7 +1414,7 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) rc = ptlrpc_resend(imp); if (rc) - GOTO(out, rc); + goto out; IMPORT_SET_STATE(imp, LUSTRE_IMP_FULL); ptlrpc_activate_import(imp); @@ -1425,7 +1441,7 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) int rq_opc, rc = 0; if (imp->imp_obd->obd_force) - GOTO(set_state, rc); + goto set_state; switch (imp->imp_connect_op) { case OST_CONNECT: @@ -1471,7 +1487,7 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) spin_lock(&imp->imp_lock); if (imp->imp_state != LUSTRE_IMP_FULL) - GOTO(out, 0); + goto out; spin_unlock(&imp->imp_lock); req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_DISCONNECT, diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 511cb9cbf0d4..5b8337187b59 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1094,8 +1094,8 @@ struct req_msg_field RMF_EAVALS_LENS = EXPORT_SYMBOL(RMF_EAVALS_LENS); struct req_msg_field RMF_OBD_ID = - DEFINE_MSGF("obd_id", 0, - sizeof(obd_id), lustre_swab_ost_last_id, NULL); + DEFINE_MSGF("u64", 0, + sizeof(u64), lustre_swab_ost_last_id, NULL); EXPORT_SYMBOL(RMF_OBD_ID); struct req_msg_field RMF_FID = diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c index 6a1ab5c98bc6..56f825fbb17c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c @@ -93,8 +93,10 @@ static int llog_client_open(const struct lu_env *env, LASSERT(lgh); req = ptlrpc_request_alloc(imp, &RQF_LLOG_ORIGIN_HANDLE_CREATE); - if (req == NULL) - GOTO(out, rc = -ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto out; + } if (name) req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, @@ -105,7 +107,7 @@ static int llog_client_open(const struct lu_env *env, if (rc) { ptlrpc_request_free(req); req = NULL; - GOTO(out, rc); + goto out; } ptlrpc_request_set_replen(req); @@ -124,11 +126,13 @@ static int llog_client_open(const struct lu_env *env, rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - GOTO(out, rc = -EFAULT); + if (body == NULL) { + rc = -EFAULT; + goto out; + } lgh->lgh_id = body->lgd_logid; lgh->lgh_ctxt = ctxt; @@ -150,8 +154,10 @@ static int llog_client_destroy(const struct lu_env *env, req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_DESTROY, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_DESTROY); - if (req == NULL) - GOTO(err_exit, rc =-ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; @@ -186,8 +192,10 @@ static int llog_client_next_block(const struct lu_env *env, req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_NEXT_BLOCK); - if (req == NULL) - GOTO(err_exit, rc =-ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; @@ -202,16 +210,20 @@ static int llog_client_next_block(const struct lu_env *env, ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - GOTO(out, rc =-EFAULT); + if (body == NULL) { + rc = -EFAULT; + goto out; + } /* The log records are swabbed as they are processed */ ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA); - if (ptr == NULL) - GOTO(out, rc =-EFAULT); + if (ptr == NULL) { + rc = -EFAULT; + goto out; + } *cur_idx = body->lgd_saved_index; *cur_offset = body->lgd_cur_offset; @@ -238,8 +250,10 @@ static int llog_client_prev_block(const struct lu_env *env, req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_PREV_BLOCK); - if (req == NULL) - GOTO(err_exit, rc = -ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; @@ -253,15 +267,19 @@ static int llog_client_prev_block(const struct lu_env *env, rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - GOTO(out, rc =-EFAULT); + if (body == NULL) { + rc = -EFAULT; + goto out; + } ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA); - if (ptr == NULL) - GOTO(out, rc =-EFAULT); + if (ptr == NULL) { + rc = -EFAULT; + goto out; + } memcpy(buf, ptr, len); out: @@ -282,11 +300,13 @@ static int llog_client_read_header(const struct lu_env *env, int rc; LLOG_CLIENT_ENTRY(handle->lgh_ctxt, imp); - req = ptlrpc_request_alloc_pack(imp,&RQF_LLOG_ORIGIN_HANDLE_READ_HEADER, + req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_READ_HEADER); - if (req == NULL) - GOTO(err_exit, rc = -ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = handle->lgh_id; @@ -296,11 +316,13 @@ static int llog_client_read_header(const struct lu_env *env, ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; hdr = req_capsule_server_get(&req->rq_pill, &RMF_LLOG_LOG_HDR); - if (hdr == NULL) - GOTO(out, rc =-EFAULT); + if (hdr == NULL) { + rc = -EFAULT; + goto out; + } memcpy(handle->lgh_hdr, hdr, sizeof(*hdr)); handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index; @@ -331,7 +353,7 @@ static int llog_client_close(const struct lu_env *env, /* this doesn't call LLOG_ORIGIN_HANDLE_CLOSE because the servers all close the file at the end of every other LLOG_ RPC. */ - return(0); + return 0; } struct llog_operations llog_client_ops = { diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_net.c b/drivers/staging/lustre/lustre/ptlrpc/llog_net.c index e9052bba6692..dac66f5b39da 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_net.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_net.c @@ -51,8 +51,6 @@ #include "../include/obd_class.h" #include "../include/lustre_log.h" #include <linux/list.h> -#include "../include/lvfs.h" -#include "../include/lustre_fsfilt.h" int llog_initiator_connect(struct llog_ctxt *ctxt) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index bc220308e7d7..87b9764a4f19 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -119,7 +119,7 @@ struct ll_rpc_opcode { { OBD_IDX_READ, "dt_index_read" }, { LLOG_ORIGIN_HANDLE_CREATE, "llog_origin_handle_open" }, { LLOG_ORIGIN_HANDLE_NEXT_BLOCK, "llog_origin_handle_next_block" }, - { LLOG_ORIGIN_HANDLE_READ_HEADER,"llog_origin_handle_read_header" }, + { LLOG_ORIGIN_HANDLE_READ_HEADER, "llog_origin_handle_read_header" }, { LLOG_ORIGIN_HANDLE_WRITE_REC, "llog_origin_handle_write_rec" }, { LLOG_ORIGIN_HANDLE_CLOSE, "llog_origin_handle_close" }, { LLOG_ORIGIN_CONNECT, "llog_origin_connect" }, @@ -130,7 +130,7 @@ struct ll_rpc_opcode { { QUOTA_DQREL, "quota_release" }, { SEQ_QUERY, "seq_query" }, { SEC_CTX_INIT, "sec_ctx_init" }, - { SEC_CTX_INIT_CONT,"sec_ctx_init_cont" }, + { SEC_CTX_INIT_CONT, "sec_ctx_init_cont" }, { SEC_CTX_FINI, "sec_ctx_fini" }, { FLD_QUERY, "fld_query" }, { UPDATE_OBJ, "update_obj" }, @@ -194,7 +194,8 @@ void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, LASSERT(*procroot_ret == NULL); LASSERT(*stats_ret == NULL); - svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES+LUSTRE_MAX_OPCODES,0); + svc_stats = lprocfs_alloc_stats(EXTRA_MAX_OPCODES+LUSTRE_MAX_OPCODES, + 0); if (svc_stats == NULL) return; @@ -499,8 +500,10 @@ static int ptlrpc_lprocfs_nrs_seq_show(struct seq_file *m, void *n) spin_unlock(&nrs->nrs_lock); OBD_ALLOC(infos, num_pols * sizeof(*infos)); - if (infos == NULL) - GOTO(out, rc = -ENOMEM); + if (infos == NULL) { + rc = -ENOMEM; + goto out; + } again: ptlrpc_service_for_each_part(svcpt, i, svc) { @@ -639,26 +642,34 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file, char *token; int rc = 0; - if (count >= LPROCFS_NRS_WR_MAX_CMD) - GOTO(out, rc = -EINVAL); + if (count >= LPROCFS_NRS_WR_MAX_CMD) { + rc = -EINVAL; + goto out; + } OBD_ALLOC(cmd, LPROCFS_NRS_WR_MAX_CMD); - if (cmd == NULL) - GOTO(out, rc = -ENOMEM); + if (cmd == NULL) { + rc = -ENOMEM; + goto out; + } /** * strsep() modifies its argument, so keep a copy */ cmd_copy = cmd; - if (copy_from_user(cmd, buffer, count)) - GOTO(out, rc = -EFAULT); + if (copy_from_user(cmd, buffer, count)) { + rc = -EFAULT; + goto out; + } cmd[count] = '\0'; token = strsep(&cmd, " "); - if (strlen(token) > NRS_POL_NAME_MAX - 1) - GOTO(out, rc = -EINVAL); + if (strlen(token) > NRS_POL_NAME_MAX - 1) { + rc = -EINVAL; + goto out; + } /** * No [reg|hp] token has been specified @@ -673,13 +684,17 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file, queue = PTLRPC_NRS_QUEUE_REG; else if (strcmp(cmd, "hp") == 0) queue = PTLRPC_NRS_QUEUE_HP; - else - GOTO(out, rc = -EINVAL); + else { + rc = -EINVAL; + goto out; + } default_queue: - if (queue == PTLRPC_NRS_QUEUE_HP && !nrs_svc_has_hp(svc)) - GOTO(out, rc = -ENODEV); + if (queue == PTLRPC_NRS_QUEUE_HP && !nrs_svc_has_hp(svc)) { + rc = -ENODEV; + goto out; + } else if (queue == PTLRPC_NRS_QUEUE_BOTH && !nrs_svc_has_hp(svc)) queue = PTLRPC_NRS_QUEUE_REG; @@ -1257,14 +1272,18 @@ int lprocfs_wr_import(struct file *file, const char *buffer, if (kbuf == NULL) return -ENOMEM; - if (copy_from_user(kbuf, buffer, count)) - GOTO(out, count = -EFAULT); + if (copy_from_user(kbuf, buffer, count)) { + count = -EFAULT; + goto out; + } kbuf[count] = 0; /* only support connection=uuid::instance now */ - if (strncmp(prefix, kbuf, prefix_len) != 0) - GOTO(out, count = -EINVAL); + if (strncmp(prefix, kbuf, prefix_len) != 0) { + count = -EINVAL; + goto out; + } uuid = kbuf + prefix_len; ptr = strstr(uuid, "::"); diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 89fc7f77b498..c1e8aa4d5ec4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -442,8 +442,7 @@ int ptlrpc_reply(struct ptlrpc_request *req) { if (req->rq_no_reply) return 0; - else - return (ptlrpc_send_reply(req, 0)); + return ptlrpc_send_reply(req, 0); } EXPORT_SYMBOL(ptlrpc_reply); @@ -537,13 +536,13 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) rc = sptlrpc_cli_wrap_request(request); if (rc) - GOTO(out, rc); + goto out; /* bulk register should be done after wrap_request() */ if (request->rq_bulk != NULL) { rc = ptlrpc_register_bulk(request); if (rc != 0) - GOTO(out, rc); + goto out; } if (!noreply) { @@ -560,7 +559,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_err = 1; spin_unlock(&request->rq_lock); request->rq_status = rc; - GOTO(cleanup_bulk, rc); + goto cleanup_bulk; } } else { request->rq_repdata = NULL; @@ -573,7 +572,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) if (rc != 0) { CERROR("LNetMEAttach failed: %d\n", rc); LASSERT(rc == -ENOMEM); - GOTO(cleanup_bulk, rc = -ENOMEM); + rc = -ENOMEM; + goto cleanup_bulk; } } @@ -616,7 +616,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) /* ...but the MD attach didn't succeed... */ request->rq_receiving_reply = 0; spin_unlock(&request->rq_lock); - GOTO(cleanup_me, rc = -ENOMEM); + rc = -ENOMEM; + goto cleanup_me; } CDEBUG(D_NET, "Setup reply buffer: %u bytes, xid %llu, portal %u\n", @@ -650,11 +651,11 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_request_portal, request->rq_xid, 0); if (rc == 0) - GOTO(out, rc); + goto out; ptlrpc_req_finished(request); if (noreply) - GOTO(out, rc); + goto out; cleanup_me: /* MEUnlink is safe; the PUT didn't even get off the ground, and @@ -691,7 +692,7 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) service->srv_req_portal); if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_RQBD)) - return (-ENOMEM); + return -ENOMEM; /* NB: CPT affinity service should use new LNet flag LNET_INS_LOCAL, * which means buffer can only be attached on local CPT, and LND @@ -702,7 +703,7 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) LNET_INS_LOCAL : LNET_INS_AFTER, &me_h); if (rc != 0) { CERROR("LNetMEAttach failed: %d\n", rc); - return (-ENOMEM); + return -ENOMEM; } LASSERT(rqbd->rqbd_refcount == 0); @@ -718,7 +719,7 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) rc = LNetMDAttach(me_h, md, LNET_UNLINK, &rqbd->rqbd_md_h); if (rc == 0) - return (0); + return 0; CERROR("LNetMDAttach failed: %d;\n", rc); LASSERT(rc == -ENOMEM); @@ -726,5 +727,5 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) LASSERT(rc == 0); rqbd->rqbd_refcount = 0; - return (-ENOMEM); + return -ENOMEM; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 9ea24f8d9865..181301bd2083 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -264,7 +264,7 @@ static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy) module_put(policy->pol_desc->pd_owner); policy->pol_state = NRS_POL_STATE_STOPPED; - GOTO(out, rc); + goto out; } } @@ -327,7 +327,7 @@ static void nrs_policy_put(struct ptlrpc_nrs_policy *policy) /** * Find and return a policy by name. */ -static struct ptlrpc_nrs_policy * nrs_policy_find_locked(struct ptlrpc_nrs *nrs, +static struct ptlrpc_nrs_policy *nrs_policy_find_locked(struct ptlrpc_nrs *nrs, char *name) { struct ptlrpc_nrs_policy *tmp; @@ -377,7 +377,7 @@ static void nrs_resource_put(struct ptlrpc_nrs_resource *res) * \see ptlrpc_nrs_pol_ops::op_res_get() */ static -struct ptlrpc_nrs_resource * nrs_resource_get(struct ptlrpc_nrs_policy *policy, +struct ptlrpc_nrs_resource *nrs_resource_get(struct ptlrpc_nrs_policy *policy, struct ptlrpc_nrs_request *nrq, bool moving_req) { @@ -530,7 +530,7 @@ static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp) * \retval the NRS request to be handled */ static inline -struct ptlrpc_nrs_request * nrs_request_get(struct ptlrpc_nrs_policy *policy, +struct ptlrpc_nrs_request *nrs_request_get(struct ptlrpc_nrs_policy *policy, bool peek, bool force) { struct ptlrpc_nrs_request *nrq; @@ -635,8 +635,10 @@ static int nrs_policy_ctl(struct ptlrpc_nrs *nrs, char *name, spin_lock(&nrs->nrs_lock); policy = nrs_policy_find_locked(nrs, name); - if (policy == NULL) - GOTO(out, rc = -ENOENT); + if (policy == NULL) { + rc = -ENOENT; + goto out; + } switch (opc) { /** @@ -956,19 +958,21 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) nrs = nrs_svcpt2nrs(svcpt, false); rc = nrs_svcpt_setup_locked0(nrs, svcpt); if (rc < 0) - GOTO(out, rc); + goto out; /** * Optionally allocate a high-priority NRS head. */ if (svcpt->scp_service->srv_ops.so_hpreq_handler == NULL) - GOTO(out, rc); + goto out; OBD_CPT_ALLOC_PTR(svcpt->scp_nrs_hp, svcpt->scp_service->srv_cptable, svcpt->scp_cpt); - if (svcpt->scp_nrs_hp == NULL) - GOTO(out, rc = -ENOMEM); + if (svcpt->scp_nrs_hp == NULL) { + rc = -ENOMEM; + goto out; + } nrs = nrs_svcpt2nrs(svcpt, true); rc = nrs_svcpt_setup_locked0(nrs, svcpt); @@ -1154,12 +1158,15 @@ int ptlrpc_nrs_policy_register(struct ptlrpc_nrs_pol_conf *conf) CERROR("NRS: failing to register policy %s which has already " "been registered with NRS core!\n", conf->nc_name); - GOTO(fail, rc = -EEXIST); + rc = -EEXIST; + goto fail; } OBD_ALLOC_PTR(desc); - if (desc == NULL) - GOTO(fail, rc = -ENOMEM); + if (desc == NULL) { + rc = -ENOMEM; + goto fail; + } strncpy(desc->pd_name, conf->nc_name, NRS_POL_NAME_MAX); desc->pd_ops = conf->nc_ops; @@ -1214,7 +1221,7 @@ again: LASSERT(rc2 == 0); mutex_unlock(&ptlrpc_all_services_mutex); OBD_FREE_PTR(desc); - GOTO(fail, rc); + goto fail; } if (!hp && nrs_svc_has_hp(svc)) { @@ -1237,7 +1244,7 @@ again: LASSERT(rc2 == 0); mutex_unlock(&ptlrpc_all_services_mutex); OBD_FREE_PTR(desc); - GOTO(fail, rc); + goto fail; } } } @@ -1288,7 +1295,8 @@ int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf) CERROR("Failing to unregister NRS policy %s which has " "not been registered with NRS core!\n", conf->nc_name); - GOTO(not_exist, rc = -ENOENT); + rc = -ENOENT; + goto not_exist; } mutex_lock(&ptlrpc_all_services_mutex); @@ -1299,7 +1307,7 @@ int ptlrpc_nrs_policy_unregister(struct ptlrpc_nrs_pol_conf *conf) CERROR("Please first stop policy %s on all service " "partitions and then retry to unregister the " "policy.\n", conf->nc_name); - GOTO(fail, rc); + goto fail; } CDEBUG(D_INFO, "Unregistering policy %s from NRS core.\n", @@ -1347,7 +1355,7 @@ int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc) ptlrpc_service_for_each_part(svcpt, i, svc) { rc = nrs_svcpt_setup_locked(svcpt); if (rc != 0) - GOTO(failed, rc); + goto failed; } /** @@ -1361,7 +1369,7 @@ int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc) if (desc->pd_ops->op_lprocfs_init != NULL) { rc = desc->pd_ops->op_lprocfs_init(svc); if (rc != 0) - GOTO(failed, rc); + goto failed; } } @@ -1679,7 +1687,7 @@ int ptlrpc_nrs_policy_control(const struct ptlrpc_service *svc, opc, arg); if (rc != 0 || (queue == PTLRPC_NRS_QUEUE_REG && single)) - GOTO(out, rc); + goto out; } if ((queue & PTLRPC_NRS_QUEUE_HP) != 0) { @@ -1694,7 +1702,7 @@ int ptlrpc_nrs_policy_control(const struct ptlrpc_service *svc, rc = nrs_policy_ctl(nrs_svcpt2nrs(svcpt, true), name, opc, arg); if (rc != 0 || single) - GOTO(out, rc); + goto out; } } out: @@ -1721,7 +1729,7 @@ int ptlrpc_nrs_init(void) rc = ptlrpc_nrs_policy_register(&nrs_conf_fifo); if (rc != 0) - GOTO(fail, rc); + goto fail; return rc; diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs_crr.c b/drivers/staging/lustre/lustre/ptlrpc/nrs_crr.c deleted file mode 100644 index ddfb5102d822..000000000000 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs_crr.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License version 2 for more details. A copy is - * included in the COPYING file that accompanied this code. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * GPL HEADER END - */ -/* - * Copyright (c) 2011 Intel Corporation - * - * Copyright 2012 Xyratex Technology Limited - */ -/* - * lustre/ptlrpc/nrs_crr.c - * - * Network Request Scheduler (NRS) CRR-N policy - * - * Request ordering in a batched Round-Robin manner over client NIDs - * - * Author: Liang Zhen <liang@whamcloud.com> - * Author: Nikitas Angelinas <nikitas_angelinas@xyratex.com> - */ -/** - * \addtogoup nrs - * @{ - */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c index 28363307ee35..eb40c01db612 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c @@ -157,7 +157,7 @@ static int nrs_fifo_res_get(struct ptlrpc_nrs_policy *policy, * \see nrs_request_get() */ static -struct ptlrpc_nrs_request * nrs_fifo_req_get(struct ptlrpc_nrs_policy *policy, +struct ptlrpc_nrs_request *nrs_fifo_req_get(struct ptlrpc_nrs_policy *policy, bool peek, bool force) { struct nrs_fifo_head *head = policy->pol_private; diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index ac562932ccdf..50556db15f79 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -1600,8 +1600,8 @@ EXPORT_SYMBOL(ptlrpc_req_set_repsize); */ int do_set_info_async(struct obd_import *imp, int opcode, int version, - obd_count keylen, void *key, - obd_count vallen, void *val, + u32 keylen, void *key, + u32 vallen, void *val, struct ptlrpc_request_set *set) { struct ptlrpc_request *req; @@ -1797,7 +1797,7 @@ void lustre_swab_ost_body(struct ost_body *b) } EXPORT_SYMBOL(lustre_swab_ost_body); -void lustre_swab_ost_last_id(obd_id *id) +void lustre_swab_ost_last_id(u64 *id) { __swab64s(id); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5e4e49fab63c..20341b27a06a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -281,7 +281,8 @@ static int ptlrpc_pinger_main(void *arg) ping will get sent 2 timeouts from now! Beware. */ CDEBUG(D_INFO, "next wakeup in "CFS_DURATION_T" (" CFS_TIME_T")\n", time_to_next_wake, - cfs_time_add(this_ping,cfs_time_seconds(PING_INTERVAL))); + cfs_time_add(this_ping, + cfs_time_seconds(PING_INTERVAL))); if (time_to_next_wake > 0) { lwi = LWI_TIMEOUT(max_t(long, time_to_next_wake, cfs_time_seconds(1)), @@ -434,7 +435,7 @@ struct timeout_item* ptlrpc_new_timeout(int time, enum timeout_event event, OBD_ALLOC_PTR(ti); if (!ti) - return(NULL); + return NULL; INIT_LIST_HEAD(&ti->ti_obd_list); INIT_LIST_HEAD(&ti->ti_chain); @@ -489,7 +490,7 @@ int ptlrpc_add_timeout_client(int time, enum timeout_event event, ti = ptlrpc_pinger_register_timeout(time, event, cb, data); if (!ti) { mutex_unlock(&pinger_mutex); - return (-EINVAL); + return -EINVAL; } list_add(obd_list, &ti->ti_obd_list); mutex_unlock(&pinger_mutex); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index f7be007c88cb..7fe2e584ffd7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -57,7 +57,7 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned npages, unsigned max_brw, unsigned type, unsigned portal); int ptlrpc_request_cache_init(void); void ptlrpc_request_cache_fini(void); -struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags); +struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags); void ptlrpc_request_cache_free(struct ptlrpc_request *req); void ptlrpc_init_xid(void); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c index 6d92a56da620..5268887ca6b3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c @@ -75,45 +75,45 @@ __init int ptlrpc_init(void) cleanup_phase = 1; rc = ptlrpc_request_cache_init(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 2; rc = ptlrpc_init_portals(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 3; rc = ptlrpc_connection_init(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 4; ptlrpc_put_connection_superhack = ptlrpc_connection_put; rc = ptlrpc_start_pinger(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 5; rc = ldlm_init(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 6; rc = sptlrpc_init(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 7; rc = ptlrpc_nrs_init(); if (rc) - GOTO(cleanup, rc); + goto cleanup; cleanup_phase = 8; rc = tgt_mod_init(); if (rc) - GOTO(cleanup, rc); + goto cleanup; return 0; cleanup: diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 9c60e2af43bf..357ea9f8bd57 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -615,8 +615,10 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) spin_lock_init(&pc->pc_lock); strlcpy(pc->pc_name, name, sizeof(pc->pc_name)); pc->pc_set = ptlrpc_prep_set(); - if (pc->pc_set == NULL) - GOTO(out, rc = -ENOMEM); + if (pc->pc_set == NULL) { + rc = -ENOMEM; + goto out; + } /* * So far only "client" ptlrpcd uses an environment. In the future, @@ -625,19 +627,21 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) */ rc = lu_context_init(&pc->pc_env.le_ctx, LCT_CL_THREAD|LCT_REMEMBER); if (rc != 0) - GOTO(out_set, rc); + goto out_set; { struct task_struct *task; if (index >= 0) { rc = ptlrpcd_bind(index, max); if (rc < 0) - GOTO(out_env, rc); + goto out_env; } task = kthread_run(ptlrpcd, pc, "%s", pc->pc_name); - if (IS_ERR(task)) - GOTO(out_env, rc = PTR_ERR(task)); + if (IS_ERR(task)) { + rc = PTR_ERR(task); + goto out_env; + } wait_for_completion(&pc->pc_starting); } @@ -741,14 +745,16 @@ static int ptlrpcd_init(void) size = offsetof(struct ptlrpcd, pd_threads[nthreads]); OBD_ALLOC(ptlrpcds, size); - if (ptlrpcds == NULL) - GOTO(out, rc = -ENOMEM); + if (ptlrpcds == NULL) { + rc = -ENOMEM; + goto out; + } snprintf(name, sizeof(name), "ptlrpcd_rcv"); set_bit(LIOD_RECOVERY, &ptlrpcds->pd_thread_rcv.pc_flags); rc = ptlrpcd_start(-1, nthreads, name, &ptlrpcds->pd_thread_rcv); if (rc < 0) - GOTO(out, rc); + goto out; /* XXX: We start nthreads ptlrpc daemons. Each of them can process any * non-recovery async RPC to improve overall async RPC efficiency. @@ -766,7 +772,7 @@ static int ptlrpcd_init(void) snprintf(name, sizeof(name), "ptlrpcd_%d", i); rc = ptlrpcd_start(i, nthreads, name, &ptlrpcds->pd_threads[i]); if (rc < 0) - GOTO(out, rc); + goto out; } ptlrpcds->pd_size = size; diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index 5e4a1a52e0da..e1bc77b83ffb 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -47,7 +47,6 @@ #include "../include/lustre_import.h" #include "../include/lustre_export.h" #include "../include/obd.h" -#include "../include/obd_ost.h" #include "../include/obd_class.h" #include <linux/list.h> @@ -317,7 +316,7 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid, int async) rc = -EINVAL; spin_unlock(&imp->imp_lock); if (rc) - GOTO(out, rc); + goto out; /* force import to be disconnected. */ ptlrpc_set_import_discon(imp, 0); @@ -329,7 +328,7 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid, int async) obd_str2uuid(&uuid, new_uuid); rc = import_set_conn_priority(imp, &uuid); if (rc) - GOTO(out, rc); + goto out; } /* Check if reconnect is already in progress */ @@ -340,11 +339,11 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid, int async) } spin_unlock(&imp->imp_lock); if (rc) - GOTO(out, rc); + goto out; rc = ptlrpc_connect_import(imp); if (rc) - GOTO(out, rc); + goto out; if (!async) { struct l_wait_info lwi; diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 5cff7ee6ee7b..4ce76852e6ee 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -110,7 +110,7 @@ int sptlrpc_unregister_policy(struct ptlrpc_sec_policy *policy) EXPORT_SYMBOL(sptlrpc_unregister_policy); static -struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor) +struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor) { static DEFINE_MUTEX(load_mutex); static atomic_t loaded = ATOMIC_INIT(0); @@ -1095,15 +1095,18 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, early_size = req->rq_nob_received; early_bufsz = size_roundup_power2(early_size); OBD_ALLOC_LARGE(early_buf, early_bufsz); - if (early_buf == NULL) - GOTO(err_req, rc = -ENOMEM); + if (early_buf == NULL) { + rc = -ENOMEM; + goto err_req; + } /* sanity checkings and copy data out, do it inside spinlock */ spin_lock(&req->rq_lock); if (req->rq_replied) { spin_unlock(&req->rq_lock); - GOTO(err_buf, rc = -EALREADY); + rc = -EALREADY; + goto err_buf; } LASSERT(req->rq_repbuf); @@ -1113,7 +1116,8 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, if (req->rq_reply_off != 0) { CERROR("early reply with offset %u\n", req->rq_reply_off); spin_unlock(&req->rq_lock); - GOTO(err_buf, rc = -EPROTO); + rc = -EPROTO; + goto err_buf; } if (req->rq_nob_received != early_size) { @@ -1121,14 +1125,16 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, CERROR("data size has changed from %u to %u\n", early_size, req->rq_nob_received); spin_unlock(&req->rq_lock); - GOTO(err_buf, rc = -EINVAL); + rc = -EINVAL; + goto err_buf; } if (req->rq_nob_received < sizeof(struct lustre_msg)) { CERROR("early reply length %d too small\n", req->rq_nob_received); spin_unlock(&req->rq_lock); - GOTO(err_buf, rc = -EALREADY); + rc = -EALREADY; + goto err_buf; } memcpy(early_buf, req->rq_repbuf, early_size); @@ -1148,7 +1154,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, if (rc) { DEBUG_REQ(D_ADAPTTO, early_req, "error %d unwrap early reply", rc); - GOTO(err_ctx, rc); + goto err_ctx; } LASSERT(early_req->rq_repmsg); @@ -1267,7 +1273,7 @@ EXPORT_SYMBOL(sptlrpc_sec_put); * policy module is responsible for taking reference of import */ static -struct ptlrpc_sec * sptlrpc_sec_create(struct obd_import *imp, +struct ptlrpc_sec *sptlrpc_sec_create(struct obd_import *imp, struct ptlrpc_svc_ctx *svc_ctx, struct sptlrpc_flavor *sf, enum lustre_sec_part sp) @@ -1434,7 +1440,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp, char str2[24]; if (flavor_equal(&sf, &sec->ps_flvr)) - GOTO(out, rc); + goto out; CDEBUG(D_SEC, "import %s->%s: changing flavor %s -> %s\n", imp->imp_obd->obd_name, @@ -1447,7 +1453,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp, SPTLRPC_FLVR_MECH(sf.sf_rpc) == SPTLRPC_FLVR_MECH(sec->ps_flvr.sf_rpc)) { sptlrpc_import_sec_adapt_inplace(imp, sec, &sf); - GOTO(out, rc); + goto out; } } else if (SPTLRPC_FLVR_BASE(sf.sf_rpc) != SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_NULL)) { @@ -2366,7 +2372,7 @@ EXPORT_SYMBOL(sptlrpc_unpack_user_desc); * misc helpers * ****************************************/ -const char * sec2target_str(struct ptlrpc_sec *sec) +const char *sec2target_str(struct ptlrpc_sec *sec) { if (!sec || !sec->ps_import || !sec->ps_import->imp_obd) return "*"; diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 874789b200a3..cc68a1cf24e3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -365,7 +365,7 @@ static void enc_pools_insert(struct page ***pools, int npools, int npages) */ cur_npools = (page_pools.epp_total_pages + PAGES_PER_POOL - 1) / PAGES_PER_POOL; - end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL -1) / + end_npools = (page_pools.epp_total_pages + npages + PAGES_PER_POOL - 1) / PAGES_PER_POOL; LASSERT(end_npools <= page_pools.epp_max_pools); @@ -794,7 +794,7 @@ static int cfs_hash_alg_id[] = { [BULK_HASH_ALG_SHA384] = CFS_HASH_ALG_SHA384, [BULK_HASH_ALG_SHA512] = CFS_HASH_ALG_SHA512, }; -const char * sptlrpc_get_hash_name(__u8 hash_alg) +const char *sptlrpc_get_hash_name(__u8 hash_alg) { return cfs_crypto_hash_name(cfs_hash_alg_id[hash_alg]); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 01f8b0d6660e..56ba9e4e5297 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -41,13 +41,8 @@ #include <linux/key.h> #include "../include/obd.h" -#include "../include/obd_class.h" #include "../include/obd_support.h" -#include "../include/lustre_net.h" #include "../include/lustre_import.h" -#include "../include/lustre_log.h" -#include "../include/lustre_disk.h" -#include "../include/lustre_dlm.h" #include "../include/lustre_param.h" #include "../include/lustre_sec.h" @@ -450,46 +445,6 @@ void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset) } EXPORT_SYMBOL(sptlrpc_rule_set_dump); -static int sptlrpc_rule_set_extract(struct sptlrpc_rule_set *gen, - struct sptlrpc_rule_set *tgt, - enum lustre_sec_part from, - enum lustre_sec_part to, - struct sptlrpc_rule_set *rset) -{ - struct sptlrpc_rule_set *src[2] = { gen, tgt }; - struct sptlrpc_rule *rule; - int i, n, rc; - - might_sleep(); - - /* merge general rules firstly, then target-specific rules */ - for (i = 0; i < 2; i++) { - if (src[i] == NULL) - continue; - - for (n = 0; n < src[i]->srs_nrule; n++) { - rule = &src[i]->srs_rules[n]; - - if (from != LUSTRE_SP_ANY && - rule->sr_from != LUSTRE_SP_ANY && - rule->sr_from != from) - continue; - if (to != LUSTRE_SP_ANY && - rule->sr_to != LUSTRE_SP_ANY && - rule->sr_to != to) - continue; - - rc = sptlrpc_rule_set_merge(rset, rule); - if (rc) { - CERROR("can't merge: %d\n", rc); - return rc; - } - } - } - - return 0; -} - /********************************** * sptlrpc configuration support * **********************************/ @@ -746,7 +701,7 @@ void sptlrpc_conf_log_update_begin(const char *logname) conf = sptlrpc_conf_get(fsname, 0); if (conf) { - if(conf->sc_local) { + if (conf->sc_local) { LASSERT(conf->sc_updated == 0); sptlrpc_conf_free_rsets(conf); } @@ -815,7 +770,7 @@ void sptlrpc_conf_log_stop(const char *logname) } EXPORT_SYMBOL(sptlrpc_conf_log_stop); -static void inline flavor_set_flags(struct sptlrpc_flavor *sf, +static inline void flavor_set_flags(struct sptlrpc_flavor *sf, enum lustre_sec_part from, enum lustre_sec_part to, unsigned int fl_udesc) @@ -908,7 +863,7 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd) struct obd_import *imp; LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 || - strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) ==0); + strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0); CDEBUG(D_SEC, "obd %s\n", obd->u.cli.cl_target_uuid.uuid); /* serialize with connect/disconnect import */ @@ -927,288 +882,6 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd) } EXPORT_SYMBOL(sptlrpc_conf_client_adapt); - -static void rule2string(struct sptlrpc_rule *r, char *buf, int buflen) -{ - char dirbuf[8]; - char *net; - char *ptr = buf; - - if (r->sr_netid == LNET_NIDNET(LNET_NID_ANY)) - net = "default"; - else - net = libcfs_net2str(r->sr_netid); - - if (r->sr_from == LUSTRE_SP_ANY && r->sr_to == LUSTRE_SP_ANY) - dirbuf[0] = '\0'; - else - snprintf(dirbuf, sizeof(dirbuf), ".%s2%s", - sptlrpc_part2name(r->sr_from), - sptlrpc_part2name(r->sr_to)); - - ptr += snprintf(buf, buflen, "srpc.flavor.%s%s=", net, dirbuf); - - sptlrpc_flavor2name(&r->sr_flvr, ptr, buflen - (ptr - buf)); - buf[buflen - 1] = '\0'; -} - -static int sptlrpc_record_rule_set(struct llog_handle *llh, - char *target, - struct sptlrpc_rule_set *rset) -{ - struct lustre_cfg_bufs bufs; - struct lustre_cfg *lcfg; - struct llog_rec_hdr rec; - int buflen; - char param[48]; - int i, rc; - - for (i = 0; i < rset->srs_nrule; i++) { - rule2string(&rset->srs_rules[i], param, sizeof(param)); - - lustre_cfg_bufs_reset(&bufs, NULL); - lustre_cfg_bufs_set_string(&bufs, 1, target); - lustre_cfg_bufs_set_string(&bufs, 2, param); - lcfg = lustre_cfg_new(LCFG_SPTLRPC_CONF, &bufs); - LASSERT(lcfg); - - buflen = lustre_cfg_len(lcfg->lcfg_bufcount, - lcfg->lcfg_buflens); - rec.lrh_len = llog_data_len(buflen); - rec.lrh_type = OBD_CFG_REC; - rc = llog_write(NULL, llh, &rec, NULL, 0, (void *)lcfg, -1); - if (rc) - CERROR("failed to write a rec: rc = %d\n", rc); - lustre_cfg_free(lcfg); - } - return 0; -} - -static int sptlrpc_record_rules(struct llog_handle *llh, - struct sptlrpc_conf *conf) -{ - struct sptlrpc_conf_tgt *conf_tgt; - - sptlrpc_record_rule_set(llh, conf->sc_fsname, &conf->sc_rset); - - list_for_each_entry(conf_tgt, &conf->sc_tgts, sct_list) { - sptlrpc_record_rule_set(llh, conf_tgt->sct_name, - &conf_tgt->sct_rset); - } - return 0; -} - -#define LOG_SPTLRPC_TMP "sptlrpc.tmp" -#define LOG_SPTLRPC "sptlrpc" - -static -int sptlrpc_target_local_copy_conf(struct obd_device *obd, - struct sptlrpc_conf *conf) -{ - struct llog_handle *llh = NULL; - struct llog_ctxt *ctxt; - struct lvfs_run_ctxt saved; - struct dentry *dentry; - int rc; - - ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - if (ctxt == NULL) - return -EINVAL; - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs), - strlen(MOUNT_CONFIGS_DIR)); - if (IS_ERR(dentry)) { - rc = PTR_ERR(dentry); - CERROR("cannot lookup %s directory: rc = %d\n", - MOUNT_CONFIGS_DIR, rc); - GOTO(out_ctx, rc); - } - - /* erase the old tmp log */ - rc = llog_erase(NULL, ctxt, NULL, LOG_SPTLRPC_TMP); - if (rc < 0 && rc != -ENOENT) { - CERROR("%s: cannot erase temporary sptlrpc log: rc = %d\n", - obd->obd_name, rc); - GOTO(out_dput, rc); - } - - /* write temporary log */ - rc = llog_open_create(NULL, ctxt, &llh, NULL, LOG_SPTLRPC_TMP); - if (rc) - GOTO(out_dput, rc); - rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL); - if (rc) - GOTO(out_close, rc); - - rc = sptlrpc_record_rules(llh, conf); - -out_close: - llog_close(NULL, llh); - if (rc == 0) - rc = lustre_rename(dentry, obd->obd_lvfs_ctxt.pwdmnt, - LOG_SPTLRPC_TMP, LOG_SPTLRPC); -out_dput: - l_dput(dentry); -out_ctx: - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n", - obd->obd_name, rc); - return rc; -} - -static int local_read_handler(const struct lu_env *env, - struct llog_handle *llh, - struct llog_rec_hdr *rec, void *data) -{ - struct sptlrpc_conf *conf = (struct sptlrpc_conf *) data; - struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1); - int cfg_len, rc; - - if (rec->lrh_type != OBD_CFG_REC) { - CERROR("unhandled lrh_type: %#x\n", rec->lrh_type); - return -EINVAL; - } - - cfg_len = rec->lrh_len - sizeof(struct llog_rec_hdr) - - sizeof(struct llog_rec_tail); - - rc = lustre_cfg_sanity_check(lcfg, cfg_len); - if (rc) { - CERROR("Insane cfg\n"); - return rc; - } - - if (lcfg->lcfg_command != LCFG_SPTLRPC_CONF) { - CERROR("invalid command (%x)\n", lcfg->lcfg_command); - return -EINVAL; - } - - return __sptlrpc_process_config(lcfg, conf); -} - -static -int sptlrpc_target_local_read_conf(struct obd_device *obd, - struct sptlrpc_conf *conf) -{ - struct llog_handle *llh = NULL; - struct llog_ctxt *ctxt; - struct lvfs_run_ctxt saved; - int rc; - - LASSERT(conf->sc_updated == 0 && conf->sc_local == 0); - - ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); - if (ctxt == NULL) { - CERROR("missing llog context\n"); - return -EINVAL; - } - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - rc = llog_open(NULL, ctxt, &llh, NULL, LOG_SPTLRPC, LLOG_OPEN_EXISTS); - if (rc < 0) { - if (rc == -ENOENT) - rc = 0; - GOTO(out_pop, rc); - } - - rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL); - if (rc) - GOTO(out_close, rc); - - if (llog_get_size(llh) <= 1) { - CDEBUG(D_SEC, "no local sptlrpc copy found\n"); - GOTO(out_close, rc = 0); - } - - rc = llog_process(NULL, llh, local_read_handler, (void *)conf, NULL); - - if (rc == 0) { - conf->sc_local = 1; - } else { - sptlrpc_conf_free_rsets(conf); - } - -out_close: - llog_close(NULL, llh); -out_pop: - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n", - obd->obd_name, rc); - return rc; -} - - -/** - * called by target devices, extract sptlrpc rules which applies to - * this target, to be used for future rpc flavor checking. - */ -int sptlrpc_conf_target_get_rules(struct obd_device *obd, - struct sptlrpc_rule_set *rset, - int initial) -{ - struct sptlrpc_conf *conf; - struct sptlrpc_conf_tgt *conf_tgt; - enum lustre_sec_part sp_dst; - char fsname[MTI_NAME_MAXLEN]; - int rc = 0; - - if (strcmp(obd->obd_type->typ_name, LUSTRE_MDT_NAME) == 0) { - sp_dst = LUSTRE_SP_MDT; - } else if (strcmp(obd->obd_type->typ_name, LUSTRE_OST_NAME) == 0) { - sp_dst = LUSTRE_SP_OST; - } else { - CERROR("unexpected obd type %s\n", obd->obd_type->typ_name); - return -EINVAL; - } - CDEBUG(D_SEC, "get rules for target %s\n", obd->obd_uuid.uuid); - - target2fsname(obd->obd_uuid.uuid, fsname, sizeof(fsname)); - - mutex_lock(&sptlrpc_conf_lock); - - conf = sptlrpc_conf_get(fsname, 0); - if (conf == NULL) { - CERROR("missing sptlrpc config log\n"); - GOTO(out, rc); - } - - if (conf->sc_updated == 0) { - /* - * always read from local copy. here another option is - * if we already have a local copy (read from another - * target device hosted on the same node) we simply use that. - */ - if (conf->sc_local) - sptlrpc_conf_free_rsets(conf); - - sptlrpc_target_local_read_conf(obd, conf); - } else { - LASSERT(conf->sc_local == 0); - - /* write a local copy */ - if (initial || conf->sc_modified) - sptlrpc_target_local_copy_conf(obd, conf); - else - CDEBUG(D_SEC, "unchanged, skip updating local copy\n"); - } - - /* extract rule set for this target */ - conf_tgt = sptlrpc_conf_get_tgt(conf, obd->obd_name, 0); - - rc = sptlrpc_rule_set_extract(&conf->sc_rset, - conf_tgt ? &conf_tgt->sct_rset: NULL, - LUSTRE_SP_ANY, sp_dst, rset); -out: - mutex_unlock(&sptlrpc_conf_lock); - return rc; -} -EXPORT_SYMBOL(sptlrpc_conf_target_get_rules); - int sptlrpc_conf_init(void) { mutex_init(&sptlrpc_conf_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index a47791411149..099cec3b669f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -471,5 +471,6 @@ void sptlrpc_null_fini(void) rc = sptlrpc_unregister_policy(&null_policy); if (rc) - CERROR("failed to unregister %s: %d\n", null_policy.sp_name,rc); + CERROR("failed to unregister %s: %d\n", + null_policy.sp_name, rc); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index c88eae27bbf4..a8df8a792333 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -781,13 +781,15 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, cpt = cpts != NULL ? cpts[i] : i; OBD_CPT_ALLOC(svcpt, cptable, cpt, sizeof(*svcpt)); - if (svcpt == NULL) - GOTO(failed, rc = -ENOMEM); + if (svcpt == NULL) { + rc = -ENOMEM; + goto failed; + } service->srv_parts[i] = svcpt; rc = ptlrpc_service_part_init(service, svcpt, cpt); if (rc != 0) - GOTO(failed, rc); + goto failed; } ptlrpc_server_nthreads_check(service, conf); @@ -804,7 +806,7 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, rc = ptlrpc_service_nrs_setup(service); if (rc != 0) - GOTO(failed, rc); + goto failed; CDEBUG(D_NET, "%s: Started, listening on portal %d\n", service->srv_name, service->srv_req_portal); @@ -813,7 +815,7 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, if (rc != 0) { CERROR("Failed to start threads for service %s: %d\n", service->srv_name, rc); - GOTO(failed, rc); + goto failed; } return service; @@ -1172,13 +1174,13 @@ static int ptlrpc_at_add_timed(struct ptlrpc_request *req) __u32 index; if (AT_OFF) - return(0); + return 0; if (req->rq_no_reply) return 0; if ((lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT) == 0) - return(-ENOSYS); + return -ENOSYS; spin_lock(&svcpt->scp_at_lock); LASSERT(list_empty(&req->rq_timed_list)); @@ -1308,8 +1310,10 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) if (reqcopy == NULL) return -ENOMEM; OBD_ALLOC_LARGE(reqmsg, req->rq_reqlen); - if (!reqmsg) - GOTO(out_free, rc = -ENOMEM); + if (!reqmsg) { + rc = -ENOMEM; + goto out_free; + } *reqcopy = *req; reqcopy->rq_reply_state = NULL; @@ -1327,24 +1331,29 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) if (atomic_read(&req->rq_refcount) == 1) { DEBUG_REQ(D_ADAPTTO, reqcopy, "Normal reply already sent out, " "abort sending early reply\n"); - GOTO(out, rc = -EINVAL); + rc = -EINVAL; + goto out; } /* Connection ref */ reqcopy->rq_export = class_conn2export( lustre_msg_get_handle(reqcopy->rq_reqmsg)); - if (reqcopy->rq_export == NULL) - GOTO(out, rc = -ENODEV); + if (reqcopy->rq_export == NULL) { + rc = -ENODEV; + goto out; + } /* RPC ref */ class_export_rpc_inc(reqcopy->rq_export); if (reqcopy->rq_export->exp_obd && - reqcopy->rq_export->exp_obd->obd_fail) - GOTO(out_put, rc = -ENODEV); + reqcopy->rq_export->exp_obd->obd_fail) { + rc = -ENODEV; + goto out_put; + } rc = lustre_pack_reply_flags(reqcopy, 1, NULL, NULL, LPRFL_EARLY_REPLY); if (rc) - GOTO(out_put, rc); + goto out_put; rc = ptlrpc_send_reply(reqcopy, PTLRPC_REPLY_EARLY); @@ -1849,7 +1858,7 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, /* Move it over to the request processing queue */ rc = ptlrpc_server_request_add(svcpt, req); if (rc) - GOTO(err_req, rc); + goto err_req; wake_up(&svcpt->scp_waitq); return 1; @@ -1896,7 +1905,8 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, libcfs_debug_dumplog(); do_gettimeofday(&work_start); - timediff = cfs_timeval_sub(&work_start, &request->rq_arrival_time,NULL); + timediff = cfs_timeval_sub(&work_start, &request->rq_arrival_time, + NULL); if (likely(svc->srv_stats != NULL)) { lprocfs_counter_add(svc->srv_stats, PTLRPC_REQWAIT_CNTR, timediff); @@ -2262,9 +2272,7 @@ static int ptlrpc_main(void *arg) struct ptlrpc_service_part *svcpt = thread->t_svcpt; struct ptlrpc_service *svc = svcpt->scp_service; struct ptlrpc_reply_state *rs; -#ifdef WITH_GROUP_INFO struct group_info *ginfo = NULL; -#endif struct lu_env *env; int counter = 0, rc = 0; @@ -2280,7 +2288,6 @@ static int ptlrpc_main(void *arg) svc->srv_name, thread->t_name, svcpt->scp_cpt); } -#ifdef WITH_GROUP_INFO ginfo = groups_alloc(0); if (!ginfo) { rc = -ENOMEM; @@ -2289,7 +2296,6 @@ static int ptlrpc_main(void *arg) set_current_groups(ginfo); put_group_info(ginfo); -#endif if (svc->srv_ops.so_thr_init != NULL) { rc = svc->srv_ops.so_thr_init(thread); @@ -2790,8 +2796,10 @@ int ptlrpc_hr_init(void) LASSERT(hrp->hrp_nthrs > 0); OBD_CPT_ALLOC(hrp->hrp_thrs, ptlrpc_hr.hr_cpt_table, i, hrp->hrp_nthrs * sizeof(*hrt)); - if (hrp->hrp_thrs == NULL) - GOTO(out, rc = -ENOMEM); + if (hrp->hrp_thrs == NULL) { + rc = -ENOMEM; + goto out; + } for (j = 0; j < hrp->hrp_nthrs; j++) { hrt = &hrp->hrp_thrs[j]; diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 0624420135c2..d6d92046c348 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -460,54 +460,6 @@ void lustre_assert_wire_constants(void) LASSERTF(OBJ_INDEX_DELETE == 11, "found %lld\n", (long long)OBJ_INDEX_DELETE); - /* Checks for struct som_attrs */ - LASSERTF((int)sizeof(struct som_attrs) == 40, "found %lld\n", - (long long)(int)sizeof(struct som_attrs)); - LASSERTF((int)offsetof(struct som_attrs, som_compat) == 0, "found %lld\n", - (long long)(int)offsetof(struct som_attrs, som_compat)); - LASSERTF((int)sizeof(((struct som_attrs *)0)->som_compat) == 4, "found %lld\n", - (long long)(int)sizeof(((struct som_attrs *)0)->som_compat)); - LASSERTF((int)offsetof(struct som_attrs, som_incompat) == 4, "found %lld\n", - (long long)(int)offsetof(struct som_attrs, som_incompat)); - LASSERTF((int)sizeof(((struct som_attrs *)0)->som_incompat) == 4, "found %lld\n", - (long long)(int)sizeof(((struct som_attrs *)0)->som_incompat)); - LASSERTF((int)offsetof(struct som_attrs, som_ioepoch) == 8, "found %lld\n", - (long long)(int)offsetof(struct som_attrs, som_ioepoch)); - LASSERTF((int)sizeof(((struct som_attrs *)0)->som_ioepoch) == 8, "found %lld\n", - (long long)(int)sizeof(((struct som_attrs *)0)->som_ioepoch)); - LASSERTF((int)offsetof(struct som_attrs, som_size) == 16, "found %lld\n", - (long long)(int)offsetof(struct som_attrs, som_size)); - LASSERTF((int)sizeof(((struct som_attrs *)0)->som_size) == 8, "found %lld\n", - (long long)(int)sizeof(((struct som_attrs *)0)->som_size)); - LASSERTF((int)offsetof(struct som_attrs, som_blocks) == 24, "found %lld\n", - (long long)(int)offsetof(struct som_attrs, som_blocks)); - LASSERTF((int)sizeof(((struct som_attrs *)0)->som_blocks) == 8, "found %lld\n", - (long long)(int)sizeof(((struct som_attrs *)0)->som_blocks)); - LASSERTF((int)offsetof(struct som_attrs, som_mountid) == 32, "found %lld\n", - (long long)(int)offsetof(struct som_attrs, som_mountid)); - LASSERTF((int)sizeof(((struct som_attrs *)0)->som_mountid) == 8, "found %lld\n", - (long long)(int)sizeof(((struct som_attrs *)0)->som_mountid)); - - /* Checks for struct hsm_attrs */ - LASSERTF((int)sizeof(struct hsm_attrs) == 24, "found %lld\n", - (long long)(int)sizeof(struct hsm_attrs)); - LASSERTF((int)offsetof(struct hsm_attrs, hsm_compat) == 0, "found %lld\n", - (long long)(int)offsetof(struct hsm_attrs, hsm_compat)); - LASSERTF((int)sizeof(((struct hsm_attrs *)0)->hsm_compat) == 4, "found %lld\n", - (long long)(int)sizeof(((struct hsm_attrs *)0)->hsm_compat)); - LASSERTF((int)offsetof(struct hsm_attrs, hsm_flags) == 4, "found %lld\n", - (long long)(int)offsetof(struct hsm_attrs, hsm_flags)); - LASSERTF((int)sizeof(((struct hsm_attrs *)0)->hsm_flags) == 4, "found %lld\n", - (long long)(int)sizeof(((struct hsm_attrs *)0)->hsm_flags)); - LASSERTF((int)offsetof(struct hsm_attrs, hsm_arch_id) == 8, "found %lld\n", - (long long)(int)offsetof(struct hsm_attrs, hsm_arch_id)); - LASSERTF((int)sizeof(((struct hsm_attrs *)0)->hsm_arch_id) == 8, "found %lld\n", - (long long)(int)sizeof(((struct hsm_attrs *)0)->hsm_arch_id)); - LASSERTF((int)offsetof(struct hsm_attrs, hsm_arch_ver) == 16, "found %lld\n", - (long long)(int)offsetof(struct hsm_attrs, hsm_arch_ver)); - LASSERTF((int)sizeof(((struct hsm_attrs *)0)->hsm_arch_ver) == 8, "found %lld\n", - (long long)(int)sizeof(((struct hsm_attrs *)0)->hsm_arch_ver)); - /* Checks for struct ost_id */ LASSERTF((int)sizeof(struct ost_id) == 16, "found %lld\n", (long long)(int)sizeof(struct ost_id)); |