aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2012-04-23 14:58:42 -0400
committerDavid Teigland <teigland@redhat.com>2012-04-26 16:37:37 -0400
commitd6e24788d21c4f1a8f00c811c31dd4e9a58679ac (patch)
tree03a41787c60082d3da5f5ef39734a3ae17b852fa /fs
parent13ef11110fa2173b9d03e6616574914e12e2a90f (diff)
dlm: limit rcom debug messages
Unify the checking for both types of ignored rcom messages, and replace the two log_debug statements with a single, rate limited debug message. Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/dlm_internal.h8
-rw-r--r--fs/dlm/rcom.c48
2 files changed, 28 insertions, 28 deletions
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 3a564d197e99..0e74832c021b 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -38,6 +38,7 @@
38#include <linux/miscdevice.h> 38#include <linux/miscdevice.h>
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/idr.h> 40#include <linux/idr.h>
41#include <linux/ratelimit.h>
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42 43
43#include <linux/dlm.h> 44#include <linux/dlm.h>
@@ -74,6 +75,13 @@ do { \
74 (ls)->ls_name , ##args); \ 75 (ls)->ls_name , ##args); \
75} while (0) 76} while (0)
76 77
78#define log_limit(ls, fmt, args...) \
79do { \
80 if (dlm_config.ci_log_debug) \
81 printk_ratelimited(KERN_DEBUG "dlm: %s: " fmt "\n", \
82 (ls)->ls_name , ##args); \
83} while (0)
84
77#define DLM_ASSERT(x, do) \ 85#define DLM_ASSERT(x, do) \
78{ \ 86{ \
79 if (!(x)) \ 87 if (!(x)) \
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index ac5c616c9696..6565fd5e28ef 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -486,47 +486,39 @@ int dlm_send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)
486 return 0; 486 return 0;
487} 487}
488 488
489static int is_old_reply(struct dlm_ls *ls, struct dlm_rcom *rc) 489/* Called by dlm_recv; corresponds to dlm_receive_message() but special
490 recovery-only comms are sent through here. */
491
492void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
490{ 493{
494 int lock_size = sizeof(struct dlm_rcom) + sizeof(struct rcom_lock);
495 int stop, reply = 0;
491 uint64_t seq; 496 uint64_t seq;
492 int rv = 0;
493 497
494 switch (rc->rc_type) { 498 switch (rc->rc_type) {
495 case DLM_RCOM_STATUS_REPLY: 499 case DLM_RCOM_STATUS_REPLY:
496 case DLM_RCOM_NAMES_REPLY: 500 case DLM_RCOM_NAMES_REPLY:
497 case DLM_RCOM_LOOKUP_REPLY: 501 case DLM_RCOM_LOOKUP_REPLY:
498 case DLM_RCOM_LOCK_REPLY: 502 case DLM_RCOM_LOCK_REPLY:
499 spin_lock(&ls->ls_recover_lock); 503 reply = 1;
500 seq = ls->ls_recover_seq; 504 };
501 spin_unlock(&ls->ls_recover_lock);
502 if (rc->rc_seq_reply != seq) {
503 log_debug(ls, "ignoring old reply %x from %d "
504 "seq_reply %llx expect %llx",
505 rc->rc_type, rc->rc_header.h_nodeid,
506 (unsigned long long)rc->rc_seq_reply,
507 (unsigned long long)seq);
508 rv = 1;
509 }
510 }
511 return rv;
512}
513 505
514/* Called by dlm_recv; corresponds to dlm_receive_message() but special 506 spin_lock(&ls->ls_recover_lock);
515 recovery-only comms are sent through here. */ 507 stop = test_bit(LSFL_RECOVERY_STOP, &ls->ls_flags);
516 508 seq = ls->ls_recover_seq;
517void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) 509 spin_unlock(&ls->ls_recover_lock);
518{
519 int lock_size = sizeof(struct dlm_rcom) + sizeof(struct rcom_lock);
520 510
521 if (dlm_recovery_stopped(ls) && (rc->rc_type != DLM_RCOM_STATUS)) { 511 if ((stop && (rc->rc_type != DLM_RCOM_STATUS)) ||
522 log_debug(ls, "ignoring recovery message %x from %d", 512 (reply && (rc->rc_seq_reply != seq))) {
523 rc->rc_type, nodeid); 513 log_limit(ls, "dlm_receive_rcom ignore msg %d "
514 "from %d %llu %llu seq %llu",
515 rc->rc_type, nodeid,
516 (unsigned long long)rc->rc_seq,
517 (unsigned long long)rc->rc_seq_reply,
518 (unsigned long long)seq);
524 goto out; 519 goto out;
525 } 520 }
526 521
527 if (is_old_reply(ls, rc))
528 goto out;
529
530 switch (rc->rc_type) { 522 switch (rc->rc_type) {
531 case DLM_RCOM_STATUS: 523 case DLM_RCOM_STATUS:
532 receive_rcom_status(ls, rc); 524 receive_rcom_status(ls, rc);