Re: Problem in sanei_scsi.c

From: Douglas Gilbert (dgilbert@interlog.com)
Date: Thu May 25 2000 - 19:41:04 PDT

  • Next message: Levente NOVAK: "Re: Correct Network Scanner Syntax? (a question)"

    Simon Munton wrote:
    >
    > Hi,
    >
    > I've found a problem in the issue() function in sanei_scsi.c, that results
    > in the queue in sg filling up, and prevents any more scsi commands being
    > issued until the device is closed.
    >
    > There is a test on line 1690 which can erroneously try to reissue a scsi
    > command:
    > if (rp == fdp->sane_qhead && errno == EAGAIN)
    >
    > The first time through the enclosing while loop, rp == fdp->sane_qhead. But
    > if the write() call issuing the command was successful, errno is left
    > unchanged, and if errno happens to contain EAGAIN, then the command is
    > issued again, and again... until the command queue in sg is full.

    Simon,
    This may explain the strange behaviour that I saw on a
    Umax 1220S and reported to Oliver Rauch. At the time we
    couldn't resolve it. Excerpt from a post on 2000/05/04
    follows:

    ---------------------------------------------------------
    I was watching the progress of a scan in sane 1.0.2 (xsane 0.57
    I think) via debug in a recent 2.3.99 linux kernel.

    This output comes from: 'cat /proc/scsi/sg/debug' :

    dev_max(currently)=11 max_active_device=5 (origin 1)
     scsi_dma_free_sectors=5680 sg_pool_secs_aval=320 def_reserved_size=32768
    >>> device=sg1 scsi0 chan=0 id=5 lun=0 em=0 sg_tablesize=50 excl=1
       FD(1): timeout=600000ms bufflen=131072 (res)sgat=4 low_dma=1
       cmd_q=1 f_packid=0 k_orphan=0 closed=0
         rcv: id=95 blen=0 dur=10ms sgat=0 op=0x31
         rcv: id=95 blen=0 dur=260ms sgat=0 op=0x31
         rcv: id=95 blen=0 dur=500ms sgat=0 op=0x31
         act: id=95 blen=0 t_o/elap=10000/690ms sgat=0 op=0x31
         act: id=95 blen=0 t_o/elap=10000/670ms sgat=0 op=0x31
         act: id=95 blen=0 t_o/elap=10000/470ms sgat=0 op=0x31
         act: id=95 blen=0 t_o/elap=10000/210ms sgat=0 op=0x31
         prior: id=95 blen=0 t_o/elap=10000/0ms sgat=0 op=0x31

    It indicates 4 queued up OBJECT POSITION (op=0x31)
    commands [act], one waiting to get on the queue [prior]
    and 3 finished [rcv] awaiting read()s . So that's 8
    outstanding write()s.

    ---------------------------------------------------------

    Oliver said that command should only have been issued once.
    Repeating the test with more SANE debug on made the problem
    disappear :-) Now if the Umax driver uses that issue()
    function we may have an answer.

    Doug Gilbert

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Thu May 25 2000 - 21:03:48 PDT