[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77650cec-70cc-149a-74e9-2256c6138032@virtuozzo.com>
Date: Wed, 15 May 2019 12:16:14 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Cc: Cyrill Gorcunov <gorcunov@...il.com>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 1/5] proc: use down_read_killable for /proc/pid/maps
On 15.05.2019 11:41, Konstantin Khlebnikov wrote:
> Do not stuck forever if something wrong.
> This function also used for /proc/pid/smaps.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
For the series:
Reviewed-by: Kirill Tkhai <ktkhai@...tuozzo.com>
> ---
> fs/proc/task_mmu.c | 6 +++++-
> fs/proc/task_nommu.c | 6 +++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 01d4eb0e6bd1..2bf210229daf 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -166,7 +166,11 @@ static void *m_start(struct seq_file *m, loff_t *ppos)
> if (!mm || !mmget_not_zero(mm))
> return NULL;
>
> - down_read(&mm->mmap_sem);
> + if (down_read_killable(&mm->mmap_sem)) {
> + mmput(mm);
> + return ERR_PTR(-EINTR);
> + }
> +
> hold_task_mempolicy(priv);
> priv->tail_vma = get_gate_vma(mm);
>
> diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
> index 36bf0f2e102e..7907e6419e57 100644
> --- a/fs/proc/task_nommu.c
> +++ b/fs/proc/task_nommu.c
> @@ -211,7 +211,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
> if (!mm || !mmget_not_zero(mm))
> return NULL;
>
> - down_read(&mm->mmap_sem);
> + if (down_read_killable(&mm->mmap_sem)) {
> + mmput(mm);
> + return ERR_PTR(-EINTR);
> + }
> +
> /* start from the Nth VMA */
> for (p = rb_first(&mm->mm_rb); p; p = rb_next(p))
> if (n-- == 0)
Powered by blists - more mailing lists