Messages in this thread | | | Date | Tue, 9 Oct 2007 02:30:11 +0100 | From | Al Viro <> | Subject | Re: [PATCH] lockdep: Avoid /proc/lockdep & lock_stat infinite output |
| |
On Mon, Oct 08, 2007 at 06:15:51PM -0700, Tim Pepper wrote: > > When a read() requests an amount of data smaller than the amount of data > that the seq_file's foo_show() outputs, the output starts looping and > outputs the "stuck" element's data infinitely. There may be multiple > sequential calls to foo_start(), foo_next()/foo_show(), and foo_stop() > for a single open with sequential read of the file. The _start() does not > have to start with the 0th element and _show() might be called multiple > times in a row for the same element for a given open/read of the seq_file. > > static void *l_start(struct seq_file *m, loff_t *pos) > { > - struct lock_class *class = m->private; > + struct lock_class *class; > + loff_t i = 0; > > - if (&class->lock_entry == all_lock_classes.next) > + if (*pos == 0) > seq_printf(m, "all lock classes:\n");
Do not generate output outside of ->show() and you won't have these problems. That's where your infinite output crap comes from.
IOW, NAK - fix the underlying problem. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |