Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Fix a race where the backing store thread runs (and ...



details:   https://anonhg.NetBSD.org/src/rev/0c063be21752
branches:  trunk
changeset: 748094:0c063be21752
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Oct 13 12:37:19 2009 +0000

description:
Fix a race where the backing store thread runs (and exits immediately)
before kthread_create() returns.

diffstat:

 sys/dev/fss.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r cb6784a295e2 -r 0c063be21752 sys/dev/fss.c
--- a/sys/dev/fss.c     Tue Oct 13 12:11:19 2009 +0000
+++ b/sys/dev/fss.c     Tue Oct 13 12:37:19 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fss.c,v 1.63 2009/06/29 05:08:17 dholland Exp $        */
+/*     $NetBSD: fss.c,v 1.64 2009/10/13 12:37:19 hannken Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.63 2009/06/29 05:08:17 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.64 2009/10/13 12:37:19 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -446,11 +446,12 @@
                sc->sc_indir_data = NULL;
        }
 
+       sc->sc_flags |= FSS_BS_THREAD;
        if ((error = kthread_create(PRI_BIO, 0, NULL, fss_bs_thread, sc,
-           &sc->sc_bs_lwp, device_xname(sc->sc_dev))) != 0)
+           &sc->sc_bs_lwp, device_xname(sc->sc_dev))) != 0) {
+               sc->sc_flags &= ~FSS_BS_THREAD;
                return error;
-
-       sc->sc_flags |= FSS_BS_THREAD;
+       }
 
        disk_attach(sc->sc_dkdev);
 



Home | Main Index | Thread Index | Old Index