diff options
author | 2007-04-13 18:56:26 +0000 | |
---|---|---|
committer | 2007-04-13 18:56:26 +0000 | |
commit | 00bc93faf1e03637d8db43f554869e30e9d792f8 (patch) | |
tree | 379f2271b572ee3c1081c605aa9e6836ec8cadc8 /sys | |
parent | Timecounters for macppc. As clean and simple as sparc64. Uses the %tb (diff) | |
download | wireguard-openbsd-00bc93faf1e03637d8db43f554869e30e9d792f8.tar.xz wireguard-openbsd-00bc93faf1e03637d8db43f554869e30e9d792f8.zip |
If a removable device refuses to process PREVENT_ALLOW to lock the
media in while the device is open, allow the open anyway. Fixes some
USB devices which do odd things when presented by PREVENT_ALLOW.
Suggestion from mickey@.
ok millert@ marco@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/sd.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 0d7a6a2317d..733d56b426a 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.123 2007/04/11 10:54:57 bluhm Exp $ */ +/* $OpenBSD: sd.c,v 1.124 2007/04/13 18:56:26 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -378,14 +378,16 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p) goto bad; } - /* Lock the pack in. */ - if ((sc_link->flags & SDEV_REMOVABLE) != 0) { - error = scsi_prevent(sc_link, PR_PREVENT, + /* + * Try to prevent the unloading of a removable device while + * it's open. But allow the open to proceed if the device can't + * be locked in. + */ + if ((sc_link->flags & SDEV_REMOVABLE) != 0) + scsi_prevent(sc_link, PR_PREVENT, SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); - if (error) - goto bad; - } + /* Load the physical device parameters. */ sc_link->flags |= SDEV_MEDIA_LOADED; if (sd_get_parms(sd, &sd->params, (rawopen ? SCSI_SILENT : 0)) |