diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm/ldlm_lib.c')
-rw-r--r-- | drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 86 |
1 files changed, 53 insertions, 33 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index fda9926bea3b..c21e30a074b9 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -74,8 +74,10 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid, if (create) { OBD_ALLOC(imp_conn, sizeof(*imp_conn)); - if (!imp_conn) - GOTO(out_put, rc = -ENOMEM); + if (!imp_conn) { + rc = -ENOMEM; + goto out_put; + } } spin_lock(&imp->imp_lock); @@ -91,7 +93,8 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid, imp, imp->imp_obd->obd_name, uuid->uuid, (priority ? ", moved to head" : "")); spin_unlock(&imp->imp_lock); - GOTO(out_free, rc = 0); + rc = 0; + goto out_free; } } /* No existing import connection found for \a uuid. */ @@ -109,7 +112,8 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid, (priority ? "head" : "tail")); } else { spin_unlock(&imp->imp_lock); - GOTO(out_free, rc = -ENOENT); + rc = -ENOENT; + goto out_free; } spin_unlock(&imp->imp_lock); @@ -143,7 +147,7 @@ int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid) spin_lock(&imp->imp_lock); if (list_empty(&imp->imp_conn_list)) { LASSERT(!imp->imp_connection); - GOTO(out, rc); + goto out; } list_for_each_entry(imp_conn, &imp->imp_conn_list, oic_item) { @@ -157,7 +161,8 @@ int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid) if (imp->imp_state != LUSTRE_IMP_CLOSED && imp->imp_state != LUSTRE_IMP_DISCON) { CERROR("can't remove current connection\n"); - GOTO(out, rc = -EBUSY); + rc = -EBUSY; + goto out; } ptlrpc_connection_put(imp->imp_connection); @@ -262,15 +267,10 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) char *name = obddev->obd_type->typ_name; ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN; int rc; - char *cli_name = lustre_cfg_buf(lcfg, 0); /* In a more perfect world, we would hang a ptlrpc_client off of * obd_type and just use the values from there. */ - if (!strcmp(name, LUSTRE_OSC_NAME) || - (!(strcmp(name, LUSTRE_OSP_NAME)) && - (is_osp_on_mdt(cli_name) && - strstr(lustre_cfg_buf(lcfg, 1), "OST") != NULL))) { - /* OSC or OSP_on_MDT for OSTs */ + if (!strcmp(name, LUSTRE_OSC_NAME)) { rq_portal = OST_REQUEST_PORTAL; rp_portal = OSC_REPLY_PORTAL; connect_op = OST_CONNECT; @@ -278,17 +278,29 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) cli->cl_sp_to = LUSTRE_SP_OST; ns_type = LDLM_NS_TYPE_OSC; } else if (!strcmp(name, LUSTRE_MDC_NAME) || - !strcmp(name, LUSTRE_LWP_NAME) || - (!strcmp(name, LUSTRE_OSP_NAME) && - (is_osp_on_mdt(cli_name) && - strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL))) { - /* MDC or OSP_on_MDT for other MDTs */ + !strcmp(name, LUSTRE_LWP_NAME)) { rq_portal = MDS_REQUEST_PORTAL; rp_portal = MDC_REPLY_PORTAL; connect_op = MDS_CONNECT; cli->cl_sp_me = LUSTRE_SP_CLI; cli->cl_sp_to = LUSTRE_SP_MDT; ns_type = LDLM_NS_TYPE_MDC; + } else if (!strcmp(name, LUSTRE_OSP_NAME)) { + if (strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL) { + /* OSP_on_MDT for other MDTs */ + connect_op = MDS_CONNECT; + cli->cl_sp_to = LUSTRE_SP_MDT; + ns_type = LDLM_NS_TYPE_MDC; + rq_portal = OUT_PORTAL; + } else { + /* OSP on MDT for OST */ + connect_op = OST_CONNECT; + cli->cl_sp_to = LUSTRE_SP_OST; + ns_type = LDLM_NS_TYPE_OSC; + rq_portal = OST_REQUEST_PORTAL; + } + rp_portal = OSC_REPLY_PORTAL; + cli->cl_sp_me = LUSTRE_SP_CLI; } else if (!strcmp(name, LUSTRE_MGC_NAME)) { rq_portal = MGS_REQUEST_PORTAL; rp_portal = MGC_REPLY_PORTAL; @@ -398,15 +410,17 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) rc = ldlm_get_ref(); if (rc) { CERROR("ldlm_get_ref failed: %d\n", rc); - GOTO(err, rc); + goto err; } ptlrpc_init_client(rq_portal, rp_portal, name, &obddev->obd_ldlm_client); imp = class_new_import(obddev); - if (imp == NULL) - GOTO(err_ldlm, rc = -ENOENT); + if (imp == NULL) { + rc = -ENOENT; + goto err_ldlm; + } imp->imp_client = &obddev->obd_ldlm_client; imp->imp_connect_op = connect_op; memcpy(cli->cl_target_uuid.uuid, lustre_cfg_buf(lcfg, 1), @@ -416,7 +430,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) rc = client_import_add_conn(imp, &server_uuid, 1); if (rc) { CERROR("can't add initial connection\n"); - GOTO(err_import, rc); + goto err_import; } cli->cl_import = imp; @@ -442,7 +456,8 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) if (obddev->obd_namespace == NULL) { CERROR("Unable to create client namespace - %s\n", obddev->obd_name); - GOTO(err_import, rc = -ENOMEM); + rc = -ENOMEM; + goto err_import; } cli->cl_qchk_stat = CL_NOT_QUOTACHECKED; @@ -485,12 +500,14 @@ int client_connect_import(const struct lu_env *env, *exp = NULL; down_write(&cli->cl_sem); - if (cli->cl_conn_count > 0 ) - GOTO(out_sem, rc = -EALREADY); + if (cli->cl_conn_count > 0) { + rc = -EALREADY; + goto out_sem; + } rc = class_connect(&conn, obd, cluuid); if (rc) - GOTO(out_sem, rc); + goto out_sem; cli->cl_conn_count++; *exp = class_conn2export(&conn); @@ -500,7 +517,7 @@ int client_connect_import(const struct lu_env *env, imp->imp_dlm_handle = conn; rc = ptlrpc_init_import(imp); if (rc != 0) - GOTO(out_ldlm, rc); + goto out_ldlm; ocd = &imp->imp_connect_data; if (data) { @@ -511,7 +528,7 @@ int client_connect_import(const struct lu_env *env, rc = ptlrpc_connect_import(imp); if (rc != 0) { LASSERT(imp->imp_state == LUSTRE_IMP_DISCON); - GOTO(out_ldlm, rc); + goto out_ldlm; } LASSERT(*exp != NULL && (*exp)->exp_connection); @@ -560,12 +577,15 @@ int client_disconnect_export(struct obd_export *exp) if (!cli->cl_conn_count) { CERROR("disconnecting disconnected device (%s)\n", obd->obd_name); - GOTO(out_disconnect, rc = -EINVAL); + rc = -EINVAL; + goto out_disconnect; } cli->cl_conn_count--; - if (cli->cl_conn_count) - GOTO(out_disconnect, rc = 0); + if (cli->cl_conn_count) { + rc = 0; + goto out_disconnect; + } /* Mark import deactivated now, so we don't try to reconnect if any * of the cleanup RPCs fails (e.g. LDLM cancel, etc). We don't @@ -640,18 +660,18 @@ int target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id) { if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) { DEBUG_REQ(D_ERROR, req, "dropping reply"); - return (-ECOMM); + return -ECOMM; } if (unlikely(rc)) { DEBUG_REQ(D_NET, req, "processing error (%d)", rc); req->rq_status = rc; - return (ptlrpc_send_error(req, 1)); + return ptlrpc_send_error(req, 1); } else { DEBUG_REQ(D_NET, req, "sending reply"); } - return (ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT)); + return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT); } void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) |