X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Flnet%2Flib-msg.c;h=8fed27fa7b1e98ccba9635d76a2bacbddc505443;hp=5f988bef5bf4efee78a2e783b2d14750636add29;hb=5c17777d97bd20cde68771c6186320b5eae90e62;hpb=826ea19c077b2a3e1a32464a7eb63fba6e460946 diff --git a/lnet/lnet/lib-msg.c b/lnet/lnet/lib-msg.c index 5f988be..8fed27f 100644 --- a/lnet/lnet/lib-msg.c +++ b/lnet/lnet/lib-msg.c @@ -817,6 +817,30 @@ lnet_health_error2str(enum lnet_msg_hstatus hstatus) } } +bool +lnet_send_error_simulation(struct lnet_msg *msg, + enum lnet_msg_hstatus *hstatus) +{ + if (!msg) + return false; + + if (list_empty(&the_lnet.ln_drop_rules)) + return false; + + /* match only health rules */ + if (!lnet_drop_rule_match(&msg->msg_hdr, hstatus)) + return false; + + CDEBUG(D_NET, "src %s, dst %s: %s simulate health error: %s\n", + libcfs_nid2str(msg->msg_hdr.src_nid), + libcfs_nid2str(msg->msg_hdr.dest_nid), + lnet_msgtyp2str(msg->msg_type), + lnet_health_error2str(*hstatus)); + + return true; +} +EXPORT_SYMBOL(lnet_send_error_simulation); + void lnet_finalize(struct lnet_msg *msg, int status) {