diff options
author | Tom Zanussi <zanussi@us.ibm.com> | 2005-12-20 14:10:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-20 20:33:22 -0500 |
commit | fd30fc3256824f03c2ff9317269d66f72f7042ca (patch) | |
tree | 863a1ba4ddae961e2727343c17d15f64c3f4d463 /fs/relayfs | |
parent | bb44f116a14c4c932f15c79acfafd46bcb43ca9a (diff) |
[PATCH] relayfs: remove warning printk() in relay_switch_subbuf()
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.
Signed-off-by: Tom Zanussi <zanussi@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/relayfs')
-rw-r--r-- | fs/relayfs/relay.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/relayfs/relay.c b/fs/relayfs/relay.c index 16446a15c96d..2a6f7f12b7f9 100644 --- a/fs/relayfs/relay.c +++ b/fs/relayfs/relay.c | |||
@@ -333,8 +333,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length) | |||
333 | return length; | 333 | return length; |
334 | 334 | ||
335 | toobig: | 335 | toobig: |
336 | printk(KERN_WARNING "relayfs: event too large (%Zd)\n", length); | 336 | buf->chan->last_toobig = length; |
337 | WARN_ON(1); | ||
338 | return 0; | 337 | return 0; |
339 | } | 338 | } |
340 | 339 | ||
@@ -399,6 +398,11 @@ void relay_close(struct rchan *chan) | |||
399 | relay_close_buf(chan->buf[i]); | 398 | relay_close_buf(chan->buf[i]); |
400 | } | 399 | } |
401 | 400 | ||
401 | if (chan->last_toobig) | ||
402 | printk(KERN_WARNING "relayfs: one or more items not logged " | ||
403 | "[item size (%Zd) > sub-buffer size (%Zd)]\n", | ||
404 | chan->last_toobig, chan->subbuf_size); | ||
405 | |||
402 | kref_put(&chan->kref, relay_destroy_channel); | 406 | kref_put(&chan->kref, relay_destroy_channel); |
403 | } | 407 | } |
404 | 408 | ||