Fix an error path where we might scsipi_prevent() on a non-removable device.

This commit is contained in:
mycroft 2003-09-08 23:43:35 +00:00
parent 5ad03464f5
commit ab5fff1eda

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.204 2003/09/08 18:51:38 mycroft Exp $ */
/* $NetBSD: sd.c,v 1.205 2003/09/08 23:43:35 mycroft Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.204 2003/09/08 18:51:38 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.205 2003/09/08 23:43:35 mycroft Exp $");
#include "opt_scsi.h"
#include "opt_bufq.h"
@ -510,8 +510,10 @@ bad2:
bad:
if (sd->sc_dk.dk_openmask == 0) {
scsipi_prevent(periph, PR_ALLOW,
XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE);
if (periph->periph_flags & PERIPH_REMOVABLE)
scsipi_prevent(periph, PR_ALLOW,
XS_CTL_IGNORE_ILLEGAL_REQUEST |
XS_CTL_IGNORE_MEDIA_CHANGE);
periph->periph_flags &= ~PERIPH_OPEN;
}
@ -573,11 +575,10 @@ sdclose(dev, flag, fmt, p)
scsipi_wait_drain(periph);
if (periph->periph_flags & PERIPH_REMOVABLE) {
if (periph->periph_flags & PERIPH_REMOVABLE)
scsipi_prevent(periph, PR_ALLOW,
XS_CTL_IGNORE_ILLEGAL_REQUEST |
XS_CTL_IGNORE_NOT_READY);
}
periph->periph_flags &= ~PERIPH_OPEN;
scsipi_wait_drain(periph);