From: nathan Date: Wed, 19 Aug 2009 19:44:31 +0000 (+0000) Subject: b=19955 X-Git-Tag: v1_9_250~27 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f907343dc34ac32bde1a56030d9994fa024a2874 b=19955 i=adilger i=rread LDLM_SET_INFO rpc for server to client communications. Will be used by HSM copytool, imperative shutdown. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index e73e8c3..6b2fbff 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -13,6 +13,11 @@ tbd Sun Microsystems, Inc. removed cwd "./" (refer to Bugzilla 14399). * File join has been disabled in this release, refer to Bugzilla 16929. +Severity : enhancement +Bugzilla : 19955 +Description: provide server to client comms path +Details : server to client communications path via new LDLM_SET_INFO rpc + Severity : normal Bugzilla : 20008 Description: truncate starts GFP_FS allocation under transaction causing deadlock diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index e29996f..c96f300 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1954,6 +1954,7 @@ typedef enum { LDLM_BL_CALLBACK = 104, LDLM_CP_CALLBACK = 105, LDLM_GL_CALLBACK = 106, + LDLM_SET_INFO = 107, LDLM_LAST_OPC } ldlm_cmd_t; #define LDLM_FIRST_OPC LDLM_ENQUEUE diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 668cce1..d890d67 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -76,6 +76,10 @@ void target_destroy_export(struct obd_export *exp); int target_pack_pool_reply(struct ptlrpc_request *req); int target_handle_ping(struct ptlrpc_request *req); void target_committed_to_req(struct ptlrpc_request *req); +int target_set_info_rpc(struct obd_import *imp, int opcode, + obd_count keylen, void *key, + obd_count vallen, void *val, + struct ptlrpc_request_set *set); /* quotacheck callback, dqacq/dqrel callback handler */ int target_handle_qc_callback(struct ptlrpc_request *req); diff --git a/lustre/include/lustre_req_layout.h b/lustre/include/lustre_req_layout.h index 72701d1..369cfe6 100644 --- a/lustre/include/lustre_req_layout.h +++ b/lustre/include/lustre_req_layout.h @@ -128,6 +128,7 @@ void req_layout_fini(void); #endif extern const struct req_format RQF_OBD_PING; +extern const struct req_format RQF_OBD_SET_INFO; extern const struct req_format RQF_SEC_CTX; /* MGS req_format */ extern const struct req_format RQF_MGS_TARGET_REG; @@ -152,7 +153,6 @@ extern const struct req_format RQF_MDS_PIN; extern const struct req_format RQF_MDS_UNPIN; extern const struct req_format RQF_MDS_CONNECT; extern const struct req_format RQF_MDS_DISCONNECT; -extern const struct req_format RQF_MDS_SET_INFO; extern const struct req_format RQF_MDS_GET_INFO; extern const struct req_format RQF_MDS_READPAGE; extern const struct req_format RQF_MDS_WRITEPAGE; @@ -187,7 +187,6 @@ extern const struct req_format RQF_OST_SYNC; extern const struct req_format RQF_OST_DESTROY; extern const struct req_format RQF_OST_BRW; extern const struct req_format RQF_OST_STATFS; -extern const struct req_format RQF_OST_SET_INFO; extern const struct req_format RQF_OST_SET_GRANT_INFO; extern const struct req_format RQF_OST_GET_INFO_GENERIC; extern const struct req_format RQF_OST_GET_INFO_LAST_ID; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 6807efd..586f9fe 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1157,6 +1157,7 @@ enum obd_cleanup_stage { }; /* get/set_info keys */ +#define KEY_ASYNC "async" #define KEY_BLOCKSIZE_BITS "blocksize_bits" #define KEY_BLOCKSIZE "blocksize" #define KEY_CAPA_KEY "capa_key" @@ -1168,8 +1169,11 @@ enum obd_cleanup_stage { #define KEY_EVICT_BY_NID "evict_by_nid" #define KEY_FIEMAP "fiemap" #define KEY_FLUSH_CTX "flush_ctx" +#define KEY_GRANT_SHRINK "grant_shrink" +#define KEY_HSM_COPYTOOL_SEND "hsm_send" #define KEY_INIT_RECOV_BACKUP "init_recov_bk" #define KEY_INIT_RECOV "initial_recov" +#define KEY_INTERMDS "inter_mds" #define KEY_LAST_ID "last_id" #define KEY_LOCK_TO_STRIPE "lock_to_stripe" #define KEY_LOVDESC "lovdesc" @@ -1182,12 +1186,10 @@ enum obd_cleanup_stage { #define KEY_REGISTER_TARGET "register_target" #define KEY_REVIMP_UPD "revimp_update" #define KEY_SET_FS "set_fs" +/* KEY_SET_INFO in lustre_idl.h */ #define KEY_SPTLRPC_CONF "sptlrpc_conf" #define KEY_UNLINKED "unlinked" -/* XXX unused ?*/ -#define KEY_INTERMDS "inter_mds" -#define KEY_ASYNC "async" -#define KEY_GRANT_SHRINK "grant_shrink" + struct lu_context; diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 23ef86e..ce3e65a 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -2356,6 +2356,53 @@ out: } #endif /* HAVE_QUOTA_SUPPORT */ +/* Send a remote set_info_async. + * This may go from client to server or server to client + */ +int target_set_info_rpc(struct obd_import *imp, int opcode, + obd_count keylen, void *key, + obd_count vallen, void *val, + struct ptlrpc_request_set *set) +{ + struct ptlrpc_request *req; + char *tmp; + int rc; + ENTRY; + + req = ptlrpc_request_alloc(imp, &RQF_OBD_SET_INFO); + if (req == NULL) + RETURN(-ENOMEM); + + req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY, + RCL_CLIENT, keylen); + req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_VAL, + RCL_CLIENT, vallen); + rc = ptlrpc_request_pack(req, LUSTRE_OBD_VERSION, opcode); + if (rc) { + ptlrpc_request_free(req); + RETURN(rc); + } + + tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY); + memcpy(tmp, key, keylen); + tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_VAL); + memcpy(tmp, val, vallen); + + ptlrpc_request_set_replen(req); + + if (set) { + ptlrpc_set_add_req(set, req); + ptlrpc_check_set(NULL, set); + } else { + rc = ptlrpc_queue_wait(req); + ptlrpc_req_finished(req); + } + + RETURN(rc); +} +EXPORT_SYMBOL(target_set_info_rpc); + + ldlm_mode_t lck_compat_array[] = { [LCK_EX] LCK_COMPAT_EX, [LCK_PW] LCK_COMPAT_PW, diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 5ffd734..14a628a 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1676,6 +1676,49 @@ int ldlm_bl_to_thread_list(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, #endif } +/* Setinfo coming from Server (eg MDT) to Client (eg MDC)! */ +static int ldlm_handle_setinfo(struct ptlrpc_request *req) +{ + struct obd_device *obd = req->rq_export->exp_obd; + char *key; + void *val; + int keylen, vallen; + int rc = -ENOSYS; + ENTRY; + + DEBUG_REQ(D_ERROR, req, "%s: handle setinfo\n", obd->obd_name); + + req_capsule_set(&req->rq_pill, &RQF_OBD_SET_INFO); + + key = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY); + if (key == NULL) { + DEBUG_REQ(D_IOCTL, req, "no set_info key"); + RETURN(-EFAULT); + } + keylen = req_capsule_get_size(&req->rq_pill, &RMF_SETINFO_KEY, + RCL_CLIENT); + val = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_VAL); + if (val == NULL) { + DEBUG_REQ(D_IOCTL, req, "no set_info val"); + RETURN(-EFAULT); + } + vallen = req_capsule_get_size(&req->rq_pill, &RMF_SETINFO_VAL, + RCL_CLIENT); + + /* We are responsible for swabbing contents of val */ + + if (KEY_IS(KEY_HSM_COPYTOOL_SEND)) + /* Pass it on to mdc (the "export" in this case) */ + rc = obd_set_info_async(req->rq_export, + sizeof(KEY_HSM_COPYTOOL_SEND), + KEY_HSM_COPYTOOL_SEND, + vallen, val, NULL); + else + DEBUG_REQ(D_WARNING, req, "ignoring unknown key %s", key); + + return rc; +} + /* TODO: handle requests in a similar way as MDT: see mdt_handle_common() */ static int ldlm_callback_handler(struct ptlrpc_request *req) { @@ -1717,6 +1760,10 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_GL_CALLBACK)) RETURN(0); break; + case LDLM_SET_INFO: + rc = ldlm_handle_setinfo(req); + ldlm_callback_reply(req, rc); + RETURN(0); case OBD_LOG_CANCEL: /* remove this eventually - for 1.4.0 compat */ CERROR("shouldn't be handling OBD_LOG_CANCEL on DLM thread\n"); req_capsule_set(&req->rq_pill, &RQF_LOG_CANCEL); diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index d2af671..f55ab46 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -131,59 +131,6 @@ static struct file_operations mdc_changelog_fops = { .release = mdc_changelog_seq_release, }; -/* temporary for testing */ -static int mdc_wr_netlink(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = data; - struct lnl_hdr *lh; - struct hsm_action_list *hal; - struct hsm_action_item *hai; - int len; - int pid, rc; - - rc = lprocfs_write_helper(buffer, count, &pid); - if (rc) - return rc; - - if (pid < 0) - return -ERANGE; - CWARN("message to pid %d\n", pid); - - len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN + - /* for mockup below */ 2 * size_round(sizeof(*hai)); - - OBD_ALLOC(lh, len); - - lh->lnl_magic = LNL_MAGIC; - lh->lnl_transport = LNL_TRANSPORT_HSM; - lh->lnl_msgtype = HMT_ACTION_LIST; - lh->lnl_msglen = len; - - hal = (struct hsm_action_list *)(lh + 1); - hal->hal_version = HAL_VERSION; - hal->hal_archive_num = 1; - obd_uuid2fsname(hal->hal_fsname, obd->obd_name, MTI_NAME_MAXLEN); - - /* mock up an action list */ - hal->hal_count = 2; - hai = hai_zero(hal); - hai->hai_action = HSMA_ARCHIVE; - hai->hai_fid.f_oid = 5; - hai->hai_len = sizeof(*hai); - hai = hai_next(hai); - hai->hai_action = HSMA_RESTORE; - hai->hai_fid.f_oid = 10; - hai->hai_len = sizeof(*hai); - - /* This works for either broadcast or unicast to a single pid */ - rc = libcfs_klnl_msg_put(pid, pid == 0 ? LNL_GRP_HSM : 0, lh); - - OBD_FREE(lh, len); - if (rc < 0) - return rc; - return count; -} static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, @@ -204,7 +151,6 @@ static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { { "import", lprocfs_rd_import, 0, 0 }, { "state", lprocfs_rd_state, 0, 0 }, { "changelog", 0, 0, 0, &mdc_changelog_fops, 0400 }, - { "netlink", 0, mdc_wr_netlink, 0, 0, 0222 }, { 0 } }; diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 6693f75..994a5c5 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1101,49 +1101,6 @@ out: return rc; } -static int do_set_info_async(struct obd_export *exp, - obd_count keylen, void *key, - obd_count vallen, void *val, - struct ptlrpc_request_set *set) -{ - struct obd_import *imp = class_exp2cliimp(exp); - struct ptlrpc_request *req; - char *tmp; - int rc; - ENTRY; - - req = ptlrpc_request_alloc(imp, &RQF_MDS_SET_INFO); - if (req == NULL) - RETURN(-ENOMEM); - - req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY, - RCL_CLIENT, keylen); - req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_VAL, - RCL_CLIENT, vallen); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_SET_INFO); - if (rc) { - ptlrpc_request_free(req); - RETURN(rc); - } - - tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY); - memcpy(tmp, key, keylen); - tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_VAL); - memcpy(tmp, val, vallen); - - ptlrpc_request_set_replen(req); - - if (set) { - ptlrpc_set_add_req(set, req); - ptlrpc_check_set(NULL, set); - } else { - rc = ptlrpc_queue_wait(req); - ptlrpc_req_finished(req); - } - - RETURN(rc); -} - int mdc_get_info_rpc(struct obd_export *exp, obd_count keylen, void *key, int vallen, void *val) @@ -1193,6 +1150,67 @@ int mdc_get_info_rpc(struct obd_export *exp, RETURN(rc); } +static void lustre_swab_hai(struct hsm_action_item *h) +{ + __swab32s(&h->hai_len); + __swab32s(&h->hai_action); + lustre_swab_lu_fid(&h->hai_fid); + __swab64s(&h->hai_cookie); + __swab64s(&h->hai_extent_start); + __swab64s(&h->hai_extent_end); + __swab64s(&h->hai_gid); +} + +static void lustre_swab_hal(struct hsm_action_list *h) +{ + struct hsm_action_item *hai; + int i; + + __swab32s(&h->hal_version); + __swab32s(&h->hal_count); + __swab32s(&h->hal_archive_num); + hai = hai_zero(h); + for (i = 0; i < h->hal_count; i++) { + lustre_swab_hai(hai); + hai = hai_next(hai); + } +} + +/** + * Send a message to any listening copytools, nonblocking + * @param val LNL message (lnl_hdr + hsm_action_list) + * @param len total length of message + */ +static int mdc_hsm_copytool_send(int len, void *val) +{ + struct lnl_hdr *lh = (struct lnl_hdr *)val; + struct hsm_action_list *hal = (struct hsm_action_list *)(lh + 1); + int rc; + ENTRY; + + if (len < sizeof(*lh) + sizeof(*hal)) { + CERROR("Short HSM message %d < %d\n", len, + sizeof(*lh) + sizeof(*hal)); + RETURN(-EPROTO); + } + if (lh->lnl_magic == __swab16(LNL_MAGIC)) { + lustre_swab_lnlh(lh); + lustre_swab_hal(hal); + } else if (lh->lnl_magic != LNL_MAGIC) { + CERROR("Bad magic %x!=%x\n", lh->lnl_magic, LNL_MAGIC); + RETURN(-EPROTO); + } + + CDEBUG(D_IOCTL, " Received message mg=%x t=%d m=%d l=%d actions=%d\n", + lh->lnl_magic, lh->lnl_transport, lh->lnl_msgtype, + lh->lnl_msglen, hal->hal_count); + + /* Broadcast to HSM listeners */ + rc = libcfs_klnl_msg_put(0, LNL_GRP_HSM, lh); + + RETURN(rc); +} + int mdc_set_info_async(struct obd_export *exp, obd_count keylen, void *key, obd_count vallen, void *val, @@ -1239,7 +1257,8 @@ int mdc_set_info_async(struct obd_export *exp, } spin_unlock(&imp->imp_lock); - rc = do_set_info_async(exp, keylen, key, vallen, val, set); + rc = target_set_info_rpc(imp, MDS_SET_INFO, + keylen, key, vallen, val, set); RETURN(rc); } if (KEY_IS(KEY_SPTLRPC_CONF)) { @@ -1251,8 +1270,6 @@ int mdc_set_info_async(struct obd_export *exp, RETURN(0); } if (KEY_IS(KEY_MDS_CONN)) { - struct obd_import *imp = class_exp2cliimp(exp); - /* mds-mds import */ spin_lock(&imp->imp_lock); imp->imp_server_timeout = 1; @@ -1262,7 +1279,12 @@ int mdc_set_info_async(struct obd_export *exp, RETURN(0); } if (KEY_IS(KEY_CHANGELOG_CLEAR)) { - rc = do_set_info_async(exp, keylen, key, vallen, val, set); + rc = target_set_info_rpc(imp, MDS_SET_INFO, + keylen, key, vallen, val, set); + RETURN(rc); + } + if (KEY_IS(KEY_HSM_COPYTOOL_SEND)) { + rc = mdc_hsm_copytool_send(vallen, val); RETURN(rc); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 6602382..e9ed811 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1105,6 +1105,7 @@ static int mdt_set_info(struct mdt_thread_info *info) vallen = req_capsule_get_size(info->mti_pill, &RMF_SETINFO_VAL, RCL_CLIENT); + /* Swab any part of val you need to here */ if (KEY_IS(KEY_READ_ONLY)) { req->rq_status = 0; lustre_msg_set_status(req->rq_repmsg, 0); @@ -2825,6 +2826,7 @@ static int mdt_msg_check_version(struct lustre_msg *msg) switch (lustre_msg_get_opc(msg)) { case MDS_CONNECT: case MDS_DISCONNECT: + case MDS_SET_INFO: case OBD_PING: case SEC_CTX_INIT: case SEC_CTX_INIT_CONT: @@ -2850,7 +2852,6 @@ static int mdt_msg_check_version(struct lustre_msg *msg) case MDS_SYNC: case MDS_GETXATTR: case MDS_SETXATTR: - case MDS_SET_INFO: case MDS_GET_INFO: case MDS_QUOTACHECK: case MDS_QUOTACTL: @@ -4928,7 +4929,7 @@ static int mdt_connect_internal(struct obd_export *exp, if (!mdt->mdt_som_conf) data->ocd_connect_flags &= ~OBD_CONNECT_SOM; - + spin_lock(&exp->exp_lock); exp->exp_connect_flags = data->ocd_connect_flags; spin_unlock(&exp->exp_lock); @@ -5567,6 +5568,62 @@ int mdt_obd_postrecov(struct obd_device *obd) return rc; } +/** + * Send a copytool req to a client + * Note this sends a request RPC from a server (MDT) to a client (MDC), + * backwards of normal comms. + */ +int mdt_hsm_copytool_send(struct obd_export *exp) +{ + struct lnl_hdr *lh; + struct hsm_action_list *hal; + struct hsm_action_item *hai; + int rc, len; + ENTRY; + + CWARN("%s: writing to mdc at %s\n", exp->exp_obd->obd_name, + libcfs_nid2str(exp->exp_connection->c_peer.nid)); + + len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN + + /* for mockup below */ 2 * size_round(sizeof(*hai)); + OBD_ALLOC(lh, len); + if (lh == NULL) + RETURN(-ENOMEM); + + lh->lnl_magic = LNL_MAGIC; + lh->lnl_transport = LNL_TRANSPORT_HSM; + lh->lnl_msgtype = HMT_ACTION_LIST; + lh->lnl_msglen = len; + + hal = (struct hsm_action_list *)(lh + 1); + hal->hal_version = HAL_VERSION; + hal->hal_archive_num = 1; + obd_uuid2fsname(hal->hal_fsname, exp->exp_obd->obd_name, + MTI_NAME_MAXLEN); + + /* mock up an action list */ + hal->hal_count = 2; + hai = hai_zero(hal); + hai->hai_action = HSMA_ARCHIVE; + hai->hai_fid.f_oid = 0xA00A; + hai->hai_len = sizeof(*hai); + hai = hai_next(hai); + hai->hai_action = HSMA_RESTORE; + hai->hai_fid.f_oid = 0xB00B; + hai->hai_len = sizeof(*hai); + + /* Uses the ldlm reverse import; this rpc will be seen by + the ldlm_callback_handler */ + rc = target_set_info_rpc(exp->exp_imp_reverse, LDLM_SET_INFO, + sizeof(KEY_HSM_COPYTOOL_SEND), + KEY_HSM_COPYTOOL_SEND, + len, lh, NULL); + + OBD_FREE(lh, len); + + RETURN(rc); +} + static struct obd_ops mdt_obd_device_ops = { .o_owner = THIS_MODULE, .o_set_info_async = mdt_obd_set_info_async, @@ -5770,7 +5827,8 @@ static void __exit mdt_mod_exit(void) static struct mdt_handler mdt_mds_ops[] = { DEF_MDT_HNDL_F(0, CONNECT, mdt_connect), DEF_MDT_HNDL_F(0, DISCONNECT, mdt_disconnect), -DEF_MDT_HNDL_F(0, SET_INFO, mdt_set_info), +DEF_MDT_HNDL (0, SET_INFO, mdt_set_info, + &RQF_OBD_SET_INFO), DEF_MDT_HNDL_F(0, GET_INFO, mdt_get_info), DEF_MDT_HNDL_F(0 |HABEO_REFERO, GETSTATUS, mdt_getstatus), DEF_MDT_HNDL_F(HABEO_CORPUS, GETATTR, mdt_getattr), diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index ef19cc5..fa2205b 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -768,6 +768,7 @@ static inline struct lu_name *mdt_name_copy(struct lu_name *tlname, void mdt_enable_cos(struct mdt_device *, int); int mdt_cos_is_enabled(struct mdt_device *); +int mdt_hsm_copytool_send(struct obd_export *exp); /* lprocfs stuff */ void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars); diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 39285bc..23624be 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -599,7 +599,7 @@ static int lprocfs_wr_nosquash_nids(struct file *file, const char *buffer, GOTO(failed, rc = -EFAULT); } kernbuf[count] = '\0'; - + if (!strcmp(kernbuf, "NONE") || !strcmp(kernbuf, "clear")) { /* empty string is special case */ down_write(&mdt->mdt_squash_sem); @@ -726,6 +726,30 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer, return count; } +/* Temporary; for testing purposes only */ +static int lprocfs_mdt_wr_mdc(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct obd_device *obd = data; + struct obd_export *exp = NULL; + struct obd_uuid uuid; + char tmpbuf[sizeof(struct obd_uuid)]; + + sscanf(buffer, "%40s", tmpbuf); + + obd_str2uuid(&uuid, tmpbuf); + exp = lustre_hash_lookup(obd->obd_uuid_hash, &uuid); + if (exp == NULL) { + CERROR("%s: no export %s found\n", + obd->obd_name, obd_uuid2str(&uuid)); + } else { + mdt_hsm_copytool_send(exp); + class_export_put(exp); + } + + return count; +} + static struct lprocfs_vars lprocfs_mdt_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 }, @@ -754,9 +778,10 @@ static struct lprocfs_vars lprocfs_mdt_obd_vars[] = { { "root_squash", lprocfs_rd_root_squash, lprocfs_wr_root_squash, 0 }, { "nosquash_nids", lprocfs_rd_nosquash_nids, - lprocfs_wr_nosquash_nids, 0 }, + lprocfs_wr_nosquash_nids, 0 }, { "som", lprocfs_rd_mdt_som, lprocfs_wr_mdt_som, 0 }, + { "mdccomm", 0, lprocfs_mdt_wr_mdc, 0 }, { 0 } }; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index a1c16a8..71e8402 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2190,7 +2190,7 @@ static int brw_interpret(const struct lu_env *env, int i; for (i = 0; i < aa->aa_page_count; i++) osc_release_write_grant(aa->aa_cli, aa->aa_ppga[i], 1); - + if (aa->aa_oa->o_flags & OBD_FL_TEMPORARY) OBDO_FREE(aa->aa_oa); } @@ -3442,11 +3442,11 @@ static int osc_statfs_interpret(const struct lu_env *env, cli->cl_oscc.oscc_flags &= ~(OSCC_FLAG_RDONLY | OSCC_FLAG_DEGRADED); if (msfs->os_state & OS_STATE_DEGRADED) cli->cl_oscc.oscc_flags |= OSCC_FLAG_DEGRADED; - + if (msfs->os_state & OS_STATE_READONLY) cli->cl_oscc.oscc_flags |= OSCC_FLAG_RDONLY; spin_unlock(&cli->cl_oscc.oscc_lock); - + *aa->aa_oi->oi_osfs = *msfs; out: rc = aa->aa_oi->oi_cb_up(aa->aa_oi, rc); @@ -3916,7 +3916,7 @@ static int osc_set_info_async(struct obd_export *exp, obd_count keylen, if (KEY_IS(KEY_GRANT_SHRINK)) req = ptlrpc_request_alloc(imp, &RQF_OST_SET_GRANT_INFO); else - req = ptlrpc_request_alloc(imp, &RQF_OST_SET_INFO); + req = ptlrpc_request_alloc(imp, &RQF_OBD_SET_INFO); if (req == NULL) RETURN(-ENOMEM); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index faf551d..4345342 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -218,7 +218,7 @@ static int ost_create(struct obd_export *exp, struct ptlrpc_request *req, sizeof(*repbody)); memcpy(&repbody->oa, &body->oa, sizeof(body->oa)); oti->oti_logcookies = &repbody->oa.o_lcookie; - + req->rq_status = obd_create(exp, &repbody->oa, NULL, oti); //obd_log_cancel(conn, NULL, 1, oti->oti_logcookies, 0); RETURN(0); @@ -2045,7 +2045,7 @@ int ost_handle(struct ptlrpc_request *req) break; case OST_SET_INFO: DEBUG_REQ(D_INODE, req, "set_info"); - req_capsule_set(&req->rq_pill, &RQF_OST_SET_INFO); + req_capsule_set(&req->rq_pill, &RQF_OBD_SET_INFO); rc = ost_set_info(req->rq_export, req); break; case OST_GET_INFO: diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 0400522..63475e2 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -280,7 +280,7 @@ static const struct req_msg_field *obd_connect_server[] = { &RMF_CONNECT_DATA }; -static const struct req_msg_field *mds_set_info_client[] = { +static const struct req_msg_field *obd_set_info_client[] = { &RMF_PTLRPC_BODY, &RMF_SETINFO_KEY, &RMF_SETINFO_VAL @@ -501,12 +501,6 @@ static const struct req_msg_field *ost_brw_server[] = { &RMF_NIOBUF_REMOTE }; -static const struct req_msg_field *ost_set_info_client[] = { - &RMF_PTLRPC_BODY, - &RMF_SETINFO_KEY, - &RMF_SETINFO_VAL -}; - static const struct req_msg_field *ost_get_info_generic_server[] = { &RMF_PTLRPC_BODY, &RMF_GENERIC_DATA, @@ -535,6 +529,7 @@ static const struct req_msg_field *ost_get_fiemap_server[] = { static const struct req_format *req_formats[] = { &RQF_OBD_PING, + &RQF_OBD_SET_INFO, &RQF_SEC_CTX, &RQF_MGS_TARGET_REG, &RQF_MGS_SET_INFO, @@ -542,7 +537,6 @@ static const struct req_format *req_formats[] = { &RQF_FLD_QUERY, &RQF_MDS_CONNECT, &RQF_MDS_DISCONNECT, - &RQF_MDS_SET_INFO, &RQF_MDS_GET_INFO, &RQF_MDS_GETSTATUS, &RQF_MDS_STATFS, @@ -585,7 +579,6 @@ static const struct req_format *req_formats[] = { &RQF_OST_DESTROY, &RQF_OST_BRW, &RQF_OST_STATFS, - &RQF_OST_SET_INFO, &RQF_OST_SET_GRANT_INFO, &RQF_OST_GET_INFO_GENERIC, &RQF_OST_GET_INFO_LAST_ID, @@ -908,6 +901,10 @@ const struct req_format RQF_OBD_PING = DEFINE_REQ_FMT0("OBD_PING", empty, empty); EXPORT_SYMBOL(RQF_OBD_PING); +const struct req_format RQF_OBD_SET_INFO = + DEFINE_REQ_FMT0("OBD_SET_INFO", obd_set_info_client, empty); +EXPORT_SYMBOL(RQF_OBD_SET_INFO); + const struct req_format RQF_SEC_CTX = DEFINE_REQ_FMT0("SEC_CTX", empty, empty); EXPORT_SYMBOL(RQF_SEC_CTX); @@ -1052,10 +1049,6 @@ const struct req_format RQF_MDS_DISCONNECT = DEFINE_REQ_FMT0("MDS_DISCONNECT", empty, empty); EXPORT_SYMBOL(RQF_MDS_DISCONNECT); -const struct req_format RQF_MDS_SET_INFO = - DEFINE_REQ_FMT0("MDS_SET_INFO", mds_set_info_client, empty); -EXPORT_SYMBOL(RQF_MDS_SET_INFO); - const struct req_format RQF_MDS_GET_INFO = DEFINE_REQ_FMT0("MDS_GET_INFO", mds_getinfo_client, mds_getinfo_server); @@ -1232,12 +1225,8 @@ const struct req_format RQF_OST_STATFS = DEFINE_REQ_FMT0("OST_STATFS", empty, obd_statfs_server); EXPORT_SYMBOL(RQF_OST_STATFS); -const struct req_format RQF_OST_SET_INFO = - DEFINE_REQ_FMT0("OST_SET_INFO", ost_set_info_client, empty); -EXPORT_SYMBOL(RQF_OST_SET_INFO); - const struct req_format RQF_OST_SET_GRANT_INFO = - DEFINE_REQ_FMT0("OST_SET_GRANT_INFO", ost_set_info_client, + DEFINE_REQ_FMT0("OST_SET_GRANT_INFO", obd_set_info_client, ost_body_only); EXPORT_SYMBOL(RQF_OST_SET_GRANT_INFO); diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index f1b9972..7334696 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -100,6 +100,7 @@ struct ll_rpc_opcode { { LDLM_BL_CALLBACK, "ldlm_bl_callback" }, { LDLM_CP_CALLBACK, "ldlm_cp_callback" }, { LDLM_GL_CALLBACK, "ldlm_gl_callback" }, + { LDLM_SET_INFO, "ldlm_set_info" }, { MGS_CONNECT, "mgs_connect" }, { MGS_DISCONNECT, "mgs_disconnect" }, { MGS_EXCEPTION, "mgs_exception" }, diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 790f861..5ced28f 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -65,7 +65,7 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux lin3 2.6.18-128.1.1-prep #1 SMP Wed Mar 4 23:08:37 MST 2009 i686 i686 i38 + * running on Linux cfs21 2.6.18-92.el5xen #1 SMP Tue Jun 10 19:55:54 EDT 2008 i686 i686 i386 * with gcc version 4.1.2 20071124 (Red Hat 4.1.2-42) */ @@ -232,7 +232,9 @@ void lustre_assert_wire_constants(void) (long long)LDLM_CP_CALLBACK); LASSERTF(LDLM_GL_CALLBACK == 106, " found %lld\n", (long long)LDLM_GL_CALLBACK); - LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n", + LASSERTF(LDLM_SET_INFO == 107, " found %lld\n", + (long long)LDLM_SET_INFO); + LASSERTF(LDLM_LAST_OPC == 108, " found %lld\n", (long long)LDLM_LAST_OPC); LASSERTF(LCK_EX == 1, " found %lld\n", (long long)LCK_EX); @@ -645,19 +647,19 @@ void lustre_assert_wire_constants(void) CLASSERT(OBD_MD_FLXATTRLS == (0x0000002000000000ULL)); CLASSERT(OBD_MD_FLXATTRRM == (0x0000004000000000ULL)); CLASSERT(OBD_MD_FLACL == (0x0000008000000000ULL)); - CLASSERT(OBD_FL_INLINEDATA == (0x00000001)); - CLASSERT(OBD_FL_OBDMDEXISTS == (0x00000002)); - CLASSERT(OBD_FL_DELORPHAN == (0x00000004)); - CLASSERT(OBD_FL_NORPC == (0x00000008)); - CLASSERT(OBD_FL_IDONLY == (0x00000010)); - CLASSERT(OBD_FL_RECREATE_OBJS == (0x00000020)); - CLASSERT(OBD_FL_DEBUG_CHECK == (0x00000040)); - CLASSERT(OBD_FL_NO_USRQUOTA == (0x00000100)); - CLASSERT(OBD_FL_NO_GRPQUOTA == (0x00000200)); - CLASSERT(OBD_FL_TRUNCLOCK == (0x00000800)); - CLASSERT(OBD_FL_CKSUM_CRC32 == (0x00001000)); - CLASSERT(OBD_FL_CKSUM_ADLER == (0x00002000)); - CLASSERT(OBD_FL_SHRINK_GRANT == (0x00020000)); + CLASSERT(OBD_FL_INLINEDATA == 1); + CLASSERT(OBD_FL_OBDMDEXISTS == 2); + CLASSERT(OBD_FL_DELORPHAN == 4); + CLASSERT(OBD_FL_NORPC == 8); + CLASSERT(OBD_FL_IDONLY == 16); + CLASSERT(OBD_FL_RECREATE_OBJS == 32); + CLASSERT(OBD_FL_DEBUG_CHECK == 64); + CLASSERT(OBD_FL_NO_USRQUOTA == 256); + CLASSERT(OBD_FL_NO_GRPQUOTA == 512); + CLASSERT(OBD_FL_TRUNCLOCK == 2048); + CLASSERT(OBD_FL_CKSUM_CRC32 == 4096); + CLASSERT(OBD_FL_CKSUM_ADLER == 8192); + CLASSERT(OBD_FL_SHRINK_GRANT == 131072); CLASSERT(OBD_CKSUM_CRC32 == 1); CLASSERT(OBD_CKSUM_ADLER == 2); @@ -2495,16 +2497,17 @@ void lustre_assert_wire_constants(void) /* Checks for struct link_ea_entry */ LASSERTF((int)sizeof(struct link_ea_entry) == 20, " found %lld\n", (long long)(int)sizeof(struct link_ea_entry)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 0, " found %lld\n", - (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); - LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 16, " found %lld\n", - (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); LASSERTF((int)offsetof(struct link_ea_entry, lee_reclen) == 16, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_reclen)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_reclen) == 2, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_reclen)); + LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 0, " found %lld\n", + (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); + LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); LASSERTF((int)offsetof(struct link_ea_entry, lee_name) == 20, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_name)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_name) == 0, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_name)); } + diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 793f8c1..8a59744 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6383,11 +6383,13 @@ test_162() { run_test 162 "path lookup sanity" test_163() { - copytool --test || { skip "copytool test: $? 38=enosys" && return; } + remote_mds_nodsh && skip "remote MDS with nodsh" && return + copytool --test || { skip "copytool not runnable: $?" && return; } copytool & sleep 1 + local uuid=$($LCTL get_param -n mdc.lustre-MDT0000-mdc-*.uuid) # this proc file is temporary and linux-only - $LCTL set_param mdc.lustre-MDT0000-mdc-*.netlink=0 || error "lnl send failed" + do_facet mds lctl set_param mdt.lustre-MDT0000.mdccomm=$uuid || error "lnl send failed" kill $! } run_test 163 "LustreNetLink kernelcomms" diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 99543bd..f658c5e 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -294,19 +294,19 @@ check_obdo(void) CHECK_CDEFINE(OBD_MD_FLXATTRRM); CHECK_CDEFINE(OBD_MD_FLACL); - CHECK_CDEFINE(OBD_FL_INLINEDATA); - CHECK_CDEFINE(OBD_FL_OBDMDEXISTS); - CHECK_CDEFINE(OBD_FL_DELORPHAN); - CHECK_CDEFINE(OBD_FL_NORPC); - CHECK_CDEFINE(OBD_FL_IDONLY); - CHECK_CDEFINE(OBD_FL_RECREATE_OBJS); - CHECK_CDEFINE(OBD_FL_DEBUG_CHECK); - CHECK_CDEFINE(OBD_FL_NO_USRQUOTA); - CHECK_CDEFINE(OBD_FL_NO_GRPQUOTA); - CHECK_CDEFINE(OBD_FL_TRUNCLOCK); - CHECK_CDEFINE(OBD_FL_CKSUM_CRC32); - CHECK_CDEFINE(OBD_FL_CKSUM_ADLER); - CHECK_CDEFINE(OBD_FL_SHRINK_GRANT); + CHECK_CVALUE(OBD_FL_INLINEDATA); + CHECK_CVALUE(OBD_FL_OBDMDEXISTS); + CHECK_CVALUE(OBD_FL_DELORPHAN); + CHECK_CVALUE(OBD_FL_NORPC); + CHECK_CVALUE(OBD_FL_IDONLY); + CHECK_CVALUE(OBD_FL_RECREATE_OBJS); + CHECK_CVALUE(OBD_FL_DEBUG_CHECK); + CHECK_CVALUE(OBD_FL_NO_USRQUOTA); + CHECK_CVALUE(OBD_FL_NO_GRPQUOTA); + CHECK_CVALUE(OBD_FL_TRUNCLOCK); + CHECK_CVALUE(OBD_FL_CKSUM_CRC32); + CHECK_CVALUE(OBD_FL_CKSUM_ADLER); + CHECK_CVALUE(OBD_FL_SHRINK_GRANT); CHECK_CVALUE(OBD_CKSUM_CRC32); CHECK_CVALUE(OBD_CKSUM_ADLER); } @@ -484,15 +484,6 @@ check_ll_fid(void) } static void -check_lu_fid_pack(void) -{ - BLANK_LINE(); - CHECK_STRUCT(lu_fid_pack); - CHECK_MEMBER(lu_fid_pack, fp_len); - CHECK_MEMBER(lu_fid_pack, fp_area); -} - -static void check_mds_status_req(void) { BLANK_LINE(); @@ -1392,6 +1383,7 @@ main(int argc, char **argv) CHECK_VALUE(LDLM_BL_CALLBACK); CHECK_VALUE(LDLM_CP_CALLBACK); CHECK_VALUE(LDLM_GL_CALLBACK); + CHECK_VALUE(LDLM_SET_INFO); CHECK_VALUE(LDLM_LAST_OPC); CHECK_VALUE(LCK_EX); @@ -1441,7 +1433,6 @@ main(int argc, char **argv) check_niobuf_remote(); check_ost_body(); check_ll_fid(); - check_lu_fid_pack(); check_mds_status_req(); check_mds_body(); check_mds_rec_setattr(); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index bebd1f4b..22d7e10 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -62,7 +62,7 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux lin3 2.6.18-128.1.1-prep #1 SMP Wed Mar 4 23:08:37 MST 2009 i686 i686 i38 + * running on Linux cfs21 2.6.18-92.el5xen #1 SMP Tue Jun 10 19:55:54 EDT 2008 i686 i686 i386 * with gcc version 4.1.2 20071124 (Red Hat 4.1.2-42) */ @@ -229,7 +229,9 @@ void lustre_assert_wire_constants(void) (long long)LDLM_CP_CALLBACK); LASSERTF(LDLM_GL_CALLBACK == 106, " found %lld\n", (long long)LDLM_GL_CALLBACK); - LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n", + LASSERTF(LDLM_SET_INFO == 107, " found %lld\n", + (long long)LDLM_SET_INFO); + LASSERTF(LDLM_LAST_OPC == 108, " found %lld\n", (long long)LDLM_LAST_OPC); LASSERTF(LCK_EX == 1, " found %lld\n", (long long)LCK_EX); @@ -642,19 +644,19 @@ void lustre_assert_wire_constants(void) CLASSERT(OBD_MD_FLXATTRLS == (0x0000002000000000ULL)); CLASSERT(OBD_MD_FLXATTRRM == (0x0000004000000000ULL)); CLASSERT(OBD_MD_FLACL == (0x0000008000000000ULL)); - CLASSERT(OBD_FL_INLINEDATA == (0x00000001)); - CLASSERT(OBD_FL_OBDMDEXISTS == (0x00000002)); - CLASSERT(OBD_FL_DELORPHAN == (0x00000004)); - CLASSERT(OBD_FL_NORPC == (0x00000008)); - CLASSERT(OBD_FL_IDONLY == (0x00000010)); - CLASSERT(OBD_FL_RECREATE_OBJS == (0x00000020)); - CLASSERT(OBD_FL_DEBUG_CHECK == (0x00000040)); - CLASSERT(OBD_FL_NO_USRQUOTA == (0x00000100)); - CLASSERT(OBD_FL_NO_GRPQUOTA == (0x00000200)); - CLASSERT(OBD_FL_TRUNCLOCK == (0x00000800)); - CLASSERT(OBD_FL_CKSUM_CRC32 == (0x00001000)); - CLASSERT(OBD_FL_CKSUM_ADLER == (0x00002000)); - CLASSERT(OBD_FL_SHRINK_GRANT == (0x00020000)); + CLASSERT(OBD_FL_INLINEDATA == 1); + CLASSERT(OBD_FL_OBDMDEXISTS == 2); + CLASSERT(OBD_FL_DELORPHAN == 4); + CLASSERT(OBD_FL_NORPC == 8); + CLASSERT(OBD_FL_IDONLY == 16); + CLASSERT(OBD_FL_RECREATE_OBJS == 32); + CLASSERT(OBD_FL_DEBUG_CHECK == 64); + CLASSERT(OBD_FL_NO_USRQUOTA == 256); + CLASSERT(OBD_FL_NO_GRPQUOTA == 512); + CLASSERT(OBD_FL_TRUNCLOCK == 2048); + CLASSERT(OBD_FL_CKSUM_CRC32 == 4096); + CLASSERT(OBD_FL_CKSUM_ADLER == 8192); + CLASSERT(OBD_FL_SHRINK_GRANT == 131072); CLASSERT(OBD_CKSUM_CRC32 == 1); CLASSERT(OBD_CKSUM_ADLER == 2); @@ -2492,14 +2494,14 @@ void lustre_assert_wire_constants(void) /* Checks for struct link_ea_entry */ LASSERTF((int)sizeof(struct link_ea_entry) == 20, " found %lld\n", (long long)(int)sizeof(struct link_ea_entry)); - LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 0, " found %lld\n", - (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); - LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 16, " found %lld\n", - (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); LASSERTF((int)offsetof(struct link_ea_entry, lee_reclen) == 16, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_reclen)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_reclen) == 2, " found %lld\n", (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_reclen)); + LASSERTF((int)offsetof(struct link_ea_entry, lee_parent_fid) == 0, " found %lld\n", + (long long)(int)offsetof(struct link_ea_entry, lee_parent_fid)); + LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct link_ea_entry *)0)->lee_parent_fid)); LASSERTF((int)offsetof(struct link_ea_entry, lee_name) == 20, " found %lld\n", (long long)(int)offsetof(struct link_ea_entry, lee_name)); LASSERTF((int)sizeof(((struct link_ea_entry *)0)->lee_name) == 0, " found %lld\n",