All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Jerome Marchand <jmarchan@redhat.com>
Cc: Matthew Wilcox <matthew@wil.cx>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] procfs: fix numbering in /proc/locks
Date: Fri, 01 Oct 2010 11:13:50 +0400	[thread overview]
Message-ID: <4CA58A2E.2040806@parallels.com> (raw)
In-Reply-To: <4CA484BA.7090809@redhat.com>

On 09/30/2010 04:38 PM, Jerome Marchand wrote:
> 
> The lock number in /proc/locks (first field) is implemented by a counter
> (private field of struct seq_file) which is incremented at each call of
> locks_show() and reset to 1 in locks_start() whatever the offset is. It
> should be reset according to the actual position in the list.
> 
> Moreover, locks_show() can be called twice to print a single line thus
> skipping a number. The counter should be incremented in locks_next().
> 
> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>

Acked-by: Pavel Emelyanov <xemul@openvz.org>

> ---
>  locks.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index ab24d49..49d7343 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -2166,19 +2166,19 @@ static int locks_show(struct seq_file *f, void *v)
>  	list_for_each_entry(bfl, &fl->fl_block, fl_block)
>  		lock_get_status(f, bfl, (long)f->private, " ->");
>  
> -	f->private++;
>  	return 0;
>  }
>  
>  static void *locks_start(struct seq_file *f, loff_t *pos)
>  {
>  	lock_kernel();
> -	f->private = (void *)1;
> +	f->private = (void *) (*pos + 1);
>  	return seq_list_start(&file_lock_list, *pos);
>  }
>  
>  static void *locks_next(struct seq_file *f, void *v, loff_t *pos)
>  {
> +	f->private++;
>  	return seq_list_next(v, &file_lock_list, pos);
>  }
>  
> .
> 


  parent reply	other threads:[~2010-10-01  7:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 12:38 [PATCH v2] procfs: fix numbering in /proc/locks Jerome Marchand
2010-10-01  7:03 ` Américo Wang
2010-10-01  7:13 ` Pavel Emelyanov [this message]
2010-10-05 12:14 ` Jerome Marchand
2010-10-06 10:36   ` Américo Wang
2010-10-07 23:27   ` Andrew Morton
2010-10-08  8:29     ` Jerome Marchand
2010-10-15 11:32     ` [PATCH v3] " Jerome Marchand
2010-10-22 21:27       ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA58A2E.2040806@parallels.com \
    --to=xemul@parallels.com \
    --cc=jmarchan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.