28 Jan, 2008

1 commit


26 Jan, 2008

1 commit


24 Jan, 2008

3 commits

  • This removes static array sense_buffer in scsi_cmnd and uses
    dynamically allocated sense_buffer (with GFP_DMA).

    The reason for doing this is that some architectures need cacheline
    aligned buffer for DMA:

    http://lkml.org/lkml/2007/11/19/2

    The problems are that scsi_eh_prep_cmnd puts scsi_cmnd::sense_buffer
    to sglist and some LLDs directly DMA to scsi_cmnd::sense_buffer. It's
    necessary to DMA to scsi_cmnd::sense_buffer safely. This patch solves
    these issues.

    __scsi_get_command allocates sense_buffer via kmem_cache_alloc and
    attaches it to a scsi_cmnd so everything just work as before.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • The macro tells us whether the device is (or contains) an enclosure device.

    Signed-off-by: James Bottomley

    James Bottomley
     
  • This patch adds a new scsi_device flag (last_sector_bug) for devices
    which contain a bug where the device crashes when the last sector is
    read in a larger then 1 sector read.

    This is for example the case with sdcards in the HP PSC1350 printer
    cardreader and in the HP PSC1610 printer cardreader.

    Signed-off-by: Hans de Goede
    Signed-off-by: James Bottomley

    Hans de Goede
     

12 Jan, 2008

15 commits

  • This is bad for two reasons:

    1. If they're returned to outside applications, no-one knows what
    they mean.
    2. Eventually they'll clash with the ever expanding standard error
    codes.

    The problem error code in question is ETASK. I've replaced this by
    ECOMM (communications error on send) a network error code that seems to
    most closely relay what ETASK meant.

    Acked-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    James Bottomley
     
  • This adds support for host side SMP processing, via a separate
    SMP interpreter file.

    Signed-off-by: James Bottomley

    James Bottomley
     
  • Convert xmit to iscsi chunks.

    from michaelc@cs.wisc.edu:

    Bug fixes, more digest integration, sg chaining conversion and other
    sg wrapper changes, coding style sync up, and removal of io fields,
    like pdu_sent, that are not needed.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Olaf Kirch
     
  • During root boot and shutdown the target could send us nops.
    At this time iscsid cannot be running, so the target will drop
    the session and the boot or shutdown will hang.

    To handle this and allow us to better control when to check the network
    this patch moves the nop handling to the kernel.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • We were using the device delete sysfs file to remove each device
    then logout. Now in 2.6.21 this will not work because
    the sysfs delete file returns immediately and does not wait for
    the device removal to complete. This causes a hang if a cache sync
    is needed during shutdown. Before .21, that approach had other
    problems, so this patch fixes the shutdown code so that we remove the target
    and unbind the session before logging out and shut down the session

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • There is not need to block the session during logout. Since
    we are going to fail the commands that were blocked just fail them
    immediately instead.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • iscsi_pool_init simplified

    iscsi_pool_init currently has a lot of duplicate kfree() calls it does
    when some allocation fails. This patch simplifies the code a little by
    using iscsi_pool_free to tear down the pool in case of an error.

    iscsi_pool_init also returns a copy of the item array to the caller.
    Not all callers use this array, so we make it optional.

    Instead of allocating a second array and return that, allocate just one
    array, of twice the size.

    Update users of iscsi_pool_{init,free}

    This patch drops the (now useless) second argument to
    iscsi_pool_free, and updates all callers.

    It also removes the ctask->r2ts array, which was never
    used anyway. Since the items argument to iscsi_pool_init
    is now optional, we can pass NULL instead.

    Signed-off-by: Olaf Kirch
    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Olaf Kirch
     
  • at libiscsi generic code
    - currently code assumes a storage space of pdu header is allocated
    at llds ctask and is pointed to by iscsi_cmd_task->hdr. Here I add
    a hdr_max field pertaining to that storage, and an hdr_len that
    accumulates the current use of the pdu-header.

    - Add an iscsi_next_hdr() inline which returns the next free space
    to write new Header at. Also iscsi_next_hdr() is used to retrieve
    the address at which to write the header-digest.

    - Add iscsi_add_hdr(length). What the user do is calls iscsi_next_hdr()
    for address of the new header, than calls iscsi_add_hdr(length) with
    the size of the new header. iscsi_add_hdr() will check if space is
    available and update to the new size. length must be padded according
    to standard.

    - Add 2 padding inline helpers thanks to Olaf. Current patch does not
    use them but Following patches will.
    Also moved definition of ISCSI_PAD_LEN to iscsi_proto.h which had
    PAD_WORD_LEN that was never used anywhere.

    - Let iscsi_prep_scsi_cmd_pdu() signal an Error return since now it is
    possible that it will fail.

    - I was tired of yet again writing a "this is a digest" comment next to
    sizeof(__u32) so I defined a new ISCSI_DIGEST_SIZE. Now I don't need
    any comments. Changed all places that used sizeof(__u32) or "4" in
    connection to a digest.

    iscsi_tcp specific code
    - At struct iscsi_tcp_cmd_task allocate maximum space allowed in
    standard for all headers following the iscsi_cmd header. and mark
    it so in iscsi_tcp_session_create()
    - At iscsi_send_cmd_hdr() retrieve the correct headers size and
    write header digest at iscsi_next_hdr().

    Signed-off-by: Boaz Harrosh
    Signed-off-by: Olaf Kirch
    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • Rewrite recv path. Fixes:
    - data digest processing and error handling.
    - ahs support.

    Some fixups by Mike Christie

    Signed-off-by: Olaf Kirch
    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Olaf Kirch
     
  • This patch adds logical unit reset support. This should work for ib_iser,
    but I have not finished testing that driver so it is not hooked in yet.

    This patch also temporarily reverts the iscsi_tcp r2t write out patch.
    That code is completely rewritten in this patchset.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • The current scsi_test_unit_ready() is updated to return sense code
    information (in struct scsi_sense_hdr). The sd and sr drivers are
    changed to interpret the sense code return asc 0x3a as no media and
    adjust the device status accordingly.

    Signed-off-by: James Bottomley

    James Bottomley
     
  • Some SCSI tape medium changers that need the BLIST_SINGLELUN flag have
    the medium changer at one LUN and the tape drive at a different LUN.
    The inquiry string of the tape drive may be different from that of the
    medium changer. In order for single_lun to be effective, every
    scsi_device under a given scsi_target must have it set. This means that
    there needs to be a blacklist entry for BOTH the medium changer AND the
    tape drive, which is impractical because some medium changers may be
    paired with a variety of different tape drive models. It makes more
    sense to put the single_lun flag in scsi_target instead of scsi_device,
    which causes every device at a given target ID to inherit the single_lun
    flag from one LUN. This makes it possible to blacklist just the medium
    changer and not the tape drive.

    Signed-off-by: Tony Battersby
    Signed-off-by: James Bottomley

    Tony Battersby
     
  • Annotate sas_queuecommand with locking details, and clean up a few
    more sparse warnings about static/non-static declarations.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • sparse complains about the mixing of enums in libsas. Since the
    underlying numeric values of both enums are the same, combine them
    to get rid of the warning.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • This will send for a card reader slot (remove/add media):
    UEVENT[1187091572.155884] change /devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host7/target7:0:0/7:0:0:0 (scsi)
    UEVENT[1187091572.162314] remove /block/sdb/sdb1 (block)
    UEVENT[1187091572.172464] add /block/sdb/sdb1 (block)
    UEVENT[1187091572.175408] change /devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host7/target7:0:0/7:0:0:0 (scsi)

    and for a DVD drive (add/eject media):
    UEVENT[1187091590.189159] change /devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 (scsi)
    UEVENT[1187091590.957124] add /module/isofs (module)
    UEVENT[1187091604.468207] change /devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 (scsi)

    Userspace gets events, even for unpartitioned media. This unifies
    the event handling for asynchronoous events (AN) and events caused by
    perodical polling the device from userspace.

    Signed-off-by: Kay Sievers

    [jejb: modified for new event API]

    Signed-off-by: James Bottomley

    Kay Sievers
     

07 Jan, 2008

1 commit

  • This reverts commit ac40532ef0b8649e6f7f83859ea0de1c4ed08a19, which gets
    us back the original cleanup of 6f5391c283d7fdcf24bf40786ea79061919d1e1d.

    It turns out that the bug that was triggered by that commit was
    apparently not actually triggered by that commit at all, and just the
    testing conditions had changed enough to make it appear to be due to it.

    The real problem seems to have been found by Peter Osterlund:

    "pktcdvd sets it [block device size] when opening the /dev/pktcdvd
    device, but when the drive is later opened as /dev/scd0, there is
    nothing that sets it back. (Btw, 40944 is possible if the disk is a
    CDRW that was formatted with "cdrwtool -m 10236".)

    The problem is that pktcdvd opens the cd device in non-blocking mode
    when pktsetup is run, and doesn't close it again until pktsetup -d is
    run. The effect is that if you meanwhile open the cd device,
    blkdev.c:do_open() doesn't call bd_set_size() because
    bdev->bd_openers is non-zero."

    In particular, to repeat the bug (regardless of whether commit
    6f5391c283d7fdcf24bf40786ea79061919d1e1d is applied or not):

    " 1. Start with an empty drive.
    2. pktsetup 0 /dev/scd0
    3. Insert a CD containing an isofs filesystem.
    4. mount /dev/pktcdvd/0 /mnt/tmp
    5. umount /mnt/tmp
    6. Press the eject button.
    7. Insert a DVD containing a non-writable filesystem.
    8. mount /dev/scd0 /mnt/tmp
    9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
    10. If the DVD contains data beyond the physical size of a CD, you
    get I/O errors in the terminal, and dmesg reports lots of
    "attempt to access beyond end of device" errors."

    which in turn is because the nested open after the media change won't
    cause the size to be set properly (because the original open still holds
    the block device, and we only do the bd_set_size() when we don't have
    other people holding the device open).

    The proper fix for that is probably to just do something like

    bdev->bd_inode->i_size = (loff_t)get_capacity(disk)<
    Cc: James Bottomley
    Cc: Matthew Wilcox
    Cc: Ingo Molnar
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

03 Jan, 2008

1 commit

  • This reverts commit 6f5391c283d7fdcf24bf40786ea79061919d1e1d ("[SCSI]
    Get rid of scsi_cmnd->done") that was supposed to be a cleanup commit,
    but apparently it causes regressions:

    Bug 9370 - v2.6.24-rc2-409-g9418d5d: attempt to access beyond end of device
    http://bugzilla.kernel.org/show_bug.cgi?id=9370

    this patch should be reintroduced in a more split-up form to make
    testing of it easier.

    Signed-off-by: Ingo Molnar
    Acked-by: Matthew Wilcox
    Cc: James Bottomley
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

11 Dec, 2007

1 commit

  • The esp_reset_cleanup() function is called with the host lock held and
    invokes starget_for_each_device() which wants to take it too. Here is a
    fix along the lines of shost_for_each_device()/__shost_for_each_device()
    adding a __starget_for_each_device() counterpart which assumes the lock
    has already been taken.

    Eventually, I think the driver should get modified so that more work is
    done as a softirq rather than in the interrupt context, but for now it
    fixes a bug that causes the spinlock debugger to fire.

    While at it, it fixes a small number of cosmetic problems with
    starget_for_each_device() too.

    Signed-off-by: Maciej W. Rozycki
    Acked-by: David S. Miller
    Cc: James Bottomley
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maciej W. Rozycki
     

04 Nov, 2007

1 commit


02 Nov, 2007

1 commit


18 Oct, 2007

1 commit

  • Spotted by Paul Jackson

    The error handler rework moved the scatterlist into a globally exposed
    structure in scsi_eh.h; unfortunately, the scatterlist include needs
    to move from scsi_error.c to scsi_eh.h to allow this to compile
    universally.

    Acked-by: Paul Jackson
    Signed-off-by: James Bottomley

    James Bottomley
     

17 Oct, 2007

1 commit


16 Oct, 2007

5 commits


15 Oct, 2007

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (207 commits)
    [SCSI] gdth: fix CONFIG_ISA build failure
    [SCSI] esp_scsi: remove __dev{init,exit}
    [SCSI] gdth: !use_sg cleanup and use of scsi accessors
    [SCSI] gdth: Move members from SCp to gdth_cmndinfo, stage 2
    [SCSI] gdth: Setup proper per-command private data
    [SCSI] gdth: Remove gdth_ctr_tab[]
    [SCSI] gdth: switch to modern scsi host registration
    [SCSI] gdth: gdth_interrupt() gdth_get_status() & gdth_wait() fixes
    [SCSI] gdth: clean up host private data
    [SCSI] gdth: Remove virt hosts
    [SCSI] gdth: Reorder scsi_host_template intitializers
    [SCSI] gdth: kill gdth_{read,write}[bwl] wrappers
    [SCSI] gdth: Remove 2.4.x support, in-kernel changelog
    [SCSI] gdth: split out pci probing
    [SCSI] gdth: split out eisa probing
    [SCSI] gdth: split out isa probing
    gdth: Make one abuse of scsi_cmnd less obvious
    [SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation
    [SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution
    [SCSI] scsi_error: Refactoring scsi_error to facilitate in synchronous REQUEST_SENSE
    ...

    Linus Torvalds
     

13 Oct, 2007

7 commits

  • - Drivers/transports that want to send a synchronous REQUEST_SENSE command
    as part of their .queuecommand sequence, have 2 new API's that facilitate
    in doing so and abstract them from scsi-ml internals.

    void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
    struct scsi_eh_save *sesci, unsigned char *cmnd,
    int cmnd_size, int sense_bytes)

    Will hijack a command and prepare it for request sense if needed.
    And will save any later needed info into a scsi_eh_save structure.

    void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
    struct scsi_eh_save *sesci);

    Will undo any changes done to a command by above function. Making
    it ready for completion.

    - Re-factor scsi_send_eh_cmnd() to use above APIs

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     
  • scsi/scsi_transport_iscsi.h uses struct mutex and struct list_head,
    so while linux/mutex.h and linux/list.h seem to be pulled in indirectly
    by one of the headers it includes, the right thing
    is to include linux/mutex.h and linus/list.h directly.

    Signed-off-by: Michael S. Tsirkin
    Acked-by: Mike Christie
    Signed-off-by: Andrew Morton
    Signed-off-by: James Bottomley

    Michael S. Tsirkin
     
  • The ULD ->done callback moves into the scsi_driver. By moving the call
    to scsi_io_completion() from scsi_blk_pc_done() to scsi_finish_command(),
    we can eliminate the latter entirely. By returning 'good_bytes' from
    the ->done callback (rather than invoking scsi_io_completion()), we can
    stop exporting scsi_io_completion().

    Also move the prototypes from sd.h to sd.c as they're all internal anyway.
    Rename sd_rw_intr to sd_done and rw_intr to sr_done.

    Inspired-by: Christoph Hellwig
    Signed-off-by: Matthew Wilcox
    Signed-off-by: James Bottomley

    Matthew Wilcox
     
  • Because scsi_print_sense_hdr prefixes with KERN_INFO, the output from
    scsi_io_completion looks like:

    sd 0:0:0:0: [sdb] Device not ready: : Sense Key : 0x2 [current]
    : ASC=0x4 ASCQ=0x3

    By using scsi_show_sense_hdr, we can get the much more appealing output:

    sd 0:0:0:0: [sdb] Device not ready: Sense Key : 0x2 [current]
    sd 0:0:0:0: [sdb] Device not ready: ASC=0x4 ASCQ=0x3

    Acked-by: Matthew Wilcox
    Signed-off-by: James Bottomley

    James Bottomley
     
  • The pid field is a duplicate of the serial_number field and has been
    scheduled for removal for a long time. A few drivers were still using
    it, so just change them to use serial_number instead.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: James Bottomley

    Matthew Wilcox
     
  • One of the intents of the block prep function was to allow ULDs to use
    it for preprocessing. The original SCSI model was to have a single prep
    function and add a pointer indirect filter to build the necessary
    commands. This patch reverses that, does away with the init_command
    field of the scsi_driver structure and makes ULDs attach directly to the
    prep function instead. The value is really that it allows us to begin
    to separate the ULDs from the SCSI mid layer (as long as they don't use
    any core functions---which is hard at the moment---a ULD doesn't even
    need SCSI to bind).

    Acked-by: Jens Axboe
    Signed-off-by: James Bottomley

    James Bottomley
     
  • This adds minimum target driver support like the srp transport does:

    - fc_remote_port_{rolechg,delete} calls
    scsi_tgt_it_nexus_{create,destroy} for target drivers.

    - add callbacks to notify target drivers of the nexus and tmf
    operation results to fc_function_template.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    FUJITA Tomonori