Skip to contentSkip to conversation

lockd: ratelimit "lockd: cannot monitor" messages

PATCH In review Jeff Layton 4 participants 4 messages Oct 31, 2014 – Nov 6, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lockd: ratelimit "lockd: cannot monitor" messages

When lockd can't talk to a remote statd, it'll spew a warning message to the ring buffer. If the application is really hammering on locks however, it's possible for that message to spam the logs. Ratelimit it to minimize the potential for harm.

---
 fs/lockd/mon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lockd/mon.c +1 -1
index 9106f42c472c..1cc6ec51e6b1 100644
@@ -214,7 +214,7 @@ int nsm_monitor(const struct nlm_host *host)
 	if (unlikely(res.status != 0))
 		status = -EIO;
 	if (unlikely(status < 0)) {
-		printk(KERN_NOTICE "lockd: cannot monitor %s\n", nsm->sm_name);
+		pr_notice_ratelimited("lockd: cannot monitor %s\n", nsm->sm_name);
 		return status;
 	}
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 16 lines · Jeff Layton

When lockd can't talk to a remote statd, it'll spew a warning message to the ring buffer. If the application is really hammering on locks however, it's possible for that message to spam the logs. Ratelimit it to minimize the potential for harm.

---
 fs/lockd/mon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lockd/mon.c +0 -0
index 9106f42c472c..1cc6ec51e6b1 100644

fs/lockd/mon.c int nsm_monitor(const struct nlm_host *host) · line 220

Quoted 8 lines
fs/lockd/mon.c +1 -1
@@ -214,7 +214,7 @@ int nsm_monitor(const struct nlm_host *host)
        if (unlikely(res.status != 0))
                status = -EIO;
        if (unlikely(status < 0)) {
-               printk(KERN_NOTICE "lockd: cannot monitor %s\n", nsm->sm_name);
+               pr_notice_ratelimited("lockd: cannot monitor %s\n", nsm->sm_name);
                return status;
        }
 

How is this being triggered repeatedly? Normally, the 'cannot monitor' message should be happening at client mount time or not at all.

Signature · 5 lines
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
#2 lore raw
Quoted 12 lines · On Fri, 31 Oct 2014 14:36:16 +0200 Trond Myklebust…
Quoted 11 lines · Jeff Layton

When lockd can't talk to a remote statd, it'll spew a warning message to the ring buffer. If the application is really hammering on locks however, it's possible for that message to spam the logs. Ratelimit it to minimize the potential for harm.

---
 fs/lockd/mon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines

fs/lockd/mon.c int nsm_monitor(const struct nlm_host *host) · line 220

Quoted 13 lines
fs/lockd/mon.c +1 -1
index 9106f42c472c..1cc6ec51e6b1 100644
@@ -214,7 +214,7 @@ int nsm_monitor(const struct nlm_host *host)
        if (unlikely(res.status != 0))
                status = -EIO;
        if (unlikely(status < 0)) {
-               printk(KERN_NOTICE "lockd: cannot monitor %s\n", nsm->sm_name);
+               pr_notice_ratelimited("lockd: cannot monitor %s\n", nsm->sm_name);
                return status;
        }
 

How is this being triggered repeatedly? Normally, the 'cannot monitor' message should be happening at client mount time or not at all.

No, it's triggered on NLM lock activity. I don't think we really do much with NLM at mount time, do we? In any case, the bug was reported here:

    https://bugzilla.redhat.com/show_bug.cgi?id=1155232

In this case, it was an application that was apparently responding to ENOLCK errors by retrying the lock.

Signature · 1 line
Jeff Layton <[email protected]>
#3 lore raw
In reply to Jeff Layton
Quoted 4 lines · Jeff Layton

When lockd can't talk to a remote statd, it'll spew a warning message to the ring buffer. If the application is really hammering on locks however, it's possible for that message to spam the logs. Ratelimit it to minimize the potential for harm.

Thanks, applying for 3.19.--b.

Quoted 23 lines
---
 fs/lockd/mon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lockd/mon.c +1 -1
index 9106f42c472c..1cc6ec51e6b1 100644
@@ -214,7 +214,7 @@ int nsm_monitor(const struct nlm_host *host)
 	if (unlikely(res.status != 0))
 		status = -EIO;
 	if (unlikely(status < 0)) {
-		printk(KERN_NOTICE "lockd: cannot monitor %s\n", nsm->sm_name);
+		pr_notice_ratelimited("lockd: cannot monitor %s\n", nsm->sm_name);
 		return status;
 	}
 
Signature · 1 line
1.9.3