1. 29 11月, 2018 1 次提交
  2. 22 11月, 2018 1 次提交
  3. 16 10月, 2018 1 次提交
  4. 03 7月, 2018 3 次提交
  5. 20 6月, 2018 2 次提交
  6. 19 5月, 2018 1 次提交
  7. 17 1月, 2018 1 次提交
    • M
      target core: add device action configfs files · 8dc31ff9
      Mike Christie 提交于
      This patch adds a new group of files that are to be used to
      have the kernel module execution some action. The next patch
      will have target_core_user use the group/files to be able to block
      a device and to reset its memory buffer used to pass commands
      between user/kernel space.
      
      This type of file is different from the existing device attributes
      in that they may be write only and when written to they result in
      the kernel module executing some function. These need to be
      separate from the normal device attributes which get/set device
      values so userspace can continue to loop over all the attribs and
      get/set them during initialization.
      Signed-off-by: NMike Christie <mchristi@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8dc31ff9
  8. 13 1月, 2018 1 次提交
  9. 08 11月, 2017 1 次提交
    • N
      target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK · 1c21a480
      Nicholas Bellinger 提交于
      This patch fixes bug where early se_cmd exceptions that occur
      before backend execution can result in use-after-free if/when
      a subsequent ABORT_TASK occurs for the same tag.
      
      Since an early se_cmd exception will have had se_cmd added to
      se_session->sess_cmd_list via target_get_sess_cmd(), it will
      not have CMD_T_COMPLETE set by the usual target_complete_cmd()
      backend completion path.
      
      This causes a subsequent ABORT_TASK + __target_check_io_state()
      to signal ABORT_TASK should proceed.  As core_tmr_abort_task()
      executes, it will bring the outstanding se_cmd->cmd_kref count
      down to zero releasing se_cmd, after se_cmd has already been
      queued with error status into fabric driver response path code.
      
      To address this bug, introduce a CMD_T_PRE_EXECUTE bit that is
      set at target_get_sess_cmd() time, and cleared immediately before
      backend driver dispatch in target_execute_cmd() once CMD_T_ACTIVE
      is set.
      
      Then, check CMD_T_PRE_EXECUTE within __target_check_io_state() to
      determine when an early exception has occured, and avoid aborting
      this se_cmd since it will have already been queued into fabric
      driver response path code.
      Reported-by: NDonald White <dew@datera.io>
      Cc: Donald White <dew@datera.io>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: stable@vger.kernel.org # 3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1c21a480
  10. 05 11月, 2017 1 次提交
  11. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  12. 07 7月, 2017 4 次提交
  13. 09 6月, 2017 2 次提交
  14. 02 5月, 2017 1 次提交
  15. 31 3月, 2017 2 次提交
    • M
      target: Fix ALUA transition state race between multiple initiators · d19c4643
      Mike Christie 提交于
      Multiple threads could be writing to alua_access_state at
      the same time, or there could be multiple STPGs in flight
      (different initiators sending them or one initiator sending
      them to different ports), or a combo of both and the
      core_alua_do_transition_tg_pt calls will race with each other.
      
      Because from the last patches we no longer delay running
      core_alua_do_transition_tg_pt_work, there does not seem to be
      any point in running that in a workqueue. And, we always
      wait for it to complete one way or another, so we can sleep
      in this code path. So, this patch made over target-pending just adds a
      mutex and does the work core_alua_do_transition_tg_pt_work was doing in
      core_alua_do_transition_tg_pt.
      
      There is also no need to use an atomic for the
      tg_pt_gp_alua_access_state. In core_alua_do_transition_tg_pt we will
      test and set it under the transition mutex. And, it is a int/32 bits
      so in the other places where it is read, we will never see it partially
      updated.
      Signed-off-by: NMike Christie <mchristi@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d19c4643
    • N
      target: Fix unknown fabric callback queue-full errors · fa7e25cf
      Nicholas Bellinger 提交于
      This patch fixes a set of queue-full response handling
      bugs, where outgoing responses are leaked when a fabric
      driver is propagating non -EAGAIN or -ENOMEM errors
      to target-core.
      
      It introduces TRANSPORT_COMPLETE_QF_ERR state used to
      signal when CHECK_CONDITION status should be generated,
      when fabric driver ->write_pending(), ->queue_data_in(),
      or ->queue_status() callbacks fail with non -EAGAIN or
      -ENOMEM errors, and data-transfer should not be retried.
      
      Note all fabric driver -EAGAIN and -ENOMEM errors are
      still retried indefinately with associated data-transfer
      callbacks, following existing queue-full logic.
      
      Also fix two missing ->queue_status() queue-full cases
      related to CMD_T_ABORTED w/ TAS status handling.
      Reported-by: NPotnuri Bharat Teja <bharat@chelsio.com>
      Reviewed-by: NPotnuri Bharat Teja <bharat@chelsio.com>
      Tested-by: NPotnuri Bharat Teja <bharat@chelsio.com>
      Cc: Potnuri Bharat Teja <bharat@chelsio.com>
      Reported-by: NSteve Wise <swise@opengridcomputing.com>
      Cc: Steve Wise <swise@opengridcomputing.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fa7e25cf
  16. 30 3月, 2017 1 次提交
    • N
      target: Avoid mappedlun symlink creation during lun shutdown · 49cb77e2
      Nicholas Bellinger 提交于
      This patch closes a race between se_lun deletion during configfs
      unlink in target_fabric_port_unlink() -> core_dev_del_lun()
      -> core_tpg_remove_lun(), when transport_clear_lun_ref() blocks
      waiting for percpu_ref RCU grace period to finish, but a new
      NodeACL mappedlun is added before the RCU grace period has
      completed.
      
      This can happen in target_fabric_mappedlun_link() because it
      only checks for se_lun->lun_se_dev, which is not cleared until
      after transport_clear_lun_ref() percpu_ref RCU grace period
      finishes.
      
      This bug originally manifested as NULL pointer dereference
      OOPsen in target_stat_scsi_att_intr_port_show_attr_dev() on
      v4.1.y code, because it dereferences lun->lun_se_dev without
      a explicit NULL pointer check.
      
      In post v4.1 code with target-core RCU conversion, the code
      in target_stat_scsi_att_intr_port_show_attr_dev() no longer
      uses se_lun->lun_se_dev, but the same race still exists.
      
      To address the bug, go ahead and set se_lun>lun_shutdown as
      early as possible in core_tpg_remove_lun(), and ensure new
      NodeACL mappedlun creation in target_fabric_mappedlun_link()
      fails during se_lun shutdown.
      Reported-by: NJames Shen <jcs@datera.io>
      Cc: James Shen <jcs@datera.io>
      Tested-by: NJames Shen <jcs@datera.io>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      49cb77e2
  17. 19 3月, 2017 1 次提交
  18. 03 3月, 2017 1 次提交
  19. 02 3月, 2017 1 次提交
  20. 27 2月, 2017 2 次提交
    • N
      target: Add counters for ABORT_TASK success + failure · c87ba9c4
      Nicholas Bellinger 提交于
      This patch introduces two counters for ABORT_TASK success +
      failure under:
      
         /sys/kernel/config/target/core/$HBA/$DEV/statistics/scsi_tgt_dev/
      
      that are useful for diagnosing various backend device latency
      and front fabric issues.
      
      Normally when folks see alot of aborts_complete happening,
      it means the backend device I/O completion latency is high,
      and not returning completions fast enough before host side
      timeouts trigger.
      
      And normally when folks see alot of aborts_no_task, it means
      completions are being posted by target-core into fabric driver
      code, but the responses aren't making it back to the host.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c87ba9c4
    • N
      target: Fix NULL dereference during LUN lookup + active I/O shutdown · bd4e2d29
      Nicholas Bellinger 提交于
      When transport_clear_lun_ref() is shutting down a se_lun via
      configfs with new I/O in-flight, it's possible to trigger a
      NULL pointer dereference in transport_lookup_cmd_lun() due
      to the fact percpu_ref_get() doesn't do any __PERCPU_REF_DEAD
      checking before incrementing lun->lun_ref.count after
      lun->lun_ref has switched to atomic_t mode.
      
      This results in a NULL pointer dereference as LUN shutdown
      code in core_tpg_remove_lun() continues running after the
      existing ->release() -> core_tpg_lun_ref_release() callback
      completes, and clears the RCU protected se_lun->lun_se_dev
      pointer.
      
      During the OOPs, the state of lun->lun_ref in the process
      which triggered the NULL pointer dereference looks like
      the following on v4.1.y stable code:
      
      struct se_lun {
        lun_link_magic = 4294932337,
        lun_status = TRANSPORT_LUN_STATUS_FREE,
      
        .....
      
        lun_se_dev = 0x0,
        lun_sep = 0x0,
      
        .....
      
        lun_ref = {
          count = {
            counter = 1
          },
          percpu_count_ptr = 3,
          release = 0xffffffffa02fa1e0 <core_tpg_lun_ref_release>,
          confirm_switch = 0x0,
          force_atomic = false,
          rcu = {
            next = 0xffff88154fa1a5d0,
            func = 0xffffffff8137c4c0 <percpu_ref_switch_to_atomic_rcu>
          }
        }
      }
      
      To address this bug, use percpu_ref_tryget_live() to ensure
      once __PERCPU_REF_DEAD is visable on all CPUs and ->lun_ref
      has switched to atomic_t, all new I/Os will fail to obtain
      a new lun->lun_ref reference.
      
      Also use an explicit percpu_ref_kill_and_confirm() callback
      to block on ->lun_ref_comp to allow the first stage and
      associated RCU grace period to complete, and then block on
      ->lun_ref_shutdown waiting for the final percpu_ref_put()
      to drop the last reference via transport_lun_remove_cmd()
      before continuing with core_tpg_remove_lun() shutdown.
      Reported-by: NRob Millner <rlm@daterainc.com>
      Tested-by: NRob Millner <rlm@daterainc.com>
      Cc: Rob Millner <rlm@daterainc.com>
      Tested-by: NVaibhav Tandon <vst@datera.io>
      Cc: Vaibhav Tandon <vst@datera.io>
      Tested-by: NBryant G. Ly <bryantly@linux.vnet.ibm.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bd4e2d29
  21. 09 2月, 2017 5 次提交
  22. 28 1月, 2017 1 次提交
  23. 11 1月, 2017 1 次提交
  24. 16 12月, 2016 1 次提交
  25. 10 12月, 2016 1 次提交
    • B
      target: Minimize #include directives · 8dcf07be
      Bart Van Assche 提交于
      Remove superfluous #include directives from the include/target/*.h
      files. Add missing #include directives to other *.h and *.c files.
      Use forward declarations for structures where possible. This
      change reduces the build time for make M=drivers/target on my
      laptop from 27.1s to 18.7s or by about 30%.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
      8dcf07be
  26. 20 10月, 2016 1 次提交
    • N
      target: Make EXTENDED_COPY 0xe4 failure return COPY TARGET DEVICE NOT REACHABLE · 449a1378
      Nicholas Bellinger 提交于
      This patch addresses a bug where EXTENDED_COPY across multiple LUNs
      results in a CHECK_CONDITION when the source + destination are not
      located on the same physical node.
      
      ESX Host environments expect sense COPY_ABORTED w/ COPY TARGET DEVICE
      NOT REACHABLE to be returned when this occurs, in order to signal
      fallback to local copy method.
      
      As described in section 6.3.3 of spc4r22:
      
        "If it is not possible to complete processing of a segment because the
         copy manager is unable to establish communications with a copy target
         device, because the copy target device does not respond to INQUIRY,
         or because the data returned in response to INQUIRY indicates
         an unsupported logical unit, then the EXTENDED COPY command shall be
         terminated with CHECK CONDITION status, with the sense key set to
         COPY ABORTED, and the additional sense code set to COPY TARGET DEVICE
         NOT REACHABLE."
      
      Tested on v4.1.y with ESX v5.5u2+ with BlockCopy across multiple nodes.
      Reported-by: NNixon Vincent <nixon.vincent@calsoftinc.com>
      Tested-by: NNixon Vincent <nixon.vincent@calsoftinc.com>
      Cc: Nixon Vincent <nixon.vincent@calsoftinc.com>
      Tested-by: NDinesh Israni <ddi@datera.io>
      Signed-off-by: NDinesh Israni <ddi@datera.io>
      Cc: Dinesh Israni <ddi@datera.io>
      Cc: stable@vger.kernel.org # 3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      449a1378
  27. 20 7月, 2016 1 次提交