1. 01 6月, 2015 3 次提交
    • N
      target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage · 4cc987ea
      Nicholas Bellinger 提交于
      With se_port and t10_alua_tg_pt_gp_member being absored into se_lun,
      there is no need for an extra lock to protect se_lun->lun_se_dev
      assignment.
      
      This patch also converts backend drivers to use call_rcu() release
      to allow any se_device readers to complete.  The call_rcu() instead
      of kfree_rcu() is required here because se_device is embedded into
      the backend driver specific structure.
      
      Also, convert se_lun->lun_stats to use atomic_long_t within the
      target_complete_ok_work() completion callback, and add FIXME for
      transport_lookup_tmr_lun() with se_lun->lun_ref.
      
      Finally, update sbp_update_unit_directory() special case usage with
      proper rcu_dereference_raw() and configfs symlink comment.
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Chris Boot <bootc@bootc.net>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4cc987ea
    • C
      target: consolidate backend attribute implementations · 5873c4d1
      Christoph Hellwig 提交于
      Provide a common sets of dev_attrib attributes for all devices using the
      generic SPC/SBC parsers, and a second one with the minimal required read-only
      attributes for passthrough devices.  The later is only used by pscsi for now,
      but will be wired up for the full-passthrough TCMU use case as well.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5873c4d1
    • C
      target: simplify backend driver registration · 0a06d430
      Christoph Hellwig 提交于
      Rewrite the backend driver registration based on what we did to the fabric
      drivers:  introduce a read-only struct target_bakckend_ops that the driver
      registers, which is then instanciate as a struct target_backend by the
      core.  This allows the ops vector to be smaller and allows us to mark it
      const.  At the same time the registration function can set up the
      configfs attributes, avoiding the need to add additional boilerplate code
      for that to the drivers.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0a06d430
  2. 31 5月, 2015 4 次提交
  3. 16 4月, 2015 3 次提交
    • A
      target/file: Fix UNMAP with DIF protection support · 64d240b7
      Akinobu Mita 提交于
      When UNMAP command is issued with DIF protection support enabled,
      the protection info for the unmapped region is remain unchanged.
      So READ command for the region causes data integrity failure.
      
      This fixes it by invalidating protection info for the unmapped region
      by filling with 0xff pattern.  This change also adds helper function
      fd_do_prot_fill() in order to reduce code duplication with existing
      fd_format_prot().
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Reviewed-by: NSagi Grimberg <sagig@mellanox.com>
      Reviewed-by: N"Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      64d240b7
    • A
      target/file: Fix SG table for prot_buf initialization · c8367778
      Akinobu Mita 提交于
      In fd_do_prot_rw(), it allocates prot_buf which is used to copy from
      se_cmd->t_prot_sg by sbc_dif_copy_prot().  The SG table for prot_buf
      is also initialized by allocating 'se_cmd->t_prot_nents' entries of
      scatterlist and setting the data length of each entry to PAGE_SIZE
      at most.
      
      However if se_cmd->t_prot_sg contains a clustered entry (i.e.
      sg->length > PAGE_SIZE), the SG table for prot_buf can't be
      initialized correctly and sbc_dif_copy_prot() can't copy to prot_buf.
      (This actually happened with TCM loopback fabric module)
      
      As prot_buf is allocated by kzalloc() and it's physically contiguous,
      we only need a single scatterlist entry.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c8367778
    • A
      target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled · 38da0f49
      Akinobu Mita 提交于
      When CONFIG_DEBUG_SG=y and DIF protection support enabled, kernel
      BUG()s are triggered due to the following two issues:
      
      1) prot_sg is not initialized by sg_init_table().
      
      When CONFIG_DEBUG_SG=y, scatterlist helpers check sg entry has a
      correct magic value.
      
      2) vmalloc'ed buffer is passed to sg_set_buf().
      
      sg_set_buf() uses virt_to_page() to convert virtual address to struct
      page, but it doesn't work with vmalloc address.  vmalloc_to_page()
      should be used instead.  As prot_buf isn't usually too large, so
      fix it by allocating prot_buf by kmalloc instead of vmalloc.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      38da0f49
  4. 08 4月, 2015 1 次提交
  5. 27 3月, 2015 1 次提交
  6. 28 2月, 2015 2 次提交
  7. 14 2月, 2015 1 次提交
    • N
      target: Perform PROTECT sanity checks for WRITE_SAME · afd73f1b
      Nicholas Bellinger 提交于
      This patch adds a call to sbc_check_prot() within sbc_setup_write_same()
      code to perform the various protection releated sanity checks, including
      failing if WRPROTECT or RDPROTECT is set for a backend device that has
      not advertised support for T10-PI.
      
      Also, since WRITE_SAME + T10-PI is currently not supported by IBLOCK +
      FILEIO backends, go ahead and fail if ->execute_write_same() is invoked
      with a non zero cmd->prot_op.
      
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      afd73f1b
  8. 10 1月, 2015 2 次提交
    • N
      target: Drop left-over fabric_max_sectors attribute · 7216dc07
      Nicholas Bellinger 提交于
      Now that fabric_max_sectors is no longer used to enforce the maximum
      I/O size, go ahead and drop it's left-over usage in target-core and
      associated backend drivers.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7216dc07
    • N
      target: Drop arbitrary maximum I/O size limit · 046ba642
      Nicholas Bellinger 提交于
      This patch drops the arbitrary maximum I/O size limit in sbc_parse_cdb(),
      which currently for fabric_max_sectors is hardcoded to 8192 (4 MB for 512
      byte sector devices), and for hw_max_sectors is a backend driver dependent
      value.
      
      This limit is problematic because Linux initiators have only recently
      started to honor block limits MAXIMUM TRANSFER LENGTH, and other non-Linux
      based initiators (eg: MSFT Fibre Channel) can also generate I/Os larger
      than 4 MB in size.
      
      Currently when this happens, the following message will appear on the
      target resulting in I/Os being returned with non recoverable status:
      
        SCSI OP 28h with too big sectors 16384 exceeds fabric_max_sectors: 8192
      
      Instead, drop both [fabric,hw]_max_sector checks in sbc_parse_cdb(),
      and convert the existing hw_max_sectors into a purely informational
      attribute used to represent the granuality that backend driver and/or
      subsystem code is splitting I/Os upon.
      
      Also, update FILEIO with an explicit FD_MAX_BYTES check in fd_execute_rw()
      to deal with the one special iovec limitiation case.
      
      v2 changes:
        - Drop hw_max_sectors check in sbc_parse_cdb()
      Reported-by: NLance Gropper <lance.gropper@qosserver.com>
      Reported-by: NStefan Priebe <s.priebe@profihost.ag>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: stable@vger.kernel.org # 3.4
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      046ba642
  9. 02 12月, 2014 1 次提交
    • N
      target/file: Convert to external fileio_backend_dev_attrs · b2320497
      Nicholas Bellinger 提交于
      This patch converts FILEIO to use an external set of device attributes,
      and utilizes target_core_backend_configfs.h macros to generate a default
      set of configfs extended-attr handlers.
      
      It calls target_core_setup_sub_cits() to setup the initial config_item_type
      based on existing target_core_configfs.c defaults, and using configfs_attribute
      generated by DEF_TB_DEFAULT_ATTRIBS(fileio) populates fileio_backend_dev_attrs[]
      
      It introduces no functional change for existing FILEIO device attributes.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b2320497
  10. 08 10月, 2014 1 次提交
  11. 18 9月, 2014 1 次提交
  12. 07 4月, 2014 1 次提交
  13. 19 1月, 2014 2 次提交
    • N
      target/file: Add DIF protection support to fd_execute_rw · 42201b55
      Nicholas Bellinger 提交于
      This patch adds support for DIF protection into fd_execute_rw() code
      for WRITE/READ I/O using sbc_dif_verify_[write,read]() logic.
      
      It adds fd_do_prot_rw() for handling interface with FILEIO PI, and
      uses a locally allocated fd_prot->prot_buf + fd_prot->prot_sg for
      interacting with SBC DIF verify emulation code.
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      42201b55
    • N
      target/file: Add DIF protection init/format support · 0f5e2ec4
      Nicholas Bellinger 提交于
      This patch adds support for DIF protection init/format support into
      the FILEIO backend.
      
      It involves using a seperate $FILE.protection for storing PI that is
      opened via fd_init_prot() using the common pi_prot_type attribute.
      The actual formatting of the protection is done via fd_format_prot()
      using the common pi_prot_format attribute, that will populate the
      initial PI data based upon the currently configured pi_prot_type.
      
      Based on original FILEIO code from Sagi.
      
      v1 changes:
        - Fix sparse warnings in fd_init_format_buf (Fengguang)
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0f5e2ec4
  14. 19 12月, 2013 1 次提交
    • N
      target/file: Update hw_max_sectors based on current block_size · 95cadace
      Nicholas Bellinger 提交于
      This patch allows FILEIO to update hw_max_sectors based on the current
      max_bytes_per_io.  This is required because vfs_[writev,readv]() can accept
      a maximum of 2048 iovecs per call, so the enforced hw_max_sectors really
      needs to be calculated based on block_size.
      
      This addresses a >= v3.5 bug where block_size=512 was rejecting > 1M
      sized I/O requests, because FD_MAX_SECTORS was hardcoded to 2048 for
      the block_size=4096 case.
      
      (v2: Use max_bytes_per_io instead of ->update_hw_max_sectors)
      Reported-by: NHenrik Goldman <hg@x-formation.com>
      Cc: <stable@vger.kernel.org> #3.5+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      95cadace
  15. 21 11月, 2013 1 次提交
  16. 11 9月, 2013 1 次提交
  17. 10 9月, 2013 1 次提交
    • N
      target: Allow sbc_ops->execute_rw() to accept SGLs + data_direction · a82a9538
      Nicholas Bellinger 提交于
      COMPARE_AND_WRITE expects to be able to send down a DMA_FROM_DEVICE
      to obtain the necessary READ payload for comparision against the
      first half of the WRITE payload containing the verify user data.
      
      Currently virtual backends expect to internally reference SGLs,
      SGL nents, and data_direction, so change IBLOCK, FILEIO and RD
      sbc_ops->execute_rw() to accept this values as function parameters.
      
      Also add default sbc_execute_rw() handler for the typical case for
      cmd->execute_rw() submission using cmd->t_data_sg, cmd->t_data_nents,
      and cmd->data_direction).
      
      v2 Changes:
        - Add SCF_COMPARE_AND_WRITE command flag
        - Use sbc_execute_rw() for normal cmd->execute_rw() submission
          with expected se_cmd members.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      a82a9538
  18. 13 8月, 2013 1 次提交
  19. 31 5月, 2013 1 次提交
  20. 04 5月, 2013 1 次提交
  21. 25 4月, 2013 5 次提交
  22. 28 2月, 2013 1 次提交
  23. 24 2月, 2013 1 次提交
  24. 23 2月, 2013 1 次提交
  25. 21 2月, 2013 1 次提交
    • N
      target/file: Add WRITE_SAME w/ UNMAP=0 emulation support · 7b745c84
      Nicholas Bellinger 提交于
      This patch adds support for emulation of WRITE_SAME w/ UNMAP=0 within
      fd_execute_write_same() backend code.
      
      The emulation uses vfs_writev() to submit a locally populated buffer
      from the received WRITE_SAME scatterlist block for duplication, and by
      default enforces a limit of max_write_same_len=0x1000 (8192) sectors up
      to the limit of 1024 iovec entries for the single call to vfs_writev().
      
      It also sets max_write_same_len to the operational default at setup ->
      fd_configure_device() time.
      
      Tested with 512, 1k, 2k, and 4k block_sizes.
      
      (asias: convert to vzalloc)
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Asias He <asias@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7b745c84
  26. 06 12月, 2012 1 次提交