> David, I hope you do not mind if I cc: this back to linux-usb-devel.
No problem, but please avoid "bcc to list" ... it's just confusing!
> Let me discuss the subject a little bit. By definition, write(2)
> may return an error, I agree. However, it is customary for a driver
> to perform a certain level of recovery. [...]
That's the distinction between "error" and "fault" in my
book. Faults can be recovered from, "page fault" for
example. Such recovery is pretty routine. Errors can't be
recovered from (accessing undefined pages is different
from accessing ones that are paged out).
> In our case, I think (and I may be mistaken), lpd filters abort
> when writes to printer return errors. So, an out of paper or a jam
> condition do not result in an error from write.
Those are faults -- correctable. I don't know how the printer
subsystem expects them to be corrected.
Unplugging the printer mid-page isn't what I'd call correctable.
> Instead, a requestor
> thread blocks until the problem is cleared. An operator may choose
> to remove the print job, in that case a signal kills the writing
> process.
>
> Given that, it looks natural that the write() never gives up.
> Thus, the problem is that the implementation loops in kernel
> without sleeping and prevents any recovery.
One problem is that some of the URB status codes indicate
faults, others indicate errors, and some can indicate either.
I've found the most reliable way to move forward on such
issues is to treat everything as an error, and then add any
recovery code as needed ... the HCDs are becoming more
consistent about status codes, which is essential.
Another problem is that the "always retry" breaks in cases
like device disconnection. There needs to be an interlock
between submitting the write urb request and the action
of the driver disconnect entry ... the print driver doesn't
have such an interlock, oopses have been seen there.
(Disconnect takes effect, then a submit happens for a
now-deleted usb_device structure ... oops!)
- Dave
> -- Pete
>
> > Date: Sun, 08 Apr 2001 07:31:25 -0700
> > From: David Brownell <[EMAIL PROTECTED]>
> > To: Peter Zaitcev <[EMAIL PROTECTED]>
>
> > By definition, it's OK for write() to return an error!
> >
> > ----- Original Message -----
> > From: "Pete Zaitcev" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
><[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Saturday, April 07, 2001 9:11 PM
> > Subject: [linux-usb-devel] Patch to drivers/usb/printer.c
> >
> > > I got assigned a bug report:
> > > https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=34551
> > > Basically, when user's process loops it does not allow
> > > khubd to run. I found that write() never returns an error,
> > > and did not know if it was safe to change that behaviour.
> > > So, here it is, the best band-aid I could do.
> > >
> > > -- Pete
> > >
> > >
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel