NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/55986: Cannot eject USB mass storage attached as sd(4)
>Number: 55986
>Category: kern
>Synopsis: Cannot eject USB mass storage attached as sd(4)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 10 15:25:00 +0000 2021
>Originator: Ryo ONODERA
>Release: NetBSD 9.99.80
>Organization:
Ryo ONODERA // ryo%tetera.org@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
>Environment:
System: NetBSD brownie 9.99.80 NetBSD 9.99.80 (DTRACE7) #2: Thu Feb 11 00:02:23 JST 2021 ryoon@brownie:/usr/world/9.99/amd64/obj/sys/arch/amd64/compile/DTRACE7 amd64
Architecture: x86_64
Machine: amd64
>Description:
When Amazon Kindle e-ink device is connected to NetBSD/amd64 9.99.80,
Amazon Kindle shows USB drive mode screen and I cannot read ebooks
without ejecting of sd0e.
However "eject /dev/sd0e" always returns EBUSY,
because r1.320 of src/sys/dev/scsipi/cd.c has a mistake.
See: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/scsipi/sd.c.diff?r1=1.319&r2=1.320&only_with_tag=MAIN
DK_BUSY must have mask as second argument, however it takes bit number.
>How-To-Repeat:
Connect Amazon Kindle to NetBSD/amd64 9.99.80.
Run "eject /dev/sd0e".
>Fix:
Index: sys/dev/scsipi/sd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/scsipi/sd.c,v
retrieving revision 1.330
diff -u -r1.330 sd.c
--- sys/dev/scsipi/sd.c 25 Sep 2020 13:08:00 -0000 1.330
+++ sys/dev/scsipi/sd.c 10 Feb 2021 15:12:13 -0000
@@ -954,11 +954,12 @@
if ((periph->periph_flags & PERIPH_REMOVABLE) == 0)
return (ENOTTY);
if (*(int *)addr == 0) {
+ int pmask = __BIT(part);
/*
* Don't force eject: check that we are the only
* partition open. If so, unlock it.
*/
- if (DK_BUSY(dksc, part) == 0) {
+ if (DK_BUSY(dksc, pmask) == 0) {
error = scsipi_prevent(periph, SPAMR_ALLOW,
XS_CTL_IGNORE_NOT_READY);
if (error)
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index