tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic: ffs_valloc: dup alloc

On Sat, Mar 20, 2010 at 04:06:32PM -0400, Steven Bellovin wrote:
> Of course, rejecting them wouldn't seem to do any good; what's needed,
> I suspect, is for the device to queue them (as usual) but not fire up
> the disk when in suspending mode.


You're right.  When a disk driver is suspended, it should exit from
its strategy/start routine early, without error.  It looks to me like
sdstrategy() and wdstrategy() may each get this wrong.

A pseudo-disk driver such as cgd(4) may as well get out of its
strategy/start routine early, but it cannot do as much harm if it does
not: its buffer I/O will queue in the hardware driver underneath.  That
is, cgdstart() may as well exit early if the unit is suspended, but it's
probably ok as-is.

BTW, I took care to get this right in fd(4)/fdc(4).  I have put fdc(4)
to sleep using drvctl in the middle of read/write/format operations.
When I wake it, it carries on where it left off.

Programmers should beware that

1) device_is_active() is a blunt instrument that does not distinguish
   "device is presently suspended" from "device is not present."

2) the system has to behave consistently when some devices are awake
   and some are asleep.  Even if every device will go to sleep (please,
   don't count on it), you cannot put it to sleep in an instant.


David Young             OJC Technologies      Urbana, IL * (217) 278-3933

Home | Main Index | Thread Index | Old Index