[patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-09-18 Thread Mathieu Desnoyers
A race that appears both in /proc/modules and in kallsyms: if, between the seq file reads, the process is put to sleep and at this moment a module is or removed from the module list, the listing will skip an amount of modules/symbols corresponding to the amount of elements present in the unloaded m

[patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-09-17 Thread Mathieu Desnoyers
A race that appears both in /proc/modules and in kallsyms: if, between the seq file reads, the process is put to sleep and at this moment a module is or removed from the module list, the listing will skip an amount of modules/symbols corresponding to the amount of elements present in the unloaded m

[patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-09-06 Thread Mathieu Desnoyers
A race that appears both in /proc/modules and in kallsyms: if, between the seq file reads, the process is put to sleep and at this moment a module is or removed from the module list, the listing will skip an amount of modules/symbols corresponding to the amount of elements present in the unloaded m

[patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-27 Thread Mathieu Desnoyers
A race that appears both in /proc/modules and in kallsyms: if, between the seq file reads, the process is put to sleep and at this moment a module is or removed from the module list, the listing will skip an amount of modules/symbols corresponding to the amount of elements present in the unloaded m

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-25 Thread Mathieu Desnoyers
* Rusty Russell ([EMAIL PROTECTED]) wrote: > On Fri, 2007-08-24 at 11:45 -0400, Mathieu Desnoyers wrote: > > * Rusty Russell ([EMAIL PROTECTED]) wrote: > > > On Mon, 2007-08-20 at 16:26 -0400, Mathieu Desnoyers wrote: > > > > plain text document attachment (module.c-sort-module-list.patch) > > > >

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-25 Thread Rusty Russell
On Fri, 2007-08-24 at 11:45 -0400, Mathieu Desnoyers wrote: > * Rusty Russell ([EMAIL PROTECTED]) wrote: > > On Mon, 2007-08-20 at 16:26 -0400, Mathieu Desnoyers wrote: > > > plain text document attachment (module.c-sort-module-list.patch) > > > A race that appears both in /proc/modules and in kall

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-24 Thread Mathieu Desnoyers
* Rusty Russell ([EMAIL PROTECTED]) wrote: > On Mon, 2007-08-20 at 16:26 -0400, Mathieu Desnoyers wrote: > > plain text document attachment (module.c-sort-module-list.patch) > > A race that appears both in /proc/modules and in kallsyms: if, between the > > seq file reads, the process is put to slee

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-20 Thread Rusty Russell
On Mon, 2007-08-20 at 16:26 -0400, Mathieu Desnoyers wrote: > plain text document attachment (module.c-sort-module-list.patch) > A race that appears both in /proc/modules and in kallsyms: if, between the > seq file reads, the process is put to sleep and at this moment a module is > or removed from

[patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-20 Thread Mathieu Desnoyers
A race that appears both in /proc/modules and in kallsyms: if, between the seq file reads, the process is put to sleep and at this moment a module is or removed from the module list, the listing will skip an amount of modules/symbols corresponding to the amount of elements present in the unloaded m

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-18 Thread Mathieu Desnoyers
* Fengguang Wu ([EMAIL PROTECTED]) wrote: > Al Viro, > > Does this sounds like a good fix? > === > > seq_file version fixes > > - f_version is 'unsigned long', it's pointless to do more than that. Hrm, this is weird... fs.h: struct inode u64 i_version; and struct file

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-15 Thread Fengguang Wu
Al Viro, Does this sounds like a good fix? === seq_file version fixes - f_version is 'unsigned long', it's pointless to do more than that. - m->version should not be reset when we are bumping up the buf size. Signed-off-by: Fengguang Wu <[EMAIL PROTECTED]> --- fs/seq_file.c|1 -

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-15 Thread Fengguang Wu
On Wed, Aug 15, 2007 at 07:53:01AM +0100, Al Viro wrote: > On Wed, Aug 15, 2007 at 02:37:41PM +0800, Fengguang Wu wrote: > > static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos) > > { > > loff_t *spos = (loff_t *) v; > > *pos = ++(*spos); > > return spos; > > }

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-14 Thread Al Viro
On Wed, Aug 15, 2007 at 02:37:41PM +0800, Fengguang Wu wrote: > static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos) > { > loff_t *spos = (loff_t *) v; > *pos = ++(*spos); > return spos; > } > > I mean 'pos' is sometimes increased in ct_seq_next(), and sometim

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-14 Thread Fengguang Wu
On Wed, Aug 15, 2007 at 05:18:45AM +0100, Al Viro wrote: >> On Wed, Aug 15, 2007 at 11:39:45AM +0800, Fengguang Wu wrote: >> seqfile: remove seq_file's assumption about iterators >> >> The seq_file implementation has some hardcoded index++/pos++ lines, >> which assumes iterators to be *continuous*

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-14 Thread Al Viro
On Wed, Aug 15, 2007 at 11:39:45AM +0800, Fengguang Wu wrote: > On Sun, Aug 12, 2007 at 11:08:46AM -0400, Mathieu Desnoyers wrote: > > > > static void *m_next(struct seq_file *m, void *p, loff_t *pos) > > { > > - return seq_list_next(p, &modules, pos); > > + return seq_sorted_list_next(p, &

Re: [patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-14 Thread Fengguang Wu
On Sun, Aug 12, 2007 at 11:08:46AM -0400, Mathieu Desnoyers wrote: > > static void *m_next(struct seq_file *m, void *p, loff_t *pos) > { > - return seq_list_next(p, &modules, pos); > + return seq_sorted_list_next(p, &modules, &m->private); > } In theory it is not safe to use something

[patch 2/2] Sort module list by pointer address to get coherent sleepable seq_file iterators

2007-08-12 Thread Mathieu Desnoyers
A race that appears both in /proc/modules and in kallsyms: if, between the seq file reads, the process is put to sleep and at this moment a module is or removed from the module list, the listing will skip an amount of modules/symbols corresponding to the amount of elements present in the unloaded m