From: Oleg Nesterov <oleg@redhat.com>
To: Greg Thelen <gthelen@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jens Axboe <axboe@kernel.dk>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] ioprio: grab rcu_read_lock in sys_ioprio_{set,get}()
Date: Fri, 12 Nov 2010 18:34:00 +0100 [thread overview]
Message-ID: <20101112173400.GA8659@redhat.com> (raw)
In-Reply-To: <1289547167-32675-1-git-send-email-gthelen@google.com>
On 11/11, Greg Thelen wrote:
>
> The fix is to:
> a) grab rcu lock in sys_ioprio_{set,get}() and
> b) avoid grabbing tasklist_lock.
> Discussion in: http://marc.info/?l=linux-kernel&m=128951324702889
>
> Signed-off-by: Greg Thelen <gthelen@google.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
> ---
> fs/ioprio.c | 13 ++++---------
> 1 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ioprio.c b/fs/ioprio.c
> index 748cfb9..7da2a06 100644
> --- a/fs/ioprio.c
> +++ b/fs/ioprio.c
> @@ -103,12 +103,7 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
> }
>
> ret = -ESRCH;
> - /*
> - * We want IOPRIO_WHO_PGRP/IOPRIO_WHO_USER to be "atomic",
> - * so we can't use rcu_read_lock(). See re-copy of ->ioprio
> - * in copy_process().
> - */
> - read_lock(&tasklist_lock);
> + rcu_read_lock();
> switch (which) {
> case IOPRIO_WHO_PROCESS:
> if (!who)
> @@ -153,7 +148,7 @@ free_uid:
> ret = -EINVAL;
> }
>
> - read_unlock(&tasklist_lock);
> + rcu_read_unlock();
> return ret;
> }
>
> @@ -197,7 +192,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
> int ret = -ESRCH;
> int tmpio;
>
> - read_lock(&tasklist_lock);
> + rcu_read_lock();
> switch (which) {
> case IOPRIO_WHO_PROCESS:
> if (!who)
> @@ -250,6 +245,6 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
> ret = -EINVAL;
> }
>
> - read_unlock(&tasklist_lock);
> + rcu_read_unlock();
> return ret;
> }
> --
> 1.7.3.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Greg Thelen <gthelen@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jens Axboe <axboe@kernel.dk>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] ioprio: grab rcu_read_lock in sys_ioprio_{set,get}()
Date: Fri, 12 Nov 2010 18:34:00 +0100 [thread overview]
Message-ID: <20101112173400.GA8659@redhat.com> (raw)
In-Reply-To: <1289547167-32675-1-git-send-email-gthelen@google.com>
On 11/11, Greg Thelen wrote:
>
> The fix is to:
> a) grab rcu lock in sys_ioprio_{set,get}() and
> b) avoid grabbing tasklist_lock.
> Discussion in: http://marc.info/?l=linux-kernel&m=128951324702889
>
> Signed-off-by: Greg Thelen <gthelen@google.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
> ---
> fs/ioprio.c | 13 ++++---------
> 1 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ioprio.c b/fs/ioprio.c
> index 748cfb9..7da2a06 100644
> --- a/fs/ioprio.c
> +++ b/fs/ioprio.c
> @@ -103,12 +103,7 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
> }
>
> ret = -ESRCH;
> - /*
> - * We want IOPRIO_WHO_PGRP/IOPRIO_WHO_USER to be "atomic",
> - * so we can't use rcu_read_lock(). See re-copy of ->ioprio
> - * in copy_process().
> - */
> - read_lock(&tasklist_lock);
> + rcu_read_lock();
> switch (which) {
> case IOPRIO_WHO_PROCESS:
> if (!who)
> @@ -153,7 +148,7 @@ free_uid:
> ret = -EINVAL;
> }
>
> - read_unlock(&tasklist_lock);
> + rcu_read_unlock();
> return ret;
> }
>
> @@ -197,7 +192,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
> int ret = -ESRCH;
> int tmpio;
>
> - read_lock(&tasklist_lock);
> + rcu_read_lock();
> switch (which) {
> case IOPRIO_WHO_PROCESS:
> if (!who)
> @@ -250,6 +245,6 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
> ret = -EINVAL;
> }
>
> - read_unlock(&tasklist_lock);
> + rcu_read_unlock();
> return ret;
> }
> --
> 1.7.3.1
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-11-12 17:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 7:32 [PATCH] ioprio: grab rcu_read_lock in sys_ioprio_{set,get}() Greg Thelen
2010-11-12 7:32 ` Greg Thelen
2010-11-12 12:18 ` Paul E. McKenney
2010-11-12 12:18 ` Paul E. McKenney
2010-11-12 17:34 ` Oleg Nesterov [this message]
2010-11-12 17:34 ` Oleg Nesterov
2010-11-15 9:15 ` Jens Axboe
2010-11-15 9:15 ` Jens Axboe
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=20101112173400.GA8659@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=gthelen@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=viro@zeniv.linux.org.uk \
/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.