1. 10 5月, 2012 1 次提交
    • N
      target: Remove max_sectors device attribute for modern se_task less code · 11e764bd
      Nicholas Bellinger 提交于
      This patch removes the original usage of dev_attr->max_sectors in favor of
      dev_attr->hw_max_sectors that is now being enforced by target core from
      within transport_generic_cmd_sequencer() for SCF_SCSI_DATA_SG_IO_CDB ops.
      
      After the recent se_task removal patches from hch, this value for IBLOCK
      backends being set via configfs by userspace from an saved max_sectors
      value that is turning out to be problematic, so it makes sense to go ahead
      and remove this now legacy attribute all-together.
      
      This patch also continues to make se_dev_set_default_attribs() do
      (sectors / block_size) alignment for what actually get used by
      target_core_mod to be safe here, following the same alignment currently
      used by fabric_max_sectors.
      Reported-by: NAndy Grover <agrover@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      11e764bd
  2. 16 3月, 2012 1 次提交
  3. 11 3月, 2012 2 次提交
  4. 26 2月, 2012 2 次提交
    • R
      target: Untangle front-end and back-end meanings of max_sectors attribute · 015487b8
      Roland Dreier 提交于
      se_dev_attrib.max_sectors currently has two independent meanings:
      
       - It is reported in the block limits VPD page as the maximum transfer
         length, ie the largest IO that the front-end (fabric) can handle.
         Also the target core doesn't enforce this maximum transfer length.
      
       - It is used to hold the size of the largest IO that the back-end can
         handle, so we know when to split SCSI commands into multiple tasks.
      
      Fix this by adding a new se_dev_attrib.fabric_max_sectors to hold the
      maximum transfer length, and checking incoming IOs against that limit.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      015487b8
    • R
      target: Use LIST_HEAD()/DEFINE_MUTEX() for static objects · d0f474e5
      Roland Dreier 提交于
      Instead of
      
         static struct list_head foo;
         static struct mutex bar;
      
         ...
      
         INIT_LIST_HEAD(&foo);
         mutex_init(&bar);
      
      just do
      
         static LIST_HEAD(foo);
         static DEFINE_MUTEX(bar);
      
      Also remove some superfluous struct list_head and spinlock_t
      initialization calls where the variables are already defined using
      macros that initialize them.
      
      This saves a decent amount of compiled code too:
      
          add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-178 (-178)
          function                                     old     new   delta
          target_core_init_configfs                    898     850     -48
          core_scsi3_emulate_pro_preempt              1742    1683     -59
          iscsi_thread_set_init                        159      88     -71
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d0f474e5
  5. 07 2月, 2012 1 次提交
  6. 14 12月, 2011 5 次提交
  7. 06 12月, 2011 1 次提交
  8. 24 10月, 2011 2 次提交
  9. 11 10月, 2011 1 次提交
  10. 15 9月, 2011 1 次提交
  11. 22 7月, 2011 10 次提交
    • A
      target: fix typo Assoication -> Association · 163cd5fa
      Andy Shevchenko 提交于
      Additionally this patch brings proper apply of the designator type.
      However, the original code luckily has no bug, because the association
      equals to 0.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: James Bottomley <jbottomley@parallels.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      163cd5fa
    • N
      target: Update QUEUE ALGORITHM MODIFIER control page default · 5de619a3
      Nicholas Bellinger 提交于
      This patch adds the default 'Unrestricted reordering allowed' for SCSI
      control mode page QUEUE ALGORITHM MODIFIER on a per se_device basis in
      target_modesense_control() following spc4r23.  This includes a new
      emuluate_rest_reord configfs attribute that currently (only) accepts
      zero to signal 'Unrestricted reordering allowed' in control mode page
      usage by the backend target device.
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      5de619a3
    • A
      target: Follow up core updates from AGrover and HCH (round 4) · 6708bb27
      Andy Grover 提交于
      This patch contains the squashed version of forth round series cleanups
      from Andy and Christoph following the post heavy lifting in the preceeding:
      'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
      changes.  This also includes a conversion of target core and the v3.0
      mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
      CONFIG_DYNAMIC_DEBUG infrastructure!
      
      These have been squashed into this third and final round for v3.1.
      
      target: Remove ifdeffed code in t_g_process_write
      target: Remove direct ramdisk code
      target: Rename task_sg_num to task_sg_nents
      target: Remove custom debug macros for pr_debug. Use pr_err().
      target: Remove custom debug macros in mainline fabrics
      target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
      target: Remove transport do_se_mem_map callback
      target: Further simplify transport_free_pages
      target: Redo task allocation return value handling
      target: Remove extra parentheses
      target: change alloc_task call to take *cdb, not *cmd
      
      (nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6708bb27
    • R
      target: Implement Block Device Characteristics VPD page · e22a7f07
      Roland Dreier 提交于
      Implement page B1h, Block Device Characteristics, so that we can report
      a medium rotation rate of 1 (non-rotating / solid state) if the
      is_nonrot device attribute is set; we update the iblock backend to set
      this attribute if the underlying Linux block device has its nonrot
      flag set.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e22a7f07
    • R
      target: Allow for built-in target modules · f5fbed85
      Roland Dreier 提交于
      In target_fabric_configfs_init(), we should allow fabric_mod to be NULL,
      since THIS_MODULE is NULL for built-in modules.  The main method of
      using the target code may be as modules, but having everything built-in
      is useful eg to be able to do quick testing with "qemu -kernel".
      
      In any case, we shouldn't bomb out fabric registration for a perfectly
      valid configuration, so simply drop the check of fabric_mod.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f5fbed85
    • C
      target: merge release_cmd methods · 35462975
      Christoph Hellwig 提交于
      The release_cmd_to_pool and release_cmd_direct methods are always the same.
      Merge them into a single release_cmd method, and clean up the fallout.
      
      (nab: fix breakage in transport_generic_free_cmd() parameter build breakage
       in drivers/target/tcm_fc/tfc_cmd.c)
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      35462975
    • C
    • A
      target: More core cleanups from AGrover (round 2) · 5951146d
      Andy Grover 提交于
      This patch contains the squashed version of second round of target core
      cleanups and simplifications and Andy and Co.   It also contains a handful
      of fixes to address bugs the original series and other minor cleanups.
      
      Here is the condensed shortlog:
      
      target: Remove unneeded casts to void*
      target: Rename get_lun_for_{cmd,tmr} to lookup_{cmd,tmr}_lun
      target: Make t_task a member of se_cmd, not a pointer
      target: Handle functions returning "-2"
      target: Use cmd->se_dev over cmd->se_lun->lun_se_dev
      target: Embed qr in struct se_cmd
      target: Replace embedded struct se_queue_req with a list_head
      target: Rename list_heads that are nodes in struct se_cmd to "*_node"
      target: Fold transport_device_setup_cmd() into lookup_{tmr,cmd}_lun()
      target: Make t_mem_list and t_mem_list_bidi members of t_task
      target: Add comment & cleanup transport_map_sg_to_mem()
      target: Remove unneeded checks in transport_free_pages()
      
      (Roland: Fix se_queue_req removal leftovers OOPs)
      (nab: Fix transport_lookup_tmr_lun failure case)
      (nab: Fix list_empty(&cmd->t_task.t_mem_bidi_list) inversion bugs)
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5951146d
    • A
      target: Core cleanups from AGrover (round 1) · e3d6f909
      Andy Grover 提交于
      This patch contains the squashed version of a number of cleanups and
      minor fixes from Andy's initial series (round 1) for target core this
      past spring.  The condensed log looks like:
      
      target: use errno values instead of returning -1 for everything
      target: Rename transport_calc_sg_num to transport_init_task_sg
      target: Fix leak in error path in transport_init_task_sg
      target/pscsi: Remove pscsi_get_sh() usage
      target: Make two runtime checks into WARN_ONs
      target: Remove hba queue depth and convert to spin_lock_irq usage
      target: dev->dev_status_queue_obj is unused
      target: Make struct se_queue_req.cmd type struct se_cmd *
      target: Remove __transport_get_qr_from_queue()
      target: Rename se_dev->g_se_dev_list to se_dev_node
      target: Remove struct se_global
      target: Simplify scsi mib index table code
      target: Make dev_queue_obj a member of se_device instead of a pointer
      target: remove extraneous returns at end of void functions
      target: Ensure transport_dump_vpd_ident_type returns null-terminated str
      target: Function pointers don't need to use '&' to be assigned
      target: Fix comment in __transport_execute_tasks()
      target: Misc style cleanups
      target: rename struct pr_reservation_template to pr_reservation
      target: Remove #defines that just perform indirection
      target: Inline transport_get_task_from_execute_queue()
      target: Minor header comment fixes
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e3d6f909
    • N
      target: Remove unused su_group usage in fabric register/dergister · a8c6da90
      Nicholas Bellinger 提交于
      This patch removes two instances of left over v3.x code performing local
      scope access to struct target_core_fabric_ops->tf_subsys->su_group in
      target_fabric_configfs_register() and target_fabric_configfs_deregister().
      Reported-by: NChristophe Fergeau <cfergeau@gmail.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      a8c6da90
  12. 24 6月, 2011 2 次提交
  13. 27 5月, 2011 1 次提交
  14. 25 5月, 2011 1 次提交
  15. 24 3月, 2011 4 次提交
    • N
      [SCSI] target: add initial statistics · 12d23384
      Nicholas Bellinger 提交于
      This patch adds a target_core_mib.c statistics conversion for
      backend context struct se_subsystem_dev + struct se_device config_group
      based statistics in target_core_device.c using CONFIGFS_EATTR()
      based struct config_item_types from target_core_stat.c code.
      
      The conversion from backend /proc/scsi_target/mib/ context output to configfs
      default groups+attributes include scsi_dev, scsi_lu, and scsi_tgt_dev output
      from within individual:
      
      	/sys/kernel/config/target/core/$HBA/DEV/
      
      The legacy procfs output now appear as individual configfs attributes under:
      
      *) $HBA/$DEV/statistics/scsi_dev:
      
      |-- indx
      |-- inst
      |-- ports
      `-- role
      
      *) $HBA/$DEV/statistics/scsi_lu:
      
      |-- creation_time
      |-- dev
      |-- dev_type
      |-- full_stat
      |-- hs_num_cmds
      |-- indx
      |-- inst
      |-- lu_name
      |-- lun
      |-- num_cmds
      |-- prod
      |-- read_mbytes
      |-- resets
      |-- rev
      |-- state_bit
      |-- status
      |-- vend
      `-- write_mbytes
      
      *) $HBA/$DEV/statistics/scsi_tgt_dev:
      
      |-- indx
      |-- inst
      |-- non_access_lus
      |-- num_lus
      |-- resets
      `-- status
      
      The conversion from backend /proc/scsi_target/mib/ context output to configfs
      default groups+attributes include scsi_port, scsi_tgt_port and scsi_transport
      output from within individual:
      
      	/sys/kernel/config/target/fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/
      
      The legacy procfs output now appear as individual configfs attributes under:
      
      *) fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/scsi_port
      
      |-- busy_count
      |-- dev
      |-- indx
      |-- inst
      `-- role
      
      *) fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/scsi_tgt_port
      
      |-- dev
      |-- hs_in_cmds
      |-- in_cmds
      |-- indx
      |-- inst
      |-- name
      |-- port_index
      |-- read_mbytes
      `-- write_mbytes
      
      *) fabric/$WWN/tpgt_$TPGT/lun/lun_$LUN_ID/statistics/scsi_transport
      
      |-- dev_name
      |-- device
      |-- indx
      `-- inst
      
      The conversion from backend /proc/scsi_target/mib/ context output to configfs
      default groups+attributes include scsi_att_intr_port and scsi_auth_intr output
      from within individual:
      
      	/sys/kernel/config/target/fabric/$WWN/tpgt_$TPGT/acls/$INITIATOR_WWN/lun_$LUN_ID/statistics/
      
      The legacy procfs output now appear as individual configfs attributes under:
      
      *) acls/$INITIATOR_WWN/lun_$LUN_ID/statistics/scsi_att_intr_port
      
      |-- dev
      |-- indx
      |-- inst
      |-- port
      |-- port_auth_indx
      `-- port_ident
      
      *) acls/$INITIATOR_WWN/lun_$LUN_ID/statistics/scsi_auth_intr
      
      |-- att_count
      |-- creation_time
      |-- dev
      |-- dev_or_port
      |-- hs_num_cmds
      |-- indx
      |-- inst
      |-- intr_name
      |-- map_indx
      |-- num_cmds
      |-- port
      |-- read_mbytes
      |-- row_status
      `-- write_mbytes
      
      Also, this includes adding struct target_fabric_configfs_template->
      tfc_wwn_fabric_stats_cit and ->tfc_tpg_nacl_stat_cit respectively for
      use during target_core_fabric_configfs.c:target_fabric_setup_cits()
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      12d23384
    • A
      [SCSI] target: Add __init/__exit annotation for target_core_[init,exit]_configfs · 54550fab
      Axel Lin 提交于
      This patch fixes the follownig section mismatch warning:
      
      WARNING: vmlinux.o(.text+0x21617a): Section mismatch in reference from the
      function target_core_init_configfs() to the function .init.text:rd_module_init()
      
      The function target_core_init_configfs() references the function __init
      rd_module_init().  This is often because target_core_init_configfs() lacks
      a __init annotation or the annotation of rd_module_init is wrong.
      Signed-off-by: NAxel Lin <axel.lin@gmail.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      54550fab
    • N
      [SCSI] target: Convert backend ->create_virtdevice() call to return ERR_PTR · 613640e4
      Nicholas Bellinger 提交于
      This patch converts the target_core_store_dev_enable() -> struct
      se_subsystem_api->create_virtdevice() call to return proper ERR_PTR values
      back up to configfs logic during backend dependent struct se_device ENABLE
      exception conditions.
      
      Along with the change to target_core_configfs.c, this includes converting IBLOCK,
      FILEIO, pSCSI, and RAMDISK_* backend subsystem plugins to obtain upper level
      PTR_ERR return codes (where available), and return via ERR_PTR during a
      *_create_virtdev() failure.
      Reported-by: NFubo Chen <fubo.chen@gmail.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      613640e4
    • J
      [SCSI] target: Fix match_strdup() memory leaks · 6d180253
      Jesper Juhl 提交于
      match_strdup() dynamically allocates memory and it is the responsabillity
      of the caller to free that memory. The following three cases:
      
      drivers/target/target_core_file.c:fd_set_configfs_dev_params()
      drivers/target/target_core_iblock.c:iblock_set_configfs_dev_params()
      drivers/target/target_core_configfs.c:target_core_dev_pr_store_attr_res_aptpl_metadata()
      
      should be kfree()'ing the allocated memory once it is no longer needed.
      It also makes sure to return -ENOMEM if the memory allocation in match_strdup()
      should fail.  For target_core_configfs.c, this patch adds kfree()'s around
      Opt_initiator_fabric, Opt_initiator_node, Opt_initiator_sid, Opt_sa_res_key,
      Opt_target_fabric, and Opt_target_node for the Persistent Reservations
      Activate Persistence across Target Power Loss (APTPL=1) token parsing.
      Signed-off-by: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      6d180253
  16. 13 2月, 2011 3 次提交
    • N
      [SCSI] target: fix use after free detected by SLUB poison · 1f6fe7cb
      Nicholas Bellinger 提交于
      This patch moves a large number of memory release paths inside of the
      configfs callback target_core_hba_item_ops->release() called from
      within fs/configfs/item.c: config_item_cleanup() context.  This patch
      resolves the SLUB 'Poison overwritten' warnings.
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      1f6fe7cb
    • N
      [SCSI] target: Remove procfs based target_core_mib.c code · e89d15ee
      Nicholas Bellinger 提交于
      This patch removes the legacy procfs based target_core_mib.c code,
      and moves the necessary scsi_index_tables functions and defines into
      target_core_transport.c and target_core_base.h code to allow existing
      fabric independent statistics to function.
      
      This includes the removal of a handful of 'atomic_t mib_ref_count'
      counters used in struct se_node_acl, se_session and se_hba to prevent
      removal while using seq_list procfs walking logic.
      
      [jejb: fix up compile failures]
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      e89d15ee
    • N
      [SCSI] target: Fix top-level configfs_subsystem default_group shutdown breakage · 7c2bf6e9
      Nicholas Bellinger 提交于
      This patch fixes two bugs uncovered during testing with
      slub_debug=FPUZ during module_exit() -> target_core_exit_configfs()
      with release of configfs subsystem consumer default groups, namely how
      this should be working with
      fs/configfs/dir.c:configfs_unregister_subsystem() release logic for
      struct config_group->default_group.
      
      The first issue involves configfs_unregister_subsystem() expecting to
      walk+drain the top-level subsys->su_group.default_groups directly in
      unlink_group(), and not directly from the configfs subsystem consumer
      for the top level struct config_group->default_groups.  This patch
      drops the walk+drain of subsys->su_group.default_groups from TCM
      configfs subsystem consumer code, and moves the top-level
      ->default_groups kfree() after configfs_unregister_subsystem() has
      been called.
      
      The second issue involves calling
      core_alua_free_lu_gp(se_global->default_lu_gp) to release the
      default_lu_gp->lu_gp_group before configfs_unregister_subsystem() has
      been called.  This patches also moves the core_alua_free_lu_gp() call
      to release default_lu_group->lu_gp_group after the subsys has been
      unregistered.
      
      Finally, this patch explictly clears the
      [lu_gp,alua,hba]_cg->default_groups pointers after kfree() to ensure
      that no stale memory is picked up from child struct
      config_group->default_group[] while configfs_unregister_subsystem() is
      called.
      Reported-by: NFubo Chen <fubo.chen@gmail.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      7c2bf6e9
  17. 15 1月, 2011 1 次提交
    • N
      [SCSI] target: Add LIO target core v4.0.0-rc6 · c66ac9db
      Nicholas Bellinger 提交于
      LIO target is a full featured in-kernel target framework with the
      following feature set:
      
      High-performance, non-blocking, multithreaded architecture with SIMD
      support.
      
      Advanced SCSI feature set:
      
          * Persistent Reservations (PRs)
          * Asymmetric Logical Unit Assignment (ALUA)
          * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
          * Full Error Recovery (ERL=0,1,2)
          * Active/active task migration and session continuation (ERL=2)
          * Thin LUN provisioning (UNMAP and WRITE_SAMExx)
      
      Multiprotocol target plugins
      
      Storage media independence:
      
          * Virtualization of all storage media; transparent mapping of IO to LUNs
          * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
          * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.
      
      Standards compliance:
      
          * Full compliance with IETF (RFC 3720)
          * Full implementation of SPC-4 PRs and ALUA
      
      Significant code cleanups done by Christoph Hellwig.
      
      [jejb: fix up for new block bdev exclusive interface. Minor fixes from
       Randy Dunlap and Dan Carpenter.]
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      c66ac9db