1. 05 11月, 2020 4 次提交
  2. 29 7月, 2020 1 次提交
  3. 08 5月, 2020 1 次提交
  4. 22 2月, 2020 3 次提交
  5. 04 10月, 2019 1 次提交
  6. 13 4月, 2019 1 次提交
  7. 05 2月, 2019 1 次提交
    • B
      scsi: target/core: Remove several state tests from the TMF code · 3f0661a4
      Bart Van Assche 提交于
      Whether or not a session is being torn down does not affect whether or not
      SCSI commands are in the task set. Hence remove the "tearing down" checks
      from the TMF code. The TRANSPORT_ISTATE_PROCESSING check is left out
      because it is now safe to wait for a command that is in that state. The
      CMD_T_PRE_EXECUTE is left out because abort processing is postponed until
      after commands have left the pre-execute state since the patch that makes
      TMF processing synchronous.
      
      See also commit 1c21a480 ("target: Avoid early CMD_T_PRE_EXECUTE
      failures during ABORT_TASK").
      
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      3f0661a4
  8. 08 12月, 2018 6 次提交
    • D
      scsi: target: consistently null-terminate t10_wwn strings · b2da4abf
      David Disseldorp 提交于
      In preparation for supporting user provided vendor strings, add an extra
      byte to the vendor, model and revision arrays in struct t10_wwn. This
      ensures that the full INQUIRY data can be carried in the arrays along with
      a null-terminator.
      
      Change a number of array readers and writers so that they account for
      explicit null-termination:
      
      - The pscsi_set_inquiry_info() and emulate_model_alias_store() codepaths
        don't currently explicitly null-terminate; fix this.
      
      - Existing t10_wwn field dumps use for-loops which step over
        null-terminators for right-padding.
        + Use printf with width specifiers instead.
      Signed-off-by: NDavid Disseldorp <ddiss@suse.de>
      Reviewed-by: NRoman Bolshakov <r.bolshakov@yadro.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b2da4abf
    • B
      scsi: target/core: Fix TAS handling for aborted commands · aaa00cc9
      Bart Van Assche 提交于
      The TASK ABORTED STATUS (TAS) bit is defined as follows in SAM:
      "TASK_ABORTED: this status shall be returned if a command is aborted by a
      command or task management function on another I_T nexus and the control
      mode page TAS bit is set to one". TAS handling is spread over the target
      core and the iSCSI target driver. If a LUN RESET is received, the target
      core will send the TASK_ABORTED response for all commands for which such a
      response has to be sent. If an ABORT TASK is received, only the iSCSI
      target driver will send the TASK_ABORTED response for the commands for
      which that response has to be sent.  That is a bug since all target drivers
      have to honor the TAS bit. Fix this by moving the code that handles TAS
      from the iSCSI target driver into the target core. Additionally, if a
      command has been aborted, instead of sending the TASK_ABORTED status from
      the context that processes the SCSI command send it from the context of the
      ABORT TMF.  The core_tmr_abort_task() change in this patch causes the
      CMD_T_TAS flag to be set if a TASK_ABORTED status has to be sent back to
      the initiator that submitted the command. If that flag has been set
      transport_cmd_finish_abort() will send the TASK_ABORTED response.
      
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: David Disseldorp <ddiss@suse.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      aaa00cc9
    • B
      scsi: target/core: Make it possible to wait from more than one context for command completion · a014c364
      Bart Van Assche 提交于
      This patch does not change any functionality but makes the patch that makes
      TMF handling synchronous easier to read.
      
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: David Disseldorp <ddiss@suse.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      a014c364
    • B
      scsi: target/core: Use system workqueues for TMF · db5b21a2
      Bart Van Assche 提交于
      A quote from SAM-5: "The order in which task management requests are
      processed is not specified by the SCSI architecture model.  The SCSI
      architecture model does not require in-order delivery of such task
      management requests or processing by the task manager in the order
      received. To guarantee the processing order of task management requests
      referencing sent to a specific logical unit, an application client should
      not have more than one such task management request pending to that logical
      unit." This means that it is safe to use the system workqueues instead of
      tmr_wq for processing TMFs. An intended side effect of this patch is that
      it enables concurrent processing of TMFs.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: David Disseldorp <ddiss@suse.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      db5b21a2
    • B
      scsi: target/core: Make sure that target_wait_for_sess_cmds() waits long enough · ad669505
      Bart Van Assche 提交于
      A session must only be released after all code that accesses the session
      structure has finished. Make sure that this is the case by introducing a
      new command counter per session that is only decremented after the
      .release_cmd() callback has finished. This patch fixes the following crash:
      
      BUG: KASAN: use-after-free in do_raw_spin_lock+0x1c/0x130
      Read of size 4 at addr ffff8801534b16e4 by task rmdir/14805
      CPU: 16 PID: 14805 Comm: rmdir Not tainted 4.18.0-rc2-dbg+ #5
      Call Trace:
      dump_stack+0xa4/0xf5
      print_address_description+0x6f/0x270
      kasan_report+0x241/0x360
      __asan_load4+0x78/0x80
      do_raw_spin_lock+0x1c/0x130
      _raw_spin_lock_irqsave+0x52/0x60
      srpt_set_ch_state+0x27/0x70 [ib_srpt]
      srpt_disconnect_ch+0x1b/0xc0 [ib_srpt]
      srpt_close_session+0xa8/0x260 [ib_srpt]
      target_shutdown_sessions+0x170/0x180 [target_core_mod]
      core_tpg_del_initiator_node_acl+0xf3/0x200 [target_core_mod]
      target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
      config_item_release+0x9c/0x110 [configfs]
      config_item_put+0x26/0x30 [configfs]
      configfs_rmdir+0x3b8/0x510 [configfs]
      vfs_rmdir+0xb3/0x1e0
      do_rmdir+0x262/0x2c0
      do_syscall_64+0x77/0x230
      entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: David Disseldorp <ddiss@suse.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      ad669505
    • B
      scsi: target/core: Simplify transport_clear_lun_ref() · a95be384
      Bart Van Assche 提交于
      Since transport_clear_lun_ref() already waits until the percpu-refcount
      .release() method is called, it is not necessary to wait first until
      percpu_ref_kill_and_confirm() has finished transitioning the refcount into
      atomic mode. Remove the code that waits for percpu_ref_kill_and_confirm()
      to complete and also the completion object that is used by that code.  This
      patch does not change the behavior of the SCSI target code.
      
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: David Disseldorp <ddiss@suse.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      a95be384
  9. 29 11月, 2018 1 次提交
  10. 22 11月, 2018 1 次提交
  11. 16 10月, 2018 1 次提交
  12. 03 7月, 2018 3 次提交
  13. 20 6月, 2018 2 次提交
  14. 19 5月, 2018 1 次提交
  15. 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
  16. 13 1月, 2018 1 次提交
  17. 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
  18. 05 11月, 2017 1 次提交
  19. 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
  20. 07 7月, 2017 4 次提交
  21. 09 6月, 2017 2 次提交
  22. 02 5月, 2017 1 次提交
  23. 31 3月, 2017 1 次提交
    • 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