usb/umass, devfs: this sucks

M. Warner Losh imp at bsdimp.com
Wed Dec 26 16:45:44 PST 2007


In message: <1198713403.1119.414.camel at Particle>
            Henrik Gulbrandsen <henrik at gulbra.net> writes:
: On Wed, 2007-12-26 at 11:48 -0700, M. Warner Losh wrote:
: > In message: <1198689316.1119.382.camel at Particle>
: >             Henrik Gulbrandsen <henrik at gulbra.net> writes:
: > : Look at it from my perspective: I would be happy to complete my fix for
: > : the infamous five-year-old usb/46176, so people can finally detach umass
: > : devices without having to manually unmount them first. However, it will
: > : undoubtedly take a non-trivial amount of time to reproduce and eliminate
: > : the remaining issues.
: > 
: > There's no patches in this bug.
: 
: Correct. I was hoping to have a complete fix before making any official
: announcements, especially since the approach may be a bit controversial.
: Fixing underlying issues one by one is not necessarily as clean as doing
: a complete redesign, but it's pretty efficient and good for merging too.
: 
: The patches to CURRENT were described in this post to the USB list:
: http://lists.freebsd.org/pipermail/freebsd-usb/2007-November/004127.html

These patches look good on their surface, but I want to analyse them
in more detail.  I had recalled seeing something like this, but I
couldn't turn it up in my searching of PR database recently.  I'd
forgotten it was in the usb list...

There's problems even when you just pop the flash card out of the
adapter..  I'll see if these fix those or not...

: > : I'm more likely to put in that effort if I believe
: > : that my patches may actually end up in CURRENT, but if a one-line fix
: > : such as that in usb/78984 has not been applied after more than a year,
: > : how long will it take for patches that involve multiple subsystems?
: > 
: > The patch in this bug is wrong.  There are devices that are an odd
: > number of sectors.  This is one of the places where the obvious patch
: > isn't necessarily right.
: 
: You're right. I realized that myself right after I sent the first email.
: The patch was already two years old when I submitted it, and I guess I
: must have focused a little too much on solid-state devices with "large"
: megabytes, where the sector count is very likely to be a power of two.
:
: The patch can be written as a quirk fix for this specific umass device,
: but (as I've mentioned elsewhere) I'd prefer something that handles the
: entire category of problems at once. Perhaps an extra line containing
: "if (is_power_of_two(maxsector))" could be a working compromise, but
: this can be discussed in a smaller setting than the current one.

There's already a quirk for this problem that has been applied to the
few devices that it affects.  Maybe we need to add one more to the
list?  There was also talk of forcing a read to the last sector if the
sector count was odd, but it never got past talk.

Interestingly enough, I found the fact that FreeBSD's dd worked while
Linux's didn't at a NIST analysis of forensic tools presented at a
conference years ago.

Warner


More information about the freebsd-stable mailing list