From: Li Zefan <lizefan@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] jffs2: avoid soft-lockup in jffs2_reserve_space_gc()
Date: Wed, 12 Feb 2014 09:42:36 +0800 [thread overview]
Message-ID: <52FAD18C.8080208@huawei.com> (raw)
In-Reply-To: <20140211155440.62c5e90eb498ec2964258969@linux-foundation.org>
>> --- a/fs/jffs2/nodemgmt.c
>> +++ b/fs/jffs2/nodemgmt.c
>> @@ -216,15 +216,20 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
>>
>> jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
>>
>> - spin_lock(&c->erase_completion_lock);
>> - while(ret == -EAGAIN) {
>> + while (true) {
>> + spin_lock(&c->erase_completion_lock);
>> ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
>> if (ret) {
>> jffs2_dbg(1, "%s(): looping, ret is %d\n",
>> __func__, ret);
>> }
>> + spin_unlock(&c->erase_completion_lock);
>> +
>> + if (ret == -EAGAIN)
>> + cond_resched();
>> + else
>> + break;
>> }
>> - spin_unlock(&c->erase_completion_lock);
>> if (!ret)
>> ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1);
>
> Looks OK. We can do this:
>
Yeah, thanks for the cleanup.
> --- a/fs/jffs2/nodemgmt.c~jffs2-avoid-soft-lockup-in-jffs2_reserve_space_gc-fix
> +++ a/fs/jffs2/nodemgmt.c
> @@ -211,7 +211,7 @@ out:
> int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
> uint32_t *len, uint32_t sumsize)
> {
> - int ret = -EAGAIN;
> + int ret;
> minsize = PAD(minsize);
>
> jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
> _
WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizefan@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>, <dwmw2@infradead.org>,
<linux-mtd@lists.infradead.org>
Subject: Re: [PATCH 2/3] jffs2: avoid soft-lockup in jffs2_reserve_space_gc()
Date: Wed, 12 Feb 2014 09:42:36 +0800 [thread overview]
Message-ID: <52FAD18C.8080208@huawei.com> (raw)
In-Reply-To: <20140211155440.62c5e90eb498ec2964258969@linux-foundation.org>
>> --- a/fs/jffs2/nodemgmt.c
>> +++ b/fs/jffs2/nodemgmt.c
>> @@ -216,15 +216,20 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
>>
>> jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
>>
>> - spin_lock(&c->erase_completion_lock);
>> - while(ret == -EAGAIN) {
>> + while (true) {
>> + spin_lock(&c->erase_completion_lock);
>> ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
>> if (ret) {
>> jffs2_dbg(1, "%s(): looping, ret is %d\n",
>> __func__, ret);
>> }
>> + spin_unlock(&c->erase_completion_lock);
>> +
>> + if (ret == -EAGAIN)
>> + cond_resched();
>> + else
>> + break;
>> }
>> - spin_unlock(&c->erase_completion_lock);
>> if (!ret)
>> ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1);
>
> Looks OK. We can do this:
>
Yeah, thanks for the cleanup.
> --- a/fs/jffs2/nodemgmt.c~jffs2-avoid-soft-lockup-in-jffs2_reserve_space_gc-fix
> +++ a/fs/jffs2/nodemgmt.c
> @@ -211,7 +211,7 @@ out:
> int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
> uint32_t *len, uint32_t sumsize)
> {
> - int ret = -EAGAIN;
> + int ret;
> minsize = PAD(minsize);
>
> jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
> _
next prev parent reply other threads:[~2014-02-12 1:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-08 2:14 [PATCH 1/3] jffs2: fix unbalanced locking Li Zefan
2014-02-08 2:14 ` Li Zefan
2014-02-08 2:15 ` [PATCH 2/3] jffs2: avoid soft-lockup in jffs2_reserve_space_gc() Li Zefan
2014-02-08 2:15 ` Li Zefan
2014-02-11 23:54 ` Andrew Morton
2014-02-11 23:54 ` Andrew Morton
2014-02-12 1:00 ` Brian Norris
2014-02-12 1:00 ` Brian Norris
2014-02-12 1:42 ` Li Zefan [this message]
2014-02-12 1:42 ` Li Zefan
2014-02-08 2:16 ` [PATCH 3/3] jffs2: remove wait queue after schedule() Li Zefan
2014-02-08 2:16 ` Li Zefan
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=52FAD18C.8080208@huawei.com \
--to=lizefan@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.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 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.