Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen Test and set xbdi->xbdi_cont at splbio(). O...



details:   https://anonhg.NetBSD.org/src/rev/5bc3b008fd99
branches:  trunk
changeset: 762907:5bc3b008fd99
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Mar 05 15:12:16 2011 +0000

description:
Test and set xbdi->xbdi_cont at splbio(). Otherwise we could overwrite
xbdi->xbdi_cont and process the same request twice.

diffstat:

 sys/arch/xen/xen/xbdback_xenbus.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r c1506ae60ae5 -r 5bc3b008fd99 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Sat Mar 05 14:50:56 2011 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Sat Mar 05 15:12:16 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.32 2010/06/24 13:03:06 hannken Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.33 2011/03/05 15:12:16 bouyer Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.32 2010/06/24 13:03:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.33 2011/03/05 15:12:16 bouyer Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1370,6 +1370,7 @@
        struct xbdback_io *xbd_io;
        struct xbdback_instance *xbdi;
        int errp;
+       int s;
 
        xbd_io = bp->b_private;
        xbdi = xbd_io->xio_xbdi;
@@ -1424,11 +1425,13 @@
        atomic_dec_uint(&xbdi->xbdi_pendingreqs);
        buf_destroy(&xbd_io->xio_buf);
        xbdback_pool_put(&xbdback_io_pool, xbd_io);
+       s = splbio();
        if (xbdi->xbdi_cont == NULL) {
                /* check if there is more work to do */
                xbdi->xbdi_cont = xbdback_co_main;
                xbdback_trampoline(xbdi, xbdi);
        }
+       splx(s);
 }
 
 /*



Home | Main Index | Thread Index | Old Index