diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-07 02:43:13 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-07 02:43:13 +0300 |
commit | c36194871293100bd4b2ecb54ac9774d6e627aa2 (patch) | |
tree | 9fd6894103918f439d0e7ec35620e18018ccfa76 /fs/jffs2/background.c | |
parent | c3302931db090d87e9015c3a7ce5c97a7dd90f78 (diff) | |
parent | dc8a0843a435b2c0891e7eaea64faaf1ebec9b11 (diff) | |
download | linux-c36194871293100bd4b2ecb54ac9774d6e627aa2.tar.xz |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
[JFFS2] fix race condition in jffs2_lzo_compress()
[MTD] [NOR] Fix cfi_send_gen_cmd handling of x16 devices in x8 mode (v4)
[JFFS2] Fix lack of locking in thread_should_wake()
[JFFS2] Fix build failure with !CONFIG_JFFS2_FS_WRITEBUFFER
[MTD] [NAND] OMAP2: remove duplicated #include
Diffstat (limited to 'fs/jffs2/background.c')
-rw-r--r-- | fs/jffs2/background.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 8adebd3e43c6..3cceef4ad2b7 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c @@ -85,15 +85,15 @@ static int jffs2_garbage_collect_thread(void *_c) for (;;) { allow_signal(SIGHUP); again: + spin_lock(&c->erase_completion_lock); if (!jffs2_thread_should_wake(c)) { set_current_state (TASK_INTERRUPTIBLE); + spin_unlock(&c->erase_completion_lock); D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n")); - /* Yes, there's a race here; we checked jffs2_thread_should_wake() - before setting current->state to TASK_INTERRUPTIBLE. But it doesn't - matter - We don't care if we miss a wakeup, because the GC thread - is only an optimisation anyway. */ schedule(); - } + } else + spin_unlock(&c->erase_completion_lock); + /* This thread is purely an optimisation. But if it runs when other things could be running, it actually makes things a |