public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrei Vagin <avagin@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Gargi Sharma <gs051095@gmail.com>
Subject: Re: [PATCH] pid: restore the old behaviour of the ns_last_pid sysctl
Date: Mon, 6 Nov 2017 15:47:33 +0100	[thread overview]
Message-ID: <20171106144733.GA19282@redhat.com> (raw)
In-Reply-To: <20171103203133.19007-1-avagin@openvz.org>

On 11/03, Andrei Vagin wrote:
>
> @@ -297,8 +298,18 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write,
>  	 * it should synchronize its usage with external means.
>  	 */
>  
> -	tmp.data = &pid_ns->idr.idr_next;
> -	return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
> +	next = idr_get_cursor(&pid_ns->idr) - 1;
> +
> +	tmp.data = &next;
> +	ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (!write)
> +		return 0;
> +
> +	idr_set_cursor(&pid_ns->idr, next + 1);
> +	return 0;

Ah yes, we should also take "write" into account, I forgot it is readable.
Can't resist, to me

	err = proc_dointvec_minmax(...);
	if (!err && write)
		idr_set_cursor(...);

	return err;

looks a bit more readable, but this is matter of taste of course.


Acked-by: Oleg Nesterov <oleg@redhat.com>

  reply	other threads:[~2017-11-06 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 20:31 [PATCH] pid: restore the old behaviour of the ns_last_pid sysctl Andrei Vagin
2017-11-06 14:47 ` Oleg Nesterov [this message]
2017-11-06 18:31   ` [PATCH v2] " Andrei Vagin

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=20171106144733.GA19282@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@openvz.org \
    --cc=gs051095@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox