lkml.org 
[lkml]   [2007]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Check for error returned by kthread_create on creating journal thread
    On Mon, 16 Apr 2007 11:41:14 +0400
    Pavel Emelianov <xemul@sw.ru> wrote:

    > 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.
    >
    >
    > [diff-jbd-check-start-journal-thread-return-value text/plain (1.7KB)]
    > --- ./fs/jbd/journal.c.jbdthreads 2007-04-16 11:17:36.000000000 +0400
    > +++ ./fs/jbd/journal.c 2007-04-16 11:30:09.000000000 +0400
    > @@ -211,10 +211,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;
    > }

    Thanks. Please don't forget those Signed-off-by:s

    I assume that you runtime tested this and that the mount failed in
    an appropriate fashion?
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-04-21 00:41    [W:4.418 / U:0.668 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site