From: Tom Zanussi <zanussi@us.ibm.com>
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, compudj@krystal.dyndns.org
Subject: [PATCH] relayfs: remove warning printk() in relay_switch_subbuf()
Date: Tue, 20 Dec 2005 13:10:22 -0600 [thread overview]
Message-ID: <17320.22302.312403.942098@tut.ibm.com> (raw)
Hi,
There's currently a diagnostic printk in relay_switch_subbuf() meant
as a warning if you accidentally try to log an event larger than the
sub-buffer size. The problem is if this happens while logging from
somewhere it's not safe to be doing printks, such as in the scheduler,
you can end up with a deadlock. This patch removes the warning from
relay_switch_subbuf() and instead prints some diagnostic info when the
channel is closed.
Thanks to Mathieu Desnoyers for pointing out the problem and
suggesting a fix.
Tom
Signed-off-by: Tom Zanussi <zanussi@us.ibm.com>
diff --git a/fs/relayfs/relay.c b/fs/relayfs/relay.c
--- a/fs/relayfs/relay.c
+++ b/fs/relayfs/relay.c
@@ -333,8 +333,7 @@ size_t relay_switch_subbuf(struct rchan_
return length;
toobig:
- printk(KERN_WARNING "relayfs: event too large (%Zd)\n", length);
- WARN_ON(1);
+ buf->chan->last_toobig = length;
return 0;
}
@@ -399,6 +398,11 @@ void relay_close(struct rchan *chan)
relay_close_buf(chan->buf[i]);
}
+ if (chan->last_toobig)
+ printk(KERN_WARNING "relayfs: one or more items not logged "
+ "[item size (%Zd) > sub-buffer size (%Zd)]\n",
+ chan->last_toobig, chan->subbuf_size);
+
kref_put(&chan->kref, relay_destroy_channel);
}
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relayfs_fs.h
@@ -20,9 +20,9 @@
#include <linux/kref.h>
/*
- * Tracks changes to rchan_buf struct
+ * Tracks changes to rchan/rchan_buf structs
*/
-#define RELAYFS_CHANNEL_VERSION 5
+#define RELAYFS_CHANNEL_VERSION 6
/*
* Per-cpu relay channel buffer
@@ -60,6 +60,7 @@ struct rchan
struct rchan_callbacks *cb; /* client callbacks */
struct kref kref; /* channel refcount */
void *private_data; /* for user-defined data */
+ size_t last_toobig; /* tried to log event > subbuf size */
struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */
};
reply other threads:[~2005-12-20 18:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17320.22302.312403.942098@tut.ibm.com \
--to=zanussi@us.ibm.com \
--cc=akpm@osdl.org \
--cc=compudj@krystal.dyndns.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®