1. 05 2月, 2019 3 次提交
  2. 01 12月, 2018 1 次提交
    • J
      sbitmap: optimize wakeup check · 5d2ee712
      Jens Axboe 提交于
      Even if we have no waiters on any of the sbitmap_queue wait states, we
      still have to loop every entry to check. We do this for every IO, so
      the cost adds up.
      
      Shift a bit of the cost to the slow path, when we actually have waiters.
      Wrap prepare_to_wait_exclusive() and finish_wait(), so we can maintain
      an internal count of how many are currently active. Then we can simply
      check this count in sbq_wake_ptr() and not have to loop if we don't
      have any sleepers.
      
      Convert the two users of sbitmap with waiting, blk-mq-tag and iSCSI.
      Reviewed-by: NOmar Sandoval <osandov@fb.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5d2ee712
  3. 24 10月, 2018 1 次提交
    • D
      iov_iter: Separate type from direction and use accessor functions · aa563d7b
      David Howells 提交于
      In the iov_iter struct, separate the iterator type from the iterator
      direction and use accessor functions to access them in most places.
      
      Convert a bunch of places to use switch-statements to access them rather
      then chains of bitwise-AND statements.  This makes it easier to add further
      iterator types.  Also, this can be more efficient as to implement a switch
      of small contiguous integers, the compiler can use ~50% fewer compare
      instructions than it has to use bitwise-and instructions.
      
      Further, cease passing the iterator type into the iterator setup function.
      The iterator function can set that itself.  Only the direction is required.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      aa563d7b
  4. 16 10月, 2018 2 次提交
  5. 03 8月, 2018 1 次提交
  6. 31 7月, 2018 1 次提交
  7. 03 7月, 2018 1 次提交
  8. 20 6月, 2018 2 次提交
  9. 05 11月, 2017 1 次提交
    • B
      target/iscsi: Detect conn_cmd_list corruption early · 6eaf69e4
      Bart Van Assche 提交于
      Certain behavior of the initiator can cause the target driver to
      send both a reject and a SCSI response. If that happens two
      target_put_sess_cmd() calls will occur without the command having
      been removed from conn_cmd_list. In other words, conn_cmd_list
      will get corrupted once the freed memory is reused. Although the
      Linux kernel can detect list corruption if list debugging is
      enabled, in this case the context in which list corruption is
      detected is not related to the context that caused list corruption.
      Hence add WARN_ON() statements that report the context that is
      causing list corruption.
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Mike Christie <mchristi@redhat.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6eaf69e4
  10. 02 11月, 2017 2 次提交
  11. 07 7月, 2017 2 次提交
  12. 31 3月, 2017 1 次提交
  13. 30 3月, 2017 1 次提交
    • N
      iscsi-target: Fix TMR reference leak during session shutdown · efb2ea77
      Nicholas Bellinger 提交于
      This patch fixes a iscsi-target specific TMR reference leak
      during session shutdown, that could occur when a TMR was
      quiesced before the hand-off back to iscsi-target code
      via transport_cmd_check_stop_to_fabric().
      
      The reference leak happens because iscsit_free_cmd() was
      incorrectly skipping the final target_put_sess_cmd() for
      TMRs when transport_generic_free_cmd() returned zero because
      the se_cmd->cmd_kref did not reach zero, due to the missing
      se_cmd assignment in original code.
      
      The result was iscsi_cmd and it's associated se_cmd memory
      would be freed once se_sess->sess_cmd_map where released,
      but the associated se_tmr_req was leaked and remained part
      of se_device->dev_tmr_list.
      
      This bug would manfiest itself as kernel paging request
      OOPsen in core_tmr_lun_reset(), when a left-over se_tmr_req
      attempted to dereference it's se_cmd pointer that had
      already been released during normal session shutdown.
      
      To address this bug, go ahead and treat ISCSI_OP_SCSI_CMD
      and ISCSI_OP_SCSI_TMFUNC the same when there is an extra
      se_cmd->cmd_kref to drop in iscsit_free_cmd(), and use
      op_scsi to signal __iscsit_free_cmd() when the former
      needs to clear any further iscsi related I/O state.
      Reported-by: NRob Millner <rlm@daterainc.com>
      Cc: Rob Millner <rlm@daterainc.com>
      Reported-by: NChu Yuan Lin <cyl@datera.io>
      Cc: Chu Yuan Lin <cyl@datera.io>
      Tested-by: NChu Yuan Lin <cyl@datera.io>
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      efb2ea77
  14. 27 2月, 2017 1 次提交
    • N
      iscsi-target: Fix early login failure statistics misses · 17c61ad6
      Nicholas Bellinger 提交于
      Due to the long standing checks in iscsit_snmp_get_tiqn()
      that assume conn->sess->tpg dereference of tpg->tpg_tiqn
      for iscsit_collect_login_stats() usage, some of the early
      login failure cases like ISCSI_LOGIN_STATUS_TGT_FORBIDDEN
      where not getting incremented, due to sess->tpg assignment
      happening later in iscsi_login_zero_tsih_s2().
      
      Instead, use the earlier conn->tpg assignment done by
      iscsi_target_locate_portal() -> iscsit_get_tpg_from_np()
      so the existing counters are incremented correctly for
      the various early login failure cases.
      
      Also, go ahead and drop the old rate limiting check in
      iscsit_collect_login_stats(), so we get the true number
      of failed login attempts in the existing statistics.
      Reported-by: NRyan Stiles <ras@datera.io>
      Cc: Ryan Stiles <ras@datera.io>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      17c61ad6
  15. 19 2月, 2017 1 次提交
    • V
      target/iscsi: split iscsit_check_dataout_hdr() · 9a584bf9
      Varun Prakash 提交于
      Split iscsit_check_dataout_hdr() into two functions
      1. __iscsit_check_dataout_hdr() - This function
         validates data out hdr.
      2. iscsit_check_dataout_hdr() - This function finds
         iSCSI cmd using iscsit_find_cmd_from_itt_or_dump(),
         then it calls __iscsit_check_dataout_hdr() to
         validate iSCSI hdr.
      
      This split is required to support Chelsio T6 iSCSI
      DDP completion feature. T6 adapters reduce number of
      completions to host by generating single completion
      for all directly placed(DDP) iSCSI pdus in a sequence,
      DDP completion contains iSCSI hdr of the last pdu in a
      sequence.
      
      On receiving DDP completion cxgbit driver will first
      find iSCSI cmd using iscsit_find_cmd_from_itt_or_dump()
      then updates cmd->write_data_done, cmd->next_burst_len,
      cmd->data_sn and calls  __iscsit_check_dataout_hdr()
      to validate iSCSI hdr.
      
      (Move XRDSL check ahead of itt lookup / dump - nab)
      Signed-off-by: NVarun Prakash <varun@chelsio.com>
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9a584bf9
  16. 27 12月, 2016 1 次提交
  17. 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
  18. 10 5月, 2016 2 次提交
  19. 29 3月, 2016 1 次提交
  20. 27 8月, 2015 1 次提交
  21. 03 8月, 2015 1 次提交
  22. 31 5月, 2015 3 次提交
  23. 27 3月, 2015 1 次提交
  24. 13 2月, 2015 1 次提交
  25. 05 2月, 2015 1 次提交
  26. 31 1月, 2015 1 次提交
  27. 16 12月, 2014 1 次提交
    • N
      iscsi-target: Fail connection on short sendmsg writes · 6bf6ca75
      Nicholas Bellinger 提交于
      This patch changes iscsit_do_tx_data() to fail on short writes
      when kernel_sendmsg() returns a value different than requested
      transfer length, returning -EPIPE and thus causing a connection
      reset to occur.
      
      This avoids a potential bug in the original code where a short
      write would result in kernel_sendmsg() being called again with
      the original iovec base + length.
      
      In practice this has not been an issue because iscsit_do_tx_data()
      is only used for transferring 48 byte headers + 4 byte digests,
      along with seldom used control payloads from NOPIN + TEXT_RSP +
      REJECT with less than 32k of data.
      
      So following Al's audit of iovec consumers, go ahead and fail
      the connection on short writes for now, and remove the bogus
      logic ahead of his proper upstream fix.
      Reported-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: <stable@vger.kernel.org> # v3.1+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6bf6ca75
  28. 10 12月, 2014 1 次提交
    • A
      switch memcpy_to_msg() and skb_copy{,_and_csum}_datagram_msg() to primitives · e5a4b0bb
      Al Viro 提交于
      ... making both non-draining.  That means that tcp_recvmsg() becomes
      non-draining.  And _that_ would break iscsit_do_rx_data() unless we
      	a) make sure tcp_recvmsg() is uniformly non-draining (it is)
      	b) make sure it copes with arbitrary (including shifted)
      iov_iter (it does, all it uses is iov_iter primitives)
      	c) make iscsit_do_rx_data() initialize ->msg_iter only once.
      
      Fortunately, (c) is doable with minimal work and we are rid of one
      the two places where kernel send/recvmsg users would be unhappy with
      non-draining behaviour.
      
      Actually, that makes all but one of ->recvmsg() instances iov_iter-clean.
      The exception is skcipher_recvmsg() and it also isn't hard to convert
      to primitives (iov_iter_get_pages() is needed there).  That'll wait
      a bit - there's some interplay with ->sendmsg() path for that one.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e5a4b0bb
  29. 18 9月, 2014 1 次提交
  30. 16 9月, 2014 1 次提交
  31. 27 6月, 2014 1 次提交