Re: [PATCH] proc/mounts: add cursor

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

 



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().




[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