Changeset d60c1665 in rtems


Ignore:
Timestamp:
Feb 12, 2014, 8:44:56 PM (5 years ago)
Author:
Li Zefan <lizefan@…>
Branches:
master
Children:
03cba49
Parents:
52c50c78
git-author:
Li Zefan <lizefan@…> (02/12/14 20:44:56)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/16/18 05:22:11)
Message:

jffs2: avoid soft-lockup in jffs2_reserve_space_gc()

We triggered soft-lockup under stress test on 2.6.34 kernel.

BUG: soft lockup - CPU#1 stuck for 60009ms! [lockf2.test:14488]
...
[<bf09a4d4>] (jffs2_do_reserve_space+0x420/0x440 [jffs2])
[<bf09a528>] (jffs2_reserve_space_gc+0x34/0x78 [jffs2])
[<bf0a1350>] (jffs2_garbage_collect_dnode.isra.3+0x264/0x478 [jffs2])
[<bf0a2078>] (jffs2_garbage_collect_pass+0x9c0/0xe4c [jffs2])
[<bf09a670>] (jffs2_reserve_space+0x104/0x2a8 [jffs2])
[<bf09dc48>] (jffs2_write_inode_range+0x5c/0x4d4 [jffs2])
[<bf097d8c>] (jffs2_write_end+0x198/0x2c0 [jffs2])
[<c00e00a4>] (generic_file_buffered_write+0x158/0x200)
[<c00e14f4>] (generic_file_aio_write+0x3a4/0x414)
[<c00e15c0>] (generic_file_aio_write+0x5c/0xbc)
[<c012334c>] (do_sync_write+0x98/0xd4)
[<c0123a84>] (vfs_write+0xa8/0x150)
[<c0123d74>] (sys_write+0x3c/0xc0)]

Fix this by adding a cond_resched() in the while loop.

[akpm@…: don't initialize `ret']
Signed-off-by: Li Zefan <lizefan@…>
Cc: David Woodhouse <dwmw2@…>
Cc: Artem Bityutskiy <artem.bityutskiy@…>
Cc: <stable@…>
Signed-off-by: Andrew Morton <akpm@…>
Signed-off-by: Brian Norris <computersforpeace@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/jffs2/src/nodemgmt.c

    r52c50c78 rd60c1665  
    215215                           uint32_t *len, uint32_t sumsize)
    216216{
    217         int ret = -EAGAIN;
     217        int ret;
    218218        minsize = PAD(minsize);
    219219
    220220        jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
    221221
    222         spin_lock(&c->erase_completion_lock);
    223         while(ret == -EAGAIN) {
     222        while (true) {
     223                spin_lock(&c->erase_completion_lock);
    224224                ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
    225225                if (ret) {
     
    227227                                  __func__, ret);
    228228                }
    229         }
    230         spin_unlock(&c->erase_completion_lock);
     229                spin_unlock(&c->erase_completion_lock);
     230
     231                if (ret == -EAGAIN)
     232                        cond_resched();
     233                else
     234                        break;
     235        }
    231236        if (!ret)
    232237                ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1);
Note: See TracChangeset for help on using the changeset viewer.