On Thu, Apr 9, 2020 at 1:13 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Thu, Apr 09, 2020 at 11:18:58AM +0200, Miklos Szeredi wrote: > > @@ -1249,31 +1277,48 @@ struct vfsmount *mnt_clone_internal(cons > > static void *m_start(struct seq_file *m, loff_t *pos) > > { > > struct proc_mounts *p = m->private; > > + struct mount *mnt; > > > > down_read(&namespace_sem); > > - if (p->cached_event == p->ns->event) { > > - void *v = p->cached_mount; > > - if (*pos == p->cached_index) > > - return v; > > - if (*pos == p->cached_index + 1) { > > - v = seq_list_next(v, &p->ns->list, &p->cached_index); > > - return p->cached_mount = v; > > + lock_ns_list(p->ns); > > + if (!*pos) { > > + list_move(&p->cursor.mnt_list, &p->ns->list); > > + p->cursor_pos = 0; > > + } else if (p->cursor_pos != *pos) { > > + /* Non-zero seek. Could probably just return -ESPIPE... */ > > Umm, that's not how calling seek() on a seqfile works. I don't think > you can hit this case. Follow seq_lseek() as it calls traverse(). Ah, okay, f_pos is always a byte offset. That's wonderful, I can get rid of that wart. Thanks, Miklos