]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] relayfs: remove warning printk() in relay_switch_subbuf()
authorTom Zanussi <zanussi@us.ibm.com>
Tue, 20 Dec 2005 19:10:22 +0000 (13:10 -0600)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 21 Dec 2005 01:33:22 +0000 (17:33 -0800)
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>
fs/relayfs/relay.c
include/linux/relayfs_fs.h

index 16446a15c96d956d84d83859a0660f4a8736bc29..2a6f7f12b7f9458a96f19be651f1d05bbef4f601 100644 (file)
@@ -333,8 +333,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)
        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);
 }
 
index cfafc3e76bc2bb2faaaa012fd0d27b17d90e10a5..fb7e8073732583515c2b41843e1c691848cbd98e 100644 (file)
@@ -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 */
 };