avoid race condition between I/O submission in xbd_diskstart() and
interrupt handling in xbd_handler() - need to protect it with splbio() fixes PR port-xen/53506 by Emmanuel Dreyfus, and likely also port-xen/53074 by Brad Spencer
This commit is contained in:
parent
70aed070fa
commit
775e33e0fa
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xbd_xenbus.c,v 1.82 2018/08/15 15:49:15 jdolecek Exp $ */
|
||||
/* $NetBSD: xbd_xenbus.c,v 1.83 2018/08/21 18:11:10 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Manuel Bouyer.
|
||||
|
@ -50,7 +50,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.82 2018/08/15 15:49:15 jdolecek Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.83 2018/08/21 18:11:10 jdolecek Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
|
@ -932,6 +932,7 @@ xbd_diskstart(device_t self, struct buf *bp)
|
|||
vaddr_t va;
|
||||
int nsects, nbytes, seg;
|
||||
int notify, error = 0;
|
||||
int s;
|
||||
|
||||
DPRINTF(("xbd_diskstart(%p): b_bcount = %ld\n",
|
||||
bp, (long)bp->b_bcount));
|
||||
|
@ -947,6 +948,8 @@ xbd_diskstart(device_t self, struct buf *bp)
|
|||
goto err;
|
||||
}
|
||||
|
||||
s = splbio(); /* XXX SMP */
|
||||
|
||||
if (__predict_false(
|
||||
sc->sc_backend_status == BLKIF_STATE_SUSPENDED)) {
|
||||
/* device is suspended, do not consume buffer */
|
||||
|
@ -1024,6 +1027,7 @@ out:
|
|||
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&sc->sc_ring, notify);
|
||||
if (notify)
|
||||
hypervisor_notify_via_evtchn(sc->sc_evtchn);
|
||||
splx(s); /* XXXSMP */
|
||||
err:
|
||||
return error;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue