public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <amluto@hotmail.com>
To: Greg KH <greg@kroah.com>
Cc: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [BK PATCH] USB update for 2.6.3
Date: Thu, 19 Feb 2004 22:34:29 -0800	[thread overview]
Message-ID: <4035AA75.1060109@hotmail.com> (raw)
In-Reply-To: <fa.d7mjamc.1l40pri@ifi.uio.no>

Greg KH wrote:

> 
> Paulo Marques:
>   o USB: fix usblp.c
> 

Unless I'm missing something, this won't fix the usblp_write spinning bug I hit. 
  If it helps, I can try to reproduce it with some debugging code attached.

BTW, I'm posting from a different address, because luto@myrealbox.com seems 
unable to post to lists.sourceforge.net.  Please CC me in replies at 
luto@myrealbox.com.

--Andy

---- Original message copied for linux-usb-devel readers ----

I recently cancelled a print job with the printer's cancel function, and the 
CUPS backend got stuck in usblp_write (using 100% CPU and not responding to 
signals).

The printer is a Kyocera Mita FS-1900 (which has some other problems with the 
linux USB code: usblp_check_status often times out, even though the printer is 
bidirectional -- but that's a whole different issue).

It looks like the problem is that the write failed, so wcomplete got set
to 1 and the status is nonzero.  This case appears to be mishandled in usblp.c:

         while (writecount < count) {
                 if (!usblp->wcomplete) {
             [... not reaching this code]
                 }

                 down (&usblp->sem);
                 if (!usblp->present) {
                         up (&usblp->sem);
                         return -ENODEV;
                 }
                 if (usblp->writeurb->status != 0) {

             [ check status? ]

                         schedule ();
                         continue; <-- problem
                 }

After the write fails, the current code keeps checking the same status, and 
never checks for signals or fails.  I'm not sure what the right fix is, but it 
might be something like this:

--- ./usblp.c.orig      2004-02-15 06:27:29.176169752 -0800
+++ ./usblp.c   2004-02-15 06:29:40.137260640 -0800
@@ -645,13 +645,11 @@
                                 err = usblp->writeurb->status;
                         } else
                                 err = usblp_check_status(usblp, err);
-                       up (&usblp->sem);

-                       /* if the fault was due to disconnect, let khubd's
-                        * call to usblp_disconnect() grab usblp->sem ...
-                        */
-                       schedule ();
-                       continue;
+                       writecount += usblp->writeurb->transfer_buffer_length;
+                       up (&usblp->sem);
+                       count = writecount ? writecount : err;
+                       break;
                 }

                 writecount += usblp->writeurb->transfer_buffer_length;



       reply	other threads:[~2004-02-20  6:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.d7mjamc.1l40pri@ifi.uio.no>
2004-02-20  6:34 ` Andy Lutomirski [this message]
2004-02-20 15:31   ` [linux-usb-devel] Re: [BK PATCH] USB update for 2.6.3 Paulo Marques
2004-02-20  1:28 Greg KH
2004-02-20  5:58 ` Linus Torvalds
2004-02-20  6:03   ` Benjamin Herrenschmidt
2004-02-20  6:30     ` Linus Torvalds
2004-02-20  6:28       ` Benjamin Herrenschmidt
2004-02-20  6:47         ` Linus Torvalds
2004-02-20  6:42           ` Benjamin Herrenschmidt
2004-02-20  7:00             ` Greg KH
2004-02-20  7:06               ` Benjamin Herrenschmidt
2004-02-20  7:03             ` Linus Torvalds
2004-02-20  7:04               ` David S. Miller
2004-02-20  7:10                 ` Benjamin Herrenschmidt
2004-02-20  7:32                   ` David S. Miller
2004-02-20 15:15                     ` Linus Torvalds
2004-02-20 18:15                       ` Hollis Blanchard
2004-02-20 18:39                         ` Linus Torvalds
2004-02-20 19:20                           ` Hollis Blanchard
2004-02-20 19:32                             ` Linus Torvalds
2004-02-20  7:40     ` Deepak Saxena

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4035AA75.1060109@hotmail.com \
    --to=amluto@hotmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox