Re: [PATCH v3] proc/mounts: add cursor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 10, 2020 at 3:11 AM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Apr 09, 2020 at 11:22:14PM +0200, Miklos Szeredi wrote:
>
> > @@ -1249,42 +1277,50 @@ 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 = NULL;
> >
> >       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);
> > +     if (!list_empty(&p->cursor.mnt_list))
> > +             mnt = mnt_skip_cursors(p->ns, &p->cursor);
> > +     unlock_ns_list(p->ns);
>
> Huh?  What's that if (!list_empty()) about?  The case where we have reached
> the end of list, then did a read() with an lseek() in between?

Yes.  Also no need to move the cursor in m_start(), since we are going
to do it anyway in m_stop().

Posted v4.

Thanks,
Miklos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux