17 Nov, 2020

1 commit

  • iSCSI NOPs are sometimes "lost", mistakenly sent to the user-land iscsid
    daemon instead of handled in the kernel, as they should be, resulting in a
    message from the daemon like:

    iscsid: Got nop in, but kernel supports nop handling.

    This can occur because of the new forward- and back-locks, and the fact
    that an iSCSI NOP response can occur before processing of the NOP send is
    complete. This can result in "conn->ping_task" being NULL in
    iscsi_nop_out_rsp(), when the pointer is actually in the process of being
    set.

    To work around this, we add a new state to the "ping_task" pointer. In
    addition to NULL (not assigned) and a pointer (assigned), we add the state
    "being set", which is signaled with an INVALID pointer (using "-1").

    Link: https://lore.kernel.org/r/20201106193317.16993-1-leeman.duncan@gmail.com
    Reviewed-by: Mike Christie
    Signed-off-by: Lee Duncan
    Signed-off-by: Martin K. Petersen

    Lee Duncan
     

24 Oct, 2020

1 commit

  • Pull more SCSI updates from James Bottomley:
    "The set of core changes here is Christoph's submission path cleanups.

    These introduced a couple of regressions when first proposed so they
    got held over from the initial merge window pull request to give more
    testing time, which they've now had and Syzbot has confirmed the
    regression it detected is fixed.

    The other main changes are two driver updates (arcmsr, pm80xx) and
    assorted minor clean ups"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (38 commits)
    scsi: qla2xxx: Fix return of uninitialized value in rval
    scsi: core: Set sc_data_direction to DMA_NONE for no-transfer commands
    scsi: sr: Initialize ->cmd_len
    scsi: arcmsr: Update driver version to v1.50.00.02-20200819
    scsi: arcmsr: Add support for ARC-1886 series RAID controllers
    scsi: arcmsr: Fix device hot-plug monitoring timer stop
    scsi: arcmsr: Remove unnecessary syntax
    scsi: pm80xx: Driver version update
    scsi: pm80xx: Increase the number of outstanding I/O supported to 1024
    scsi: pm80xx: Remove DMA memory allocation for ccb and device structures
    scsi: pm80xx: Increase number of supported queues
    scsi: sym53c8xx_2: Fix sizeof() mismatch
    scsi: isci: Fix a typo in a comment
    scsi: qla4xxx: Fix inconsistent format argument type
    scsi: myrb: Fix inconsistent format argument types
    scsi: myrb: Remove redundant assignment to variable timeout
    scsi: bfa: Fix error return in bfad_pci_init()
    scsi: fcoe: Simplify the return expression of fcoe_sysfs_setup()
    scsi: snic: Simplify the return expression of svnic_cq_alloc()
    scsi: fnic: Simplify the return expression of vnic_wq_copy_alloc()
    ...

    Linus Torvalds
     

15 Oct, 2020

1 commit

  • Pull SCSI updates from James Bottomley:
    "The usual driver updates (ufs, qla2xxx, tcmu, ibmvfc, lpfc, smartpqi,
    hisi_sas, qedi, qedf, mpt3sas) and minor bug fixes.

    There are only three core changes: adding sense codes, cleaning up
    noretry and adding an option for limitless retries"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (226 commits)
    scsi: hisi_sas: Recover PHY state according to the status before reset
    scsi: hisi_sas: Filter out new PHY up events during suspend
    scsi: hisi_sas: Add device link between SCSI devices and hisi_hba
    scsi: hisi_sas: Add check for methods _PS0 and _PR0
    scsi: hisi_sas: Add controller runtime PM support for v3 hw
    scsi: hisi_sas: Switch to new framework to support suspend and resume
    scsi: hisi_sas: Use hisi_hba->cq_nvecs for calling calling synchronize_irq()
    scsi: qedf: Remove redundant assignment to variable 'rc'
    scsi: lpfc: Remove unneeded variable 'status' in lpfc_fcp_cpu_map_store()
    scsi: snic: Convert to use DEFINE_SEQ_ATTRIBUTE macro
    scsi: qla4xxx: Delete unneeded variable 'status' in qla4xxx_process_ddb_changed
    scsi: sun_esp: Use module_platform_driver to simplify the code
    scsi: sun3x_esp: Use module_platform_driver to simplify the code
    scsi: sni_53c710: Use module_platform_driver to simplify the code
    scsi: qlogicpti: Use module_platform_driver to simplify the code
    scsi: mac_esp: Use module_platform_driver to simplify the code
    scsi: jazz_esp: Use module_platform_driver to simplify the code
    scsi: mvumi: Fix error return in mvumi_io_attach()
    scsi: lpfc: Drop nodelist reference on error in lpfc_gen_req()
    scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()
    ...

    Linus Torvalds
     

08 Oct, 2020

1 commit

  • Rename scsi_init_io() to scsi_alloc_sgtables(), and ensure callers call
    scsi_free_sgtables() to cleanup failures close to scsi_init_io() instead of
    leaking it down the generic I/O submission path.

    Link: https://lore.kernel.org/r/20201005084130.143273-9-hch@lst.de
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

06 Oct, 2020

1 commit

  • Add Host and host template flag 'host_tagset' so hostwide tagset can be
    shared on multiple reply queues after the SCSI device's reply queue is
    converted to blk-mq hw queue.

    [jpg: Update comment on .can_queue and add Scsi_Host.host_tagset]

    Signed-off-by: Hannes Reinecke
    Signed-off-by: John Garry
    Tested-by: Don Brace #SCSI resv cmds patches used
    Tested-by: Douglas Gilbert
    Acked-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Hannes Reinecke
     

03 Oct, 2020

1 commit

  • trace-cmd report doesn't show events from target subsystem because
    scsi_command_size() leaks through event format string:

    [target:target_sequencer_start] function scsi_command_size not defined
    [target:target_cmd_complete] function scsi_command_size not defined

    Addition of scsi_command_size() to plugin_scsi.c in trace-cmd doesn't
    help because an expression is used inside TP_printk(). trace-cmd event
    parser doesn't understand minus sign inside [ ]:

    Error: expected ']' but read '-'

    Rather than duplicating kernel code in plugin_scsi.c, provide a dedicated
    field for CONTROL byte.

    Link: https://lore.kernel.org/r/20200929125957.83069-1-r.bolshakov@yadro.com
    Reviewed-by: Mike Christie
    Signed-off-by: Roman Bolshakov
    Signed-off-by: Martin K. Petersen

    Roman Bolshakov
     

16 Sep, 2020

1 commit

  • The request queue is currently run unconditionally in scsi_end_request() if
    both target queue and host queue are ready.

    Recently Long Li reported that cost of a queue run can be very heavy in
    case of high queue depth. Improve this situation by only running the
    request queue when this LUN is busy.

    Link: https://lore.kernel.org/r/20200910075056.36509-1-ming.lei@redhat.com
    Reported-by: Long Li
    Tested-by: Long Li
    Tested-by: Kashyap Desai
    Reviewed-by: Bart Van Assche
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Ewan D. Milne
    Reviewed-by: John Garry
    Signed-off-by: Ming Lei
    Signed-off-by: Martin K. Petersen

    Ming Lei
     

03 Sep, 2020

1 commit


25 Jul, 2020

2 commits

  • scsi_host_find_tag() is used by the drivers to return a scsi command based
    on the command tag. Typically it's used from the interrupt handler to fetch
    the command associated with a value returned from hardware. Some drivers
    like fnic or qla4xxx, however, also use it also to traverse outstanding
    commands. With the current implementation scsi_host_find_tag() will return
    commands even if they are not started (i.e. passed to the driver). This
    will result in random errors with those drivers. With this patch
    scsi_host_find_tag() will only return 'started' commands (i.e. commands
    which have been passed to the drivers) thus avoiding the above issue. The
    other use cases will be unaffected as the interrupt handler naturally will
    only ever return 'started' requests.

    Link: https://lore.kernel.org/r/20200622063022.67891-1-hare@suse.de
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     
  • Drop the repeated word "the" in a comment.

    Link: https://lore.kernel.org/r/20200719003232.21301-1-rdunlap@infradead.org
    Cc: "James E.J. Bottomley"
    Cc: "Martin K. Petersen"
    Cc: linux-scsi@vger.kernel.org
    Signed-off-by: Randy Dunlap
    Signed-off-by: Martin K. Petersen

    Randy Dunlap
     

16 Jul, 2020

1 commit

  • According to 'include/scsi/scsi_transport_fc.h':

    "Attributes are based on HBAAPI V2.0 definitions"

    ... so it seems sane to match the 'HBA Attribute Length' to them.

    If we don't, the compiler complains that the copied data will be truncated.

    Fixes the following W=1 kernel build warning(s):

    In file included from include/linux/bitmap.h:9,
    from include/linux/cpumask.h:12,
    from include/linux/smp.h:13,
    from include/linux/percpu.h:7,
    from include/scsi/libfc.h:13,
    from drivers/scsi/libfc/fc_elsct.c:17:
    In function ‘strncpy’,
    inlined from ‘fc_ct_ms_fill.constprop’ at include/scsi/fc_encode.h:263:3:
    include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length 79 [-Wstringop-truncation]
    297 | #define __underlying_strncpy __builtin_strncpy
    | ^
    include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
    307 | return __underlying_strncpy(p, q, size);
    | ^~~~~~~~~~~~~~~~~~~~
    In function ‘strncpy’,
    inlined from ‘fc_ct_ms_fill.constprop’ at include/scsi/fc_encode.h:275:3:
    include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length 79 [-Wstringop-truncation]
    297 | #define __underlying_strncpy __builtin_strncpy
    | ^
    include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
    307 | return __underlying_strncpy(p, q, size);
    | ^~~~~~~~~~~~~~~~~~~~

    Link: https://lore.kernel.org/r/20200713074645.126138-3-lee.jones@linaro.org
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Lee Jones
    Signed-off-by: Martin K. Petersen

    Lee Jones
     

06 Jun, 2020

1 commit

  • Pull SCSI updates from James Bottomley:
    :This series consists of the usual driver updates (qla2xxx, ufs, zfcp,
    target, scsi_debug, lpfc, qedi, qedf, hisi_sas, mpt3sas) plus a host
    of other minor updates.

    There are no major core changes in this series apart from a
    refactoring in scsi_lib.c"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (207 commits)
    scsi: ufs: ti-j721e-ufs: Fix unwinding of pm_runtime changes
    scsi: cxgb3i: Fix some leaks in init_act_open()
    scsi: ibmvscsi: Make some functions static
    scsi: iscsi: Fix deadlock on recovery path during GFP_IO reclaim
    scsi: ufs: Fix WriteBooster flush during runtime suspend
    scsi: ufs: Fix index of attributes query for WriteBooster feature
    scsi: ufs: Allow WriteBooster on UFS 2.2 devices
    scsi: ufs: Remove unnecessary memset for dev_info
    scsi: ufs-qcom: Fix scheduling while atomic issue
    scsi: mpt3sas: Fix reply queue count in non RDPQ mode
    scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
    scsi: target: tcmu: Fix a use after free in tcmu_check_expired_queue_cmd()
    scsi: vhost: Notify TCM about the maximum sg entries supported per command
    scsi: qla2xxx: Remove return value from qla_nvme_ls()
    scsi: qla2xxx: Remove an unused function
    scsi: iscsi: Register sysfs for iscsi workqueue
    scsi: scsi_debug: Parser tables and code interaction
    scsi: core: Refactor scsi_mq_setup_tags function
    scsi: core: Fix incorrect usage of shost_for_each_device
    scsi: qla2xxx: Fix endianness annotations in source files
    ...

    Linus Torvalds
     

12 May, 2020

1 commit

  • The current codebase makes use of the zero-length array language extension
    to the C90 standard, but the preferred mechanism to declare variable-length
    types such as these ones is a flexible array member[1][2], introduced in
    C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning in
    case the flexible array does not occur last in the structure, which will
    help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by this
    change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    sizeof(flexible-array-member) triggers a warning because flexible array
    members have incomplete type[1]. There are some instances of code in which
    the sizeof operator is being incorrectly/erroneously applied to zero-length
    arrays and the result is zero. Such instances may be hiding some bugs. So,
    this work (flexible-array member conversions) will also help to get
    completely rid of those sorts of issues.

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Link: https://lore.kernel.org/r/20200507192147.GA16206@embeddedor
    Reviewed-by: John Garry
    Reviewed-by: Jason Yan
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Martin K. Petersen

    Gustavo A. R. Silva
     

08 May, 2020

1 commit


23 Apr, 2020

2 commits

  • There are only two callers of blk_rq_map_sg/__blk_rq_map_sg that set
    the dma_pad value in the queue. Move the handling into those callers
    instead of burdening the common code, and move the ->extra_len field
    from struct request to struct scsi_cmnd.

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

    Christoph Hellwig
     
  • Don't burden the common block code with with specifics of the libata DMA
    draining mechanism. Instead move most of the code to the scsi midlayer.

    That also means the nr_phys_segments adjustments in the blk-mq fast path
    can go away entirely, given that SCSI never looks at nr_phys_segments
    after mapping the request to a scatterlist.

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

    Christoph Hellwig
     

03 Apr, 2020

1 commit

  • Pull SCSI updates from James Bottomley:
    "This series has a huge amount of churn because it pulls in Mauro's doc
    update changing all our txt files to rst ones.

    Excluding that, we have the usual driver updates (qla2xxx, ufs, lpfc,
    zfcp, ibmvfc, pm80xx, aacraid), a treewide update for scnprintf and
    some other minor updates.

    The major core change is Hannes moving functions out of the aacraid
    driver and into the core"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (223 commits)
    scsi: aic7xxx: aic97xx: Remove FreeBSD-specific code
    scsi: ufs: Do not rely on prefetched data
    scsi: dc395x: remove dc395x_bios_param
    scsi: libiscsi: Fix error count for active session
    scsi: hpsa: correct race condition in offload enabled
    scsi: message: fusion: Replace zero-length array with flexible-array member
    scsi: qedi: Add PCI shutdown handler support
    scsi: qedi: Add MFW error recovery process
    scsi: ufs: Enable block layer runtime PM for well-known logical units
    scsi: ufs-qcom: Override devfreq parameters
    scsi: ufshcd: Let vendor override devfreq parameters
    scsi: ufshcd: Update the set frequency to devfreq
    scsi: ufs: Resume ufs host before accessing ufs device
    scsi: ufs-mediatek: customize the delay for enabling host
    scsi: ufs: make HCE polling more compact to improve initialization latency
    scsi: ufs: allow custom delay prior to host enabling
    scsi: ufs-mediatek: use common delay function
    scsi: ufs: introduce common and flexible delay function
    scsi: ufs: use an enum for host capabilities
    scsi: ufs: fix uninitialized tx_lanes in ufshcd_disable_tx_lcc()
    ...

    Linus Torvalds
     

27 Mar, 2020

1 commit

  • If an iSCSI connection happens to fail while the daemon isn't running (due
    to a crash or for another reason), the kernel failure report is not
    received. When the daemon restarts, there is insufficient kernel state in
    sysfs for it to know that this happened. open-iscsi tries to reopen every
    connection, but on different initiators, we'd like to know which
    connections have failed.

    There is session->state, but that has a different lifetime than an iSCSI
    connection, so it doesn't directly reflect the connection state.

    [mkp: typos]

    Link: https://lore.kernel.org/r/20200317233422.532961-1-krisman@collabora.com
    Cc: Khazhismel Kumykov
    Suggested-by: Junho Ryu
    Reviewed-by: Lee Duncan
    Signed-off-by: Gabriel Krisman Bertazi
    Signed-off-by: Martin K. Petersen

    Gabriel Krisman Bertazi
     

24 Mar, 2020

1 commit

  • Call scsi_bios_ptable from scsi_partsize instead of requiring boilerplate
    code in the callers. Also switch the calling convention to match that
    of the ->bios_param instances calling this function, and use true/false
    for the return value instead of the weird -1 convention.

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

    Christoph Hellwig
     

12 Mar, 2020

4 commits

  • Large queues of I/O to offline devices that are eventually submitted when
    devices are unblocked result in a many repeated "rejecting I/O to offline
    device" messages. These messages can fill up the dmesg buffer in crash
    dumps so no useful prior messages remain. In addition, if a serial console
    is used, the flood of messages can cause a hard lockup in the console code.

    Introduce a flag indicating the message has already been logged for the
    device, and reset the flag when scsi_device_set_state() changes the device
    state.

    Link: https://lore.kernel.org/r/20200311143930.20674-1-emilne@redhat.com
    Reviewed-by: Bart van Assche
    Signed-off-by: Ewan D. Milne
    Signed-off-by: Martin K. Petersen

    Ewan D. Milne
     
  • Link: https://lore.kernel.org/r/f57b8ddf30397c2c7213e49634e5e9cbd4246368.1583136624.git.mchehab+huawei@kernel.org
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Martin K. Petersen

    Mauro Carvalho Chehab
     
  • iSCSI session destruction can be arbitrarily slow, since it might require
    network operations and serialization inside the SCSI layer. This patch
    adds a new user event to trigger the destruction work asynchronously,
    releasing the rx_queue_mutex as soon as the operation is queued and before
    it is performed. This change allows other operations to run in other
    sessions in the meantime, removing one of the major iSCSI bottlenecks for
    us.

    To prevent the session from being used after the destruction request, we
    remove it immediately from the sesslist. This simplifies the locking
    required during the asynchronous removal.

    Link: https://lore.kernel.org/r/20200227195945.761719-1-krisman@collabora.com
    Co-developed-by: Gabriel Krisman Bertazi
    Co-developed-by: Khazhismel Kumykov
    Reviewed-by: Lee Duncan
    Signed-off-by: Gabriel Krisman Bertazi
    Signed-off-by: Frank Mayhar
    Signed-off-by: Khazhismel Kumykov
    Signed-off-by: Martin K. Petersen

    Frank Mayhar
     
  • The current codebase makes use of the zero-length array language extension
    to the C90 standard, but the preferred mechanism to declare variable-length
    types such as these ones is a flexible array member[1][2], introduced in
    C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning in
    case the flexible array does not occur last in the structure, which will
    help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by this
    change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Link: https://lore.kernel.org/r/20200224161406.GA21454@embeddedor
    Reviewed-by: Lee Duncan
    Reviewed-by: Satish Kharat
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Martin K. Petersen

    Gustavo A. R. Silva
     

29 Feb, 2020

5 commits

  • The current behavior of the SCSI core is to clear driver-private data
    before preparing a request for submission to the SCSI LLD. Make it possible
    for SCSI LLDs to disable clearing of driver-private data.

    These hooks will be used by a later patch, namely "scsi: ufs: Let the SCSI
    core allocate per-command UFS data".

    Link: https://lore.kernel.org/r/20200123035637.21848-2-bvanassche@acm.org
    Cc: Tomas Winkler
    Cc: Stanley Chu
    Cc: Bean Huo
    Cc: Avri Altman
    Cc: Can Guo
    Cc: Ming Lei
    Cc: Johannes Thumshirn
    Cc: Hannes Reinecke
    Cc: Christoph Hellwig
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     
  • Remove cmd_list functionality; no users left. With that the
    scsi_put_command() becomes empty, so remove that one, too.

    Link: https://lore.kernel.org/r/20200228075318.91255-14-hare@suse.de
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Bart van Assche
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     
  • Add an iterator scsi_host_busy_iter() to traverse all busy commands. If
    locking against concurrent command completions is required, it has to be
    provided by the caller.

    Link: https://lore.kernel.org/r/20200228075318.91255-11-hare@suse.de
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     
  • Add helper functions to call scsi_internal_device_block()/
    scsi_internal_device_unblock() for all attached devices on a SCSI host.

    Link: https://lore.kernel.org/r/20200228075318.91255-9-hare@suse.de
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Bart Van Assche
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     
  • Add a helper scsi_host_complete_all_commands() to terminate all outstanding
    commands on a SCSI host.

    Link: https://lore.kernel.org/r/20200228075318.91255-3-hare@suse.de
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     

15 Feb, 2020

1 commit


11 Feb, 2020

2 commits

  • Not in use anymore. Remove the flag.

    Cc: Sathya Prakash
    Cc: Chaitra P B
    Cc: Suganath Prabu Subramani
    Cc: Kashyap Desai
    Cc: Sumit Saxena
    Cc: Shivasharan S
    Cc: Ewan D. Milne
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Bart Van Assche
    Link: https://lore.kernel.org/r/20200119071432.18558-3-ming.lei@redhat.com
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Ming Lei
    Signed-off-by: Martin K. Petersen

    Ming Lei
     
  • Connection failure processing depends on a daemon being present to (at
    least) stop the connection and start recovery. This is a problem on a
    multipath scenario, where if the daemon failed for whatever reason, the
    SCSI path is never marked as down, multipath won't perform the failover and
    IO to the device will be forever waiting for that connection to come back.

    This patch performs the connection failure entirely inside the kernel.
    This way, the failover can happen and pending IO can continue even if the
    daemon is dead. Once the daemon comes alive again, it can execute recovery
    procedures if applicable.

    Cc: Mike Christie
    Cc: Lee Duncan
    Cc: Bart Van Assche
    Link: https://lore.kernel.org/r/20200125061925.191601-1-krisman@collabora.com
    Co-developed-by: Dave Clausen
    Co-developed-by: Nick Black
    Co-developed-by: Vaibhav Nagarnaik
    Co-developed-by: Anatol Pomazau
    Co-developed-by: Tahsin Erdogan
    Co-developed-by: Frank Mayhar
    Co-developed-by: Junho Ryu
    Co-developed-by: Khazhismel Kumykov
    Reviewed-by: Reviewed-by: Khazhismel Kumykov
    Co-developed-by: Gabriel Krisman Bertazi
    Reviewed-by: Lee Duncan
    Signed-off-by: Bharath Ravi
    Signed-off-by: Dave Clausen
    Signed-off-by: Nick Black
    Signed-off-by: Vaibhav Nagarnaik
    Signed-off-by: Anatol Pomazau
    Signed-off-by: Tahsin Erdogan
    Signed-off-by: Frank Mayhar
    Signed-off-by: Junho Ryu
    Signed-off-by: Khazhismel Kumykov
    Signed-off-by: Gabriel Krisman Bertazi
    Signed-off-by: Martin K. Petersen

    Bharath Ravi
     

10 Jan, 2020

1 commit

  • Pull compat_ioctl cleanup from Arnd. Here's his description:

    This series concludes the work I did for linux-5.5 on the compat_ioctl()
    cleanup, killing off fs/compat_ioctl.c and block/compat_ioctl.c by moving
    everything into drivers.

    Overall this would be a reduction both in complexity and line count, but
    as I'm also adding documentation the overall number of lines increases
    in the end.

    My plan was originally to keep the SCSI and block parts separate.
    This did not work easily because of interdependencies: I cannot
    do the final SCSI cleanup in a good way without first addressing the
    CDROM ioctls, so this is one series that I hope could be merged through
    either the block or the scsi git trees, or possibly both if you can
    pull in the same branch.

    The series comes in these steps:

    1. clean up the sg v3 interface as suggested by Linus. I have
    talked about this with Doug Gilbert as well, and he would
    rebase his sg v4 patches on top of "compat: scsi: sg: fix v3
    compat read/write interface"

    2. Actually moving handlers out of block/compat_ioctl.c and
    block/scsi_ioctl.c into drivers, mixed in with cleanup
    patches

    3. Document how to do this right. I keep getting asked about this,
    and it helps to point to some documentation file.

    The branch is based on another one that fixes a couple of bugs found
    during the creation of this series.

    Changes since v3:
    https://lore.kernel.org/lkml/20200102145552.1853992-1-arnd@arndb.de/

    - Move sr_compat_ioctl fixup to correct patch (Ben Hutchings)
    - Add Reviewed-by tags

    Changes since v2:
    https://lore.kernel.org/lkml/20191217221708.3730997-1-arnd@arndb.de/

    - Rebase to v5.5-rc4, which contains the earlier bugfixes
    - Fix sr_block_compat_ioctl() error handling bug found by
    Ben Hutchings
    - Fix idecd_locked_compat_ioctl() compat_ptr() bug
    - Don't try to handle HDIO_DRIVE_TASKFILE in drivers/ide
    - More documentation improvements

    Changes since v1:
    https://lore.kernel.org/lkml/20191211204306.1207817-1-arnd@arndb.de/

    - move out the bugfixes into a branch for itself
    - clean up scsi sg driver further as suggested by Christoph Hellwig
    - avoid some ifdefs by moving compat_ptr() out of asm/compat.h
    - split out the blkdev_compat_ptr_ioctl function; bug spotted by
    Ben Hutchings
    - Improve formatting of documentation

    Signed-off-by: Martin K. Petersen

    Martin K. Petersen
     

03 Jan, 2020

2 commits

  • In order to move the compat handling for SCSI ioctl commands out of
    fs/compat_ioctl.c into the individual drivers, we need a helper function
    first to match the native ioctl handler called by sd, sr, st, etc.

    Reviewed-by: Ben Hutchings
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • In the v5.4 merge window, a cleanup patch from Al Viro conflicted
    with my rework of the compat handling for sg.c read(). Linus Torvalds
    did a correct merge but pointed out that the resulting code is still
    unsatisfactory.

    I later noticed that the sg_new_read() function still gets the compat
    mode wrong, when the 'count' argument is large enough to pass a
    compat_sg_io_hdr object, but not a nativ sg_io_hdr.

    To address both of these, move the definition of compat_sg_io_hdr
    into a scsi/sg.h to make it visible to sg.c and rewrite the logic
    for reading req_pack_id as well as the size check to a simpler
    version that gets the expected results.

    Fixes: c35a5cfb4150 ("scsi: sg: sg_read(): simplify reading ->pack_id of userland sg_io_hdr_t")
    Fixes: 98aaaec4a150 ("compat_ioctl: reimplement SG_IO handling")
    Reviewed-by: Ben Hutchings
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

20 Dec, 2019

1 commit


20 Nov, 2019

1 commit

  • The iSCSI target driver is the only target driver that does not wait for
    ongoing commands to finish before freeing a session. Make the iSCSI target
    driver wait for ongoing commands to finish before freeing a session. This
    patch fixes the following KASAN complaint:

    BUG: KASAN: use-after-free in __lock_acquire+0xb1a/0x2710
    Read of size 8 at addr ffff8881154eca70 by task kworker/0:2/247

    CPU: 0 PID: 247 Comm: kworker/0:2 Not tainted 5.4.0-rc1-dbg+ #6
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
    Workqueue: target_completion target_complete_ok_work [target_core_mod]
    Call Trace:
    dump_stack+0x8a/0xd6
    print_address_description.constprop.0+0x40/0x60
    __kasan_report.cold+0x1b/0x33
    kasan_report+0x16/0x20
    __asan_load8+0x58/0x90
    __lock_acquire+0xb1a/0x2710
    lock_acquire+0xd3/0x200
    _raw_spin_lock_irqsave+0x43/0x60
    target_release_cmd_kref+0x162/0x7f0 [target_core_mod]
    target_put_sess_cmd+0x2e/0x40 [target_core_mod]
    lio_check_stop_free+0x12/0x20 [iscsi_target_mod]
    transport_cmd_check_stop_to_fabric+0xd8/0xe0 [target_core_mod]
    target_complete_ok_work+0x1b0/0x790 [target_core_mod]
    process_one_work+0x549/0xa40
    worker_thread+0x7a/0x5d0
    kthread+0x1bc/0x210
    ret_from_fork+0x24/0x30

    Allocated by task 889:
    save_stack+0x23/0x90
    __kasan_kmalloc.constprop.0+0xcf/0xe0
    kasan_slab_alloc+0x12/0x20
    kmem_cache_alloc+0xf6/0x360
    transport_alloc_session+0x29/0x80 [target_core_mod]
    iscsi_target_login_thread+0xcd6/0x18f0 [iscsi_target_mod]
    kthread+0x1bc/0x210
    ret_from_fork+0x24/0x30

    Freed by task 1025:
    save_stack+0x23/0x90
    __kasan_slab_free+0x13a/0x190
    kasan_slab_free+0x12/0x20
    kmem_cache_free+0x146/0x400
    transport_free_session+0x179/0x2f0 [target_core_mod]
    transport_deregister_session+0x130/0x180 [target_core_mod]
    iscsit_close_session+0x12c/0x350 [iscsi_target_mod]
    iscsit_logout_post_handler+0x136/0x380 [iscsi_target_mod]
    iscsit_response_queue+0x8de/0xbe0 [iscsi_target_mod]
    iscsi_target_tx_thread+0x27f/0x370 [iscsi_target_mod]
    kthread+0x1bc/0x210
    ret_from_fork+0x24/0x30

    The buggy address belongs to the object at ffff8881154ec9c0
    which belongs to the cache se_sess_cache of size 352
    The buggy address is located 176 bytes inside of
    352-byte region [ffff8881154ec9c0, ffff8881154ecb20)
    The buggy address belongs to the page:
    page:ffffea0004553b00 refcount:1 mapcount:0 mapping:ffff888101755400 index:0x0 compound_mapcount: 0
    flags: 0x2fff000000010200(slab|head)
    raw: 2fff000000010200 dead000000000100 dead000000000122 ffff888101755400
    raw: 0000000000000000 0000000080130013 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff8881154ec900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    ffff8881154ec980: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
    >ffff8881154eca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff8881154eca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff8881154ecb00: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc

    Cc: Mike Christie
    Link: https://lore.kernel.org/r/20191113220508.198257-3-bvanassche@acm.org
    Reviewed-by: Roman Bolshakov
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     

13 Nov, 2019

1 commit

  • Remove SG_NONE and a related misleading comment. Update documentation.

    This patch does not affect behaviour as zero initialization is redundant.

    Cc: Jonathan Corbet
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Jens Axboe
    Cc: Viresh Kumar
    Cc: Oliver Neukum
    Cc: Alan Stern
    Cc: Greg Kroah-Hartman
    Cc: usb-storage@lists.one-eyed-alien.net
    Link: https://lore.kernel.org/r/b4779b7a6563f6bd8d259ee457871c1c463c420e.1572656814.git.fthain@telegraphics.com.au
    Signed-off-by: Finn Thain
    Signed-off-by: Martin K. Petersen

    Finn Thain
     

09 Nov, 2019

1 commit

  • struct scsi_cmnd cmd->req.resid_len which is returned and set respectively
    by the helper functions scsi_get_resid() and scsi_set_resid() is an
    unsigned int. Reflect this fact in the interface of these helper functions.

    Also fix compilation errors due to min() and max() type mismatch introduced
    by this change in scsi debug code, usb transport code and in the USB ENE
    card reader driver.

    Link: https://lore.kernel.org/r/20191030090847.25650-1-damien.lemoal@wdc.com
    Signed-off-by: Damien Le Moal
    Reviewed-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Damien Le Moal
     

02 Nov, 2019

1 commit

  • It isn't necessary to check the host depth in scsi_queue_rq() any more
    since it has been respected by blk-mq before calling scsi_queue_rq() via
    getting driver tag.

    Lots of LUNs may attach to same host and per-host IOPS may reach millions,
    so we should avoid expensive atomic operations on the host-wide counter in
    the IO path.

    This patch implements scsi_host_busy() via blk_mq_tagset_busy_iter() with
    one scsi command state for reading the count of busy IOs for scsi_mq.

    It is observed that IOPS is increased by 15% in IO test on scsi_debug (32
    LUNs, 32 submit queues, 1024 can_queue, libaio/dio) in a dual-socket
    system.

    Cc: Jens Axboe
    Cc: Ewan D. Milne
    Cc: Omar Sandoval ,
    Cc: "Martin K. Petersen" ,
    Cc: James Bottomley ,
    Cc: Christoph Hellwig ,
    Cc: Kashyap Desai
    Cc: Hannes Reinecke
    Cc: Laurence Oberman
    Cc: Bart Van Assche
    Link: https://lore.kernel.org/r/20191025065855.6309-1-ming.lei@redhat.com
    Signed-off-by: Ming Lei
    Reviewed-by: Jens Axboe
    Reviewed-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Ming Lei
     

10 Oct, 2019

1 commit