12 Jul, 2019

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs,
    mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the
    removal of the osst driver (I heard from Willem privately that he
    would like the driver removed because all his test hardware has
    failed). Plus number of minor changes, spelling fixes and other
    trivia.

    The big merge conflict this time around is the SPDX licence tags.
    Following discussion on linux-next, we believe our version to be more
    accurate than the one in the tree, so the resolution is to take our
    version for all the SPDX conflicts"

    Note on the SPDX license tag conversion conflicts: the SCSI tree had
    done its own SPDX conversion, which in some cases conflicted with the
    treewide ones done by Thomas & co.

    In almost all cases, the conflicts were purely syntactic: the SCSI tree
    used the old-style SPDX tags ("GPL-2.0" and "GPL-2.0+") while the
    treewide conversion had used the new-style ones ("GPL-2.0-only" and
    "GPL-2.0-or-later").

    In these cases I picked the new-style one.

    In a few cases, the SPDX conversion was actually different, though. As
    explained by James above, and in more detail in a pre-pull-request
    thread:

    "The other problem is actually substantive: In the libsas code Luben
    Tuikov originally specified gpl 2.0 only by dint of stating:

    * This file is licensed under GPLv2.

    In all the libsas files, but then muddied the water by quoting GPLv2
    verbatim (which includes the or later than language). So for these
    files Christoph did the conversion to v2 only SPDX tags and Thomas
    converted to v2 or later tags"

    So in those cases, where the spdx tag substantially mattered, I took the
    SCSI tree conversion of it, but then also took the opportunity to turn
    the old-style "GPL-2.0" into a new-style "GPL-2.0-only" tag.

    Similarly, when there were whitespace differences or other differences
    to the comments around the copyright notices, I took the version from
    the SCSI tree as being the more specific conversion.

    Finally, in the spdx conversions that had no conflicts (because the
    treewide ones hadn't been done for those files), I just took the SCSI
    tree version as-is, even if it was old-style. The old-style conversions
    are perfectly valid, even if the "-only" and "-or-later" versions are
    perhaps more descriptive.

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (185 commits)
    scsi: qla2xxx: move IO flush to the front of NVME rport unregistration
    scsi: qla2xxx: Fix NVME cmd and LS cmd timeout race condition
    scsi: qla2xxx: on session delete, return nvme cmd
    scsi: qla2xxx: Fix kernel crash after disconnecting NVMe devices
    scsi: megaraid_sas: Update driver version to 07.710.06.00-rc1
    scsi: megaraid_sas: Introduce various Aero performance modes
    scsi: megaraid_sas: Use high IOPS queues based on IO workload
    scsi: megaraid_sas: Set affinity for high IOPS reply queues
    scsi: megaraid_sas: Enable coalescing for high IOPS queues
    scsi: megaraid_sas: Add support for High IOPS queues
    scsi: megaraid_sas: Add support for MPI toolbox commands
    scsi: megaraid_sas: Offload Aero RAID5/6 division calculations to driver
    scsi: megaraid_sas: RAID1 PCI bandwidth limit algorithm is applicable for only Ventura
    scsi: megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD
    scsi: megaraid_sas: Handle sequence JBOD map failure at driver level
    scsi: megaraid_sas: Don't send FPIO to RL Bypass queue
    scsi: megaraid_sas: In probe context, retry IOC INIT once if firmware is in fault
    scsi: megaraid_sas: Release Mutex lock before OCR in case of DCMD timeout
    scsi: megaraid_sas: Call disable_irq from process IRQ poll
    scsi: megaraid_sas: Remove few debug counters from IO path
    ...

    Linus Torvalds
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 675 mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 44 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Steve Winslow
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528170025.980374610@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


13 Jun, 2018

1 commit

  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

05 Dec, 2017

1 commit

  • We are testing if there is a match with the ses device in a loop by
    calling ses_match_to_enclosure(), which will issue scsi receive
    diagnostics commands to the ses device for every device on the same
    host. On one of our boxes with 840 disks, it takes a long time to load
    the driver:

    [root@g1b-oss06 ~]# time modprobe ses

    real 40m48.247s
    user 0m0.001s
    sys 0m0.196s

    With the patch:

    [root@g1b-oss06 ~]# time modprobe ses

    real 0m17.915s
    user 0m0.008s
    sys 0m0.053s

    Note that we still need to refresh page 10 when we see a new disk to
    create the link.

    Signed-off-by: Li Dongyang
    Tested-by: Jason Ozolins
    Signed-off-by: Martin K. Petersen

    Li Dongyang
     

08 Sep, 2017

1 commit


26 Aug, 2017

1 commit

  • Currently we free the resources backing the enclosure device before we
    call device_unregister(). This is racy: during rmmod of low-level SCSI
    drivers that hook into enclosure, we end up with a small window of time
    during which writing to /sys can OOPS. Example trace with mpt3sas:

    general protection fault: 0000 [#1] SMP KASAN
    Modules linked in: mpt3sas(-)
    RIP: [] ses_get_page2_descriptor.isra.6+0x38/0x220 [ses]
    Call Trace:
    [] ses_set_fault+0xf4/0x400 [ses]
    [] set_component_fault+0xa9/0xf0 [enclosure]
    [] dev_attr_store+0x3c/0x70
    [] sysfs_kf_write+0x115/0x180
    [] kernfs_fop_write+0x275/0x3a0
    [] __vfs_write+0xe0/0x3e0
    [] vfs_write+0x13f/0x4a0
    [] SyS_write+0x111/0x230
    [] entry_SYSCALL_64_fastpath+0x13/0x94

    Fortunately the solution is extremely simple: call device_unregister()
    before we free the resources, and the race no longer exists. The driver
    core holds a reference over ->remove_dev(), so AFAICT this is safe.

    Signed-off-by: Calvin Owens
    Acked-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Calvin Owens
     

25 Aug, 2017

3 commits


08 Aug, 2017

1 commit

  • If a SES device returns an error on a requested diagnostic page, we are
    currently printing an error indicating the wrong page was received. Fix
    this up to simply return a failure and only check the returned page when
    the diagnostic page buffer was populated by the device.

    Signed-off-by: Brian King
    Signed-off-by: Martin K. Petersen

    Brian King
     

07 Apr, 2017

1 commit

  • The commit 08024885a2a3 ("ses: Add power_status to SES device slot")
    introduced the 'power_status' attribute to enclosure components and
    the associated callbacks.

    There are 2 callbacks available to get the power status of a device:
    1) ses_get_power_status() for 'struct enclosure_component_callbacks'
    2) get_component_power_status() for the sysfs device attribute
    (these are available for kernel-space and user-space, respectively.)

    However, despite both methods being available to get power status
    on demand, that commit also introduced a call to get power status
    in ses_enclosure_data_process().

    This dramatically increased the total probe time for SCSI devices
    on larger configurations, because ses_enclosure_data_process() is
    called several times during the SCSI devices probe and loops over
    the component devices (but that is another problem, another patch).

    That results in a tremendous continuous hammering of SCSI Receive
    Diagnostics commands to the enclosure-services device, which does
    delay the total probe time for the SCSI devices __significantly__:

    Originally, ~34 minutes on a system attached to ~170 disks:

    [ 9214.490703] mpt3sas version 13.100.00.00 loaded
    ...
    [11256.580231] scsi 17:0:177:0: qdepth(16), tagged(1), simple(0),
    ordered(0), scsi_level(6), cmd_que(1)

    With this patch, it decreased to ~2.5 minutes -- a 13.6x faster

    [ 1002.992533] mpt3sas version 13.100.00.00 loaded
    ...
    [ 1151.978831] scsi 11:0:177:0: qdepth(16), tagged(1), simple(0),
    ordered(0), scsi_level(6), cmd_que(1)

    Back to the commit discussion.. on the ses_get_power_status() call
    introduced in ses_enclosure_data_process(): impact of removing it.

    That may possibly be in place to initialize the power status value
    on device probe. However, those 2 functions available to retrieve
    that value _do_ automatically refresh/update it. So the potential
    benefit would be a direct access of the 'power_status' field which
    does not use the callbacks...

    But the only reader of 'struct enclosure_component::power_status'
    is the get_component_power_status() callback for sysfs attribute,
    and it _does_ check for and call the .get_power_status callback,
    (which indeed is defined and implemented by that commit), so the
    power status value is, again, automatically updated.

    So, the remaining potential for a direct/non-callback access to
    the power_status attribute would be out-of-tree modules -- well,
    for those, if they are for whatever reason interested in values
    that are set during device probe and not up-to-date by the time
    they need it.. well, that would be curious.

    Well, to handle that more properly, set the initial power state
    value to '-1' (i.e., uninitialized) instead of '1' (power 'on'),
    and check for it in that callback which may do an direct access
    to the field value _if_ a callback function is not defined.

    Signed-off-by: Mauricio Faria de Oliveira
    Fixes: 08024885a2a3 ("ses: Add power_status to SES device slot")
    Reviewed-by: Dan Williams
    Reviewed-by: Song Liu
    Signed-off-by: Martin K. Petersen

    Mauricio Faria de Oliveira
     

18 Jan, 2017

1 commit

  • The call to scsi_is_sas_rphy() needs to be made on the SAS end_device,
    not on the SCSI device.

    Fixes: 835831c57e9b ("ses: use scsi_is_sas_rphy instead of is_sas_attached")
    Signed-off-by: Ewan D. Milne
    Reviewed-by: Johannes Thumshirn
    Reviewed-by: James Bottomley
    Signed-off-by: Martin K. Petersen

    Ewan D. Milne
     

19 Aug, 2016

1 commit

  • Use scsi_is_sas_rphy() instead of is_sas_attached() to decide whether we
    should obtain the SAS address from a scsi device or not. This will
    prevent us from tripping on the BUG_ON() in sas_sdev_to_rdev() if the
    rphy isn't attached to the SAS transport class, like it is with hpsa's
    logical devices.

    Fixes: 3f8d6f2a0 ('ses: fix discovery of SATA devices in SAS enclosures')
    Signed-off-by: Johannes Thumshirn
    Reviewed-by: James E.J. Bottomley
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     

13 Aug, 2016

1 commit

  • Currently we free the resources backing the enclosure device before we
    call device_unregister(). This is racy: during rmmod of low-level SCSI
    drivers that hook into enclosure, we end up with a small window of time
    during which writing to /sys can OOPS. Example trace with mpt3sas:

    general protection fault: 0000 [#1] SMP KASAN
    Modules linked in: mpt3sas(-)
    RIP: [] ses_get_page2_descriptor.isra.6+0x38/0x220 [ses]
    Call Trace:
    [] ses_set_fault+0xf4/0x400 [ses]
    [] set_component_fault+0xa9/0xf0 [enclosure]
    [] dev_attr_store+0x3c/0x70
    [] sysfs_kf_write+0x115/0x180
    [] kernfs_fop_write+0x275/0x3a0
    [] __vfs_write+0xe0/0x3e0
    [] vfs_write+0x13f/0x4a0
    [] SyS_write+0x111/0x230
    [] entry_SYSCALL_64_fastpath+0x13/0x94

    Fortunately the solution is extremely simple: call device_unregister()
    before we free the resources, and the race no longer exists. The driver
    core holds a reference over ->remove_dev(), so AFAICT this is safe.

    Signed-off-by: Calvin Owens
    Reviewed-by: James Bottomley
    Signed-off-by: Martin K. Petersen

    Calvin Owens
     

19 Dec, 2015

1 commit

  • The current discovery routines use the VPD 0x83 inquiry page to find
    the device SAS address and match it to the end point in the enclosure.
    This doesn't work for SATA devices because expanders (or hosts) simply
    make up an endpoint address for STP and thus the address returned by
    the VPD page never matches. Instead of doing this, for SAS attached
    devices, match by the direct endpoint address instead.

    Signed-off-by: James Bottomley

    James Bottomley
     

12 Dec, 2015

1 commit

  • KASAN found that our additional element processing scripts drop off
    the end of the VPD page into unallocated space. The reason is that
    not every element has additional information but our traversal
    routines think they do, leading to them expecting far more additional
    information than is present. Fix this by adding a gate to the
    traversal routine so that it only processes elements that are expected
    to have additional information (list is in SES-2 section 6.1.13.1:
    Additional Element Status diagnostic page overview)

    Reported-by: Pavel Tikhomirov
    Tested-by: Pavel Tikhomirov
    Cc: stable@vger.kernel.org
    Signed-off-by: James Bottomley

    James Bottomley
     

11 Dec, 2015

1 commit

  • Simple enclosure implementations (mostly USB) are allowed to return only
    page 8 to every diagnostic query. That really confuses our
    implementation because we assume the return is the page we asked for and
    end up doing incorrect offsets based on bogus information leading to
    accesses outside of allocated ranges. Fix that by checking the page
    code of the return and giving an error if it isn't the one we asked for.
    This should fix reported bugs with USB storage by simply refusing to
    attach to enclosures that behave like this. It's also good defensive
    practise now that we're starting to see more USB enclosures.

    Reported-by: Andrea Gelmini
    Cc: stable@vger.kernel.org
    Reviewed-by: Ewan D. Milne
    Reviewed-by: Tomas Henzl
    Signed-off-by: James Bottomley

    James Bottomley
     

09 Jan, 2015

5 commits

  • Add power_status to SES device slot, so we can power on/off the
    HDDs behind the enclosure.

    Check firmware status in ses_set_* before sending control pages to
    firmware.

    Signed-off-by: Song Liu
    Acked-by: Dan Williams
    Reviewed-by: Jens Axboe
    Cc: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Song Liu
     
  • The name provided by firmware is in a vendor specific format, publish
    the slot number to have a reliable mechanism for identifying slots
    across firmware implementations. If the enclosure does not provide a
    slot number fallback to the component number which is guaranteed unique,
    and usually mirrors the slot number.

    Cleaned up the unused ses_component.desc in the process.

    Signed-off-by: Dan Williams
    Signed-off-by: Song Liu
    Reviewed-by: Jens Axboe
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Dan Williams
     
  • Export the NAA logical id for the enclosure. This is optionally
    available from the sas_transport_class, but it is really a property of
    the enclosure.

    Signed-off-by: Dan Williams
    Signed-off-by: Song Liu
    Reviewed-by: Jens Axboe
    Cc: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Dan Williams
     
  • In support of a /dev/disk/by-slot populated with data from the enclosure
    and ses modules udev needs notification when the new interface
    files/links are available. Otherwise, any udev rules specified for the
    disk cannot assume that the enclosure topology has settled.

    Signed-off-by: Dan Williams
    Signed-off-by: Song Liu
    Reviewed-by: Jens Axboe
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Dan Williams
     
  • The slot and address fields have a small window of instability when
    userspace can read them before initialization. Separate
    enclosure_component
    allocation from registration.

    Signed-off-by: Dan Williams
    Signed-off-by: Song Liu
    Reviewed-by: Jens Axboe
    Cc: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Dan Williams
     

25 Nov, 2014

1 commit

  • The driver core driver structure has grown an owner field and now
    requires it to be set for all modular drivers. Set it up for
    all scsi_driver instances and get rid of the now superflous
    scsi_driver owner field.

    Signed-off-by: Christoph Hellwig
    Reported-by: Shane M Seymour
    Reviewed-by: Ewan D. Milne

    Christoph Hellwig
     

27 Mar, 2014

1 commit


30 Jun, 2011

1 commit

  • Noticed that when the sysfs interface of the SCSI SES
    driver was used to request a fault indication the LED
    flashed but the buzzer didn't sound. So it was doing
    what REQUEST IDENT (locate) should do.

    Changelog:
    - fix the setting of REQUEST FAULT for the device slot
    and array device slot elements in the enclosure control
    diagnostic page
    - note the potentially defective code that reads the
    FAULT SENSED and FAULT REQUESTED bits from the enclosure
    status diagnostic page

    The attached patch is against git/scsi-misc-2.6

    Signed-off-by: Douglas Gilbert
    Cc: stable@kernel.org
    Signed-off-by: James Bottomley

    Douglas Gilbert
     

24 Mar, 2011

2 commits

  • There have been many complaints that an enclosure with subenclosures
    isn't attached to by the ses driver. Until now, though, no-one had
    been willing to provide access to one.

    Subenclosures are added simply by flattening the tree (i.e. all
    subenclosure devices show up under the one main device). This may have
    consequences if the naming is only unique per subenclosure, but that's a
    bug for another day. The tested array had no page 7, so no device
    naming at all. It also only had the disk devices on one of its
    subenclosures (all the others had power, fans, temperature and various
    sensors), so testing of this is fairly rudimentary.

    Signed-off-by: James Bottomley

    James Bottomley
     
  • enclosure page 7 gives us the "pretty" names of the enclosure slots.
    Without a page 7, we can still use the enclosure code as long as we
    make up numeric names for the slots. Unfortunately, the current code
    fails to add any devices because the check for page 10 is in the wrong
    place if we have no page 7. Fix it so that devices show up even if
    the enclosure has no page 7.

    Cc: stable@kernel.org
    Signed-off-by: James Bottomley

    John Hughes
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

13 Mar, 2010

1 commit

  • The few lines below the kfree of hdr_buf may go to the label err_free
    which will also free hdr_buf. The most straightforward solution seems to
    be to just move the kfree of hdr_buf after these gotos.

    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @r@
    identifier E;
    expression E1;
    iterator I;
    statement S;
    @@

    *kfree(E);
    ... when != E = E1
    when != I(E,...) S
    when != &E
    *kfree(E);
    //

    Signed-off-by: Julia Lawall
    Cc: James Bottomley
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Julia Lawall
     

19 Jan, 2010

1 commit


23 Aug, 2009

3 commits

  • Now that hot add works correctly, if a new device is added, we're still
    operating on stale enclosure data, so fix that by updating the enclosure
    diagnostic pages when we get notified of a device hot add

    Signed-off-by: James Bottomley
    Signed-off-by: James Bottomley

    James Bottomley
     
  • Right at the moment, hot removal of a device within an enclosure does
    nothing (because the intf_remove only copes with enclosure removal not
    with component removal). Fix this by adding a function to remove the
    component. Also needed to fix the prototype of
    enclosure_remove_device, since we know the device we've removed but
    not the internal component number

    Signed-off-by: James Bottomley
    Signed-off-by: James Bottomley

    James Bottomley
     
  • In a situation either with expanders or with multiple enclosure
    devices, hot add doesn't always work. This is because we try to find
    a single enclosure device attached to the host. Fix this by looping
    over all enclosure devices attached to the host and also by making the
    find loop recognise that the enclosure devices may be expander remote
    (i.e. not parented by the host).

    Signed-off-by: James Bottomley
    Signed-off-by: James Bottomley

    James Bottomley
     

03 Apr, 2009

1 commit


13 Mar, 2009

2 commits


03 Jan, 2009

1 commit


30 Dec, 2008

1 commit


30 Jul, 2008

1 commit

  • There are a few kerneloops.org reports like this one:

    http://www.kerneloops.org/search.php?search=ses_match_to_enclosure

    That seem to imply we're running off the end of the VPD inquiry data
    (although at 512 bytes, it should be long enough for just about
    anything). we should be using correctly sized buffers anyway, so put
    those in and hope this oops goes away.

    Cc: Stable Tree
    Signed-off-by: James Bottomley

    James Bottomley