summaryrefslogtreecommitdiff
path: root/fs/jbd
diff options
context:
space:
mode:
authorPavel Emelianov <xemul@sw.ru>2007-05-08 11:30:42 +0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 22:15:13 +0400
commit97f067846786d255888ccad14e2f38a1f63d8e9b (patch)
treeebff291172a51b25a0a0c69c85463f0c789bb2ce /fs/jbd
parentee6f958291e2a768fd727e7a67badfff0b67711a (diff)
downloadlinux-97f067846786d255888ccad14e2f38a1f63d8e9b.tar.xz
jbd: check for error returned by kthread_create on creating journal thread
If the thread failed to create the subsequent wait_event will hang forever. This is likely to happen if kernel hits max_threads limit. Will be critical for virtualization systems that limit the number of tasks and kernel memory usage within the container. (akpm: JBD should be converted fully to the kthread API: kthread_should_stop() and kthread_stop()). Cc: <linux-ext4@vger.kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/jbd')
-rw-r--r--fs/jbd/journal.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index e1eb7e999ae8..46fe7439fb91 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -210,10 +210,16 @@ end_loop:
return 0;
}
-static void journal_start_thread(journal_t *journal)
+static int journal_start_thread(journal_t *journal)
{
- kthread_run(kjournald, journal, "kjournald");
+ struct task_struct *t;
+
+ t = kthread_run(kjournald, journal, "kjournald");
+ if (IS_ERR(t))
+ return PTR_ERR(t);
+
wait_event(journal->j_wait_done_commit, journal->j_task != 0);
+ return 0;
}
static void journal_kill_thread(journal_t *journal)
@@ -839,8 +845,7 @@ static int journal_reset(journal_t *journal)
/* Add the dynamic fields and write it to disk. */
journal_update_superblock(journal, 1);
- journal_start_thread(journal);
- return 0;
+ return journal_start_thread(journal);
}
/**