28 Jun, 2017

1 commit


21 Jun, 2017

1 commit

  • Instead of explicitly calling scsi_req_init() after blk_get_request(),
    call that function from inside blk_get_request(). Add an
    .initialize_rq_fn() callback function to the block drivers that need
    it. Merge the IDE .init_rq_fn() function into .initialize_rq_fn()
    because it is too small to keep it as a separate function. Keep the
    scsi_req_init() call in ide_prep_sense() because it follows a
    blk_rq_init() call.

    References: commit 82ed4db499b8 ("block: split scsi_request out of struct request")
    Signed-off-by: Bart Van Assche
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Omar Sandoval
    Cc: Nicholas Bellinger
    Signed-off-by: Jens Axboe

    Bart Van Assche
     

09 Jun, 2017

1 commit

  • Currently we use nornal Linux errno values in the block layer, and while
    we accept any error a few have overloaded magic meanings. This patch
    instead introduces a new blk_status_t value that holds block layer specific
    status codes and explicitly explains their meaning. Helpers to convert from
    and to the previous special meanings are provided for now, but I suspect
    we want to get rid of them in the long run - those drivers that have a
    errno input (e.g. networking) usually get errnos that don't know about
    the special block layer overloads, and similarly returning them to userspace
    will usually return somethings that strictly speaking isn't correct
    for file system operations, but that's left as an exercise for later.

    For now the set of errors is a very limited set that closely corresponds
    to the previous overloaded errno values, but there is some low hanging
    fruite to improve it.

    blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse
    typechecking, so that we can easily catch places passing the wrong values.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

02 Jun, 2017

1 commit

  • From the context where a SCSI command is submitted it is not always
    possible to figure out whether or not the queue the command is
    submitted to has struct scsi_request as the first member of its
    private data. Hence introduce the flag QUEUE_FLAG_SCSI_PASSTHROUGH.

    Signed-off-by: Bart Van Assche
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Cc: Omar Sandoval
    Cc: Don Brace
    Signed-off-by: Jens Axboe

    Bart Van Assche
     

05 May, 2017

1 commit

  • Pull SCSI updates from James Bottomley:
    "This update includes the usual round of major driver updates
    (hisi_sas, ufs, fnic, cxlflash, be2iscsi, ipr, stex). There's also the
    usual amount of cosmetic and spelling stuff"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (155 commits)
    scsi: qla4xxx: fix spelling mistake: "Tempalate" -> "Template"
    scsi: stex: make S6flag static
    scsi: mac_esp: fix to pass correct device identity to free_irq()
    scsi: aacraid: pci_alloc_consistent() failures on ARM64
    scsi: ufs: make ufshcd_get_lists_status() register operation obvious
    scsi: ufs: use MASK_EE_STATUS
    scsi: mac_esp: Replace bogus memory barrier with spinlock
    scsi: fcoe: make fcoe_e_d_tov and fcoe_r_a_tov static
    scsi: sd_zbc: Do not write lock zones for reset
    scsi: sd_zbc: Remove superfluous assignments
    scsi: sd: sd_zbc: Rename sd_zbc_setup_write_cmnd
    scsi: Improve scsi_get_sense_info_fld
    scsi: sd: Cleanup sd_done sense data handling
    scsi: sd: Improve sd_completed_bytes
    scsi: sd: Fix function descriptions
    scsi: mpt3sas: remove redundant wmb
    scsi: mpt: Move scsi_remove_host() out of mptscsih_remove_host()
    scsi: sg: reset 'res_in_use' after unlinking reserved array
    scsi: mvumi: remove code handling zero scsi_sg_count(scmd) case
    scsi: fusion: fix spelling mistake: "Persistancy" -> "Persistency"
    ...

    Linus Torvalds
     

26 Apr, 2017

1 commit


21 Apr, 2017

2 commits

  • Move scsi_remove_host call into sas_remove_host and remove it from SAS
    HBA drivers, so we don't mess up the ordering. This solves an issue with
    double deleting sysfs entries that was introduced by the change of sysfs
    behaviour from commit bcdde7e221a8 ("sysfs: make __sysfs_remove_dir()
    recursive").

    [mkp: addressed checkpatch complaints]

    Signed-off-by: Johannes Thumshirn
    Suggested-by: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: James Bottomley
    Cc: Jinpu Wang
    Cc: John Garry
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Jinpu Wang
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     
  • This passes on the scsi_cmnd result field to users of passthrough
    requests. Currently we abuse req->errors for this purpose, but that
    field will go away in its current form.

    Note that the old IDE code abuses the errors field in very creative
    ways and stores all kinds of different values in it. I didn't dare
    to touch this magic, so the abuses are brought forward 1:1.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Reviewed-by: Bart Van Assche
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

28 Feb, 2017

1 commit

  • Fix typos and add the following to the scripts/spelling.txt:

    intialization||initialization

    The "inintialization" in drivers/acpi/spcr.c is a different pattern but
    I fixed it as well in this commit.

    Link: http://lkml.kernel.org/r/1481573103-11329-16-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

22 Feb, 2017

1 commit

  • The end_device and sas_host devices support BSG ioctls, but the
    request_queue allocated for them isn't set up to allocate the struct
    scsi_request payload. This leads to memory corruption in the call to
    scsi_req_init() in bsg_map_hdr(), since it will memset past the end of
    the allocated request. Fix it by setting ->cmd_size on the allocated
    request_queue.

    Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")
    Signed-off-by: Omar Sandoval
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Omar Sandoval
     

28 Jan, 2017

1 commit

  • And require all drivers that want to support BLOCK_PC to allocate it
    as the first thing of their private data. To support this the legacy
    IDE and BSG code is switched to set cmd_size on their queues to let
    the block layer allocate the additional space.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

19 Aug, 2016

1 commit


12 Apr, 2016

1 commit

  • On larger installations it is useful to disable automatic LUN scanning,
    and only add the required LUNs via udev rules. This can speed up bootup
    dramatically.

    This patch introduces a new scan module parameter value 'manual', which
    works like 'none', but can be overridden by setting the 'rescan' value
    from scsi_scan_target to 'SCSI_SCAN_MANUAL'. And it updates all
    relevant callers to set the 'rescan' value to 'SCSI_SCAN_MANUAL' if
    invoked via the 'scan' option in sysfs.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Ewan D. Milne
    Tested-by: Laurence Oberman
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     

15 Mar, 2016

1 commit


19 Dec, 2015

2 commits

  • For a device known to be SAS connected, this will return the endpoint
    address. This is useful for getting the SAS address of SATA devices.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    James Bottomley
     
  • Adds a function designed to be callable any time (regardless of
    whether the transport attributes are configured or not) which returns
    true if the device is attached over a SAS transport. The design of
    this function is that transport specific functions can be embedded
    within a

    if (is_sas_attached(sdev)) {
    ...
    }

    which would be compiled out (and thus eliminate the symbols) if SAS is
    not configured.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    James Bottomley
     

07 Sep, 2015

1 commit


18 Jul, 2014

1 commit

  • The SCSI standard defines 64-bit values for LUNs, and large arrays
    employing large or hierarchical LUN numbers become more and more
    common.

    So update the linux SCSI stack to use 64-bit LUN numbers.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Ewan Milne
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     

23 May, 2014

1 commit

  • The recent change in sysfs, bcdde7e221a8750f9b62b6d0bd31b72ea4ad9309
    "sysfs: make __sysfs_remove_dir() recursive" revealed an asymmetric
    rphy device creation/deletion sequence in scsi_transport_sas:

    modprobe mpt2sas
    sas_rphy_add
    device_add A rphy->dev
    device_add B sas_device transport class
    device_add C sas_end_device transport class
    device_add D bsg class

    rmmod mpt2sas
    sas_rphy_delete
    sas_rphy_remove
    device_del B
    device_del C
    device_del A
    sysfs_remove_group recursive sysfs dir removal
    sas_rphy_free
    device_del D warning

    where device A is the parent of B, C, and D.

    When sas_rphy_free tries to unregister the bsg request queue (device D
    above), the ensuing sysfs cleanup discovers that its sysfs group has
    already been removed and emits a warning, "sysfs group... not found for
    kobject 'end_device-X:0'".

    Since bsg creation is a side effect of sas_rphy_add, move its
    complementary removal call into sas_rphy_remove. This imposes the
    following tear-down order for the devices above: D, B, C, A.

    Note the sas_device and sas_end_device transport class devices (B and C
    above) are created and destroyed both via the list match traversal in
    attribute_container_device_trigger, so the order in which they are
    handled is fixed. This is fine as long as they are deleted before their
    parent device.

    Signed-off-by: Joe Lawrence
    Acked-by: Dan Williams
    Signed-off-by: James Bottomley

    Joe Lawrence
     

01 Dec, 2012

1 commit


01 Mar, 2012

2 commits

  • If userspace requests a phy reset, treat that as a request for the phy
    to be enabled since that is the effect on hardware.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • In the direct-attached case this routine returns the phy on which this
    device was first discovered. Which is broken if we want to support
    wide-targets, as this phy reference can become stale even though the
    port is still active.

    In the expander-attached case this routine tries to lookup the phy by
    scanning the attached sas addresses of the parent expander, and BUG_ONs
    if it can't find it. However since eh and the libsas workqueue run
    independently we can still be attempting device recovery via eh after
    libsas has recorded the device as detached. This is even easier to hit
    now that eh is blocked while device domain rediscovery takes place, and
    that libata is fed more timed out commands increasing the chances that
    it will try to recover the ata device.

    Arrange for dev->phy to always point to a last known good phy, it may be
    stale after the port is torn down, but it will catch up for wide port
    reconfigurations, and never be NULL.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

20 Feb, 2012

2 commits

  • Extend the sas transport class to allow transport users to attach extra
    data to a sas_phy (->hostdata). Use this area in libsas to move resets
    to workq context in preparation for scheduling ata device resets through
    libata-eh.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • libata error handling provides for a timeout for link recovery. libsas
    must not rescan for previously known devices in this interval otherwise
    it may remove a device that is simply waiting for its link to recover.
    Let libata-eh make the determination of when the link is stable and
    prevent libsas (host workqueue) from taking action while this
    determination is pending.

    Using a mutex (ha->disco_mutex) to flush and disable revalidation while
    eh is running requires any discovery action that may block on eh be
    moved to its own context outside the lock. Probing ATA devices
    explicitly waits on ata-eh and the cache-flush-io issued during device
    removal may also pend awaiting eh completion. Essentially any rphy
    add/remove activity needs to run outside the lock.

    This adds two new cleanup states for sas_unregister_domain_devices()
    'allocated-but-not-probed', and 'flagged-for-destruction'. In the
    'allocated-but-not-probed' state dev->rphy points to a rphy that is
    known to have not been through a sas_rphy_add() event. At domain
    teardown check if this device is still pending probe and cleanup
    accordingly. Similarly if a device has already been queued for removal
    then sas_unregister_domain_devices has nothing to do.

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

03 Oct, 2011

1 commit

  • Currently mvsas and pm8001 have custom ->slave_alloc implementations to
    achieve this. Uplevel it for all libsas drivers as isci encounters problems
    with atapi devices when scanning past lun0.

    Just do what Darrick suggested [1], and limit the scan for ata devices.

    [1] http://marc.info/?l=linux-scsi&m=116604101119861&w=2

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

10 Mar, 2011

1 commit

  • Code has been converted over to the new explicit on-stack plugging,
    and delay users have been converted to use the new API for that.
    So lets kill off the old plugging along with aops->sync_page().

    Signed-off-by: Jens Axboe

    Jens Axboe
     

09 Feb, 2010

1 commit


04 Dec, 2009

1 commit

  • That is "success", "unknown", "through", "performance", "[re|un]mapping"
    , "access", "default", "reasonable", "[con]currently", "temperature"
    , "channel", "[un]used", "application", "example","hierarchy", "therefore"
    , "[over|under]flow", "contiguous", "threshold", "enough" and others.

    Signed-off-by: André Goddard Rosa
    Signed-off-by: Jiri Kosina

    André Goddard Rosa
     

23 Aug, 2009

1 commit


21 Jun, 2009

1 commit


11 May, 2009

1 commit

  • Till now block layer allowed two separate modes of request execution.
    A request is always acquired from the request queue via
    elv_next_request(). After that, drivers are free to either dequeue it
    or process it without dequeueing. Dequeue allows elv_next_request()
    to return the next request so that multiple requests can be in flight.

    Executing requests without dequeueing has its merits mostly in
    allowing drivers for simpler devices which can't do sg to deal with
    segments only without considering request boundary. However, the
    benefit this brings is dubious and declining while the cost of the API
    ambiguity is increasing. Segment based drivers are usually for very
    old or limited devices and as converting to dequeueing model isn't
    difficult, it doesn't justify the API overhead it puts on block layer
    and its more modern users.

    Previous patches converted all block low level drivers to dequeueing
    model. This patch completes the API transition by...

    * renaming elv_next_request() to blk_peek_request()

    * renaming blkdev_dequeue_request() to blk_start_request()

    * adding blk_fetch_request() which is combination of peek and start

    * disallowing completion of queued (not started) requests

    * applying new API to all LLDs

    Renamings are for consistency and to break out of tree code so that
    it's apparent that out of tree drivers need updating.

    [ Impact: block request issue API cleanup, no functional change ]

    Signed-off-by: Tejun Heo
    Cc: Rusty Russell
    Cc: James Bottomley
    Cc: Mike Miller
    Cc: unsik Kim
    Cc: Paul Clements
    Cc: Tim Waugh
    Cc: Geert Uytterhoeven
    Cc: David S. Miller
    Cc: Laurent Vivier
    Cc: Jeff Garzik
    Cc: Jeremy Fitzhardinge
    Cc: Grant Likely
    Cc: Adrian McMenamin
    Cc: Stephen Rothwell
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Borislav Petkov
    Cc: Sergei Shtylyov
    Cc: Alex Dubov
    Cc: Pierre Ossman
    Cc: David Woodhouse
    Cc: Markus Lidel
    Cc: Stefan Weinhuber
    Cc: Martin Schwidefsky
    Cc: Pete Zaitcev
    Cc: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    Tejun Heo
     

03 Jan, 2009

1 commit


27 Jul, 2008

1 commit


29 Apr, 2008

1 commit


23 Apr, 2008

2 commits

  • scsi_transport_sas calls blk_cleanup_queue too early for bsg
    queues. If a user holds a sas_host, end_device, or expander device
    open, remove the device, then send a request to it, we get a kernel
    crash. We need to call blk_cleanup_queue in the release callback as we
    do with scsi devices.

    This patch moves blk_cleanup_queue to sas_expander_release and
    sas_end_device_release from sas_bsg_remove. sas_host can't use the
    release callback in struct device so use bsg's release callback.

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

    FUJITA Tomonori
     
  • This patch adds release callback support, which is called when a bsg
    device goes away. bsg_register_queue() takes a pointer to a callback
    function. This feature is useful for stuff like sas_host that can't
    use the release callback in struct device.

    If a caller doesn't need bsg's release callback, it can call
    bsg_register_queue() with NULL pointer (e.g. scsi devices can use
    release callback in struct device so they don't need bsg's callback).

    With this patch, bsg uses kref for refcounts on bsg devices instead of
    get/put_device in fops->open/release. bsg calls put_device and the
    caller's release callback (if it was registered) in kref_put's
    release.

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

    FUJITA Tomonori
     

20 Apr, 2008

1 commit


03 Feb, 2008

1 commit


12 Jan, 2008

2 commits

  • Currently in BSG, errors returned in req->errors aren't passed back to
    the calling programme (either via SG_IO or via read/write). Fix this,
    while preserving the SCSI convention of returning status in
    req->errors.

    Now update libsas to return errors correctly instead of to ignore
    them.

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

    James Bottomley
     
  • Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update
    lots of kerneldoc comments in drivers/scsi/*.

    Updated with comments from Stefan Richter, Stephen M. Cameron,
    James Bottomley and Randy Dunlap.

    Signed-off-by: Rob Landley
    Signed-off-by: James Bottomley

    Rob Landley