1. 22 7月, 2011 11 次提交
  2. 24 6月, 2011 8 次提交
    • N
      tcm_fc: Fix conversion spec warning · 95efa286
      Nicholas Bellinger 提交于
      This patch fixes the following conversion specification warning for size_t
      
      drivers/target/tcm_fc/tfc_io.c: In function ‘ft_queue_data_in’:
      drivers/target/tcm_fc/tfc_io.c:209: warning: format ‘%x’ expects type ‘unsigned int’, but argument 5 has type ‘size_t’
      Reported-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      95efa286
    • D
      tcm_fc: Fix possible lock to unlock type deadlock · 7c7cf3b9
      Dan Carpenter 提交于
      There is a typo here, it should be an unlock instead of a lock.  The
      original code will deadlock.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7c7cf3b9
    • K
      tcm_fc: Fix ft_send_tm LUN lookup OOPs · 61db9527
      Kiran Patil 提交于
      This patch fixes a bug in ft_send_tm() that was incorrectly calling
      ft_get_lun_for_cmd() -> transport_get_lun_for_cmd(), instead of using
      transport_get_lun_for_tmr() for the proper struct se_lun lookup
      that was triggering an OOPs in the se_cmd->tmr_req failure path.
      
      This patch fixes the issue by re-arranging the codepath where
      transport_get_lun_for_tmr() is called after tmr request is allocated and
      made it available as part of se_cmd.
      
      It also drops the now unnecessary ft_get_lun_for_cmd() unpacking code, and
      uses scsilun_to_int() directly ahead of transport_get_lun_for_cmd() and
      transport_get_lun_for_tmr() usage.
      Signed-off-by: NPatil, Kiran <kiran.patil@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      61db9527
    • D
      target: Fix incorrect strlen() NULL terminator checks · 60d645a4
      Dan Carpenter 提交于
      This patch fixes a number of cases in target core using an incorrectly
      
      	if (strlen(foo) > SOME_MAX_SIZE)
      
      As strlen() returns the number of characters in the string not counting
      the NULL character at the end.  So if you do something like:
      
              char buf[10];
      
              if (strlen("0123456789") > 10)
                      return -ETOOLONG;
              snprintf(buf, 10, "0123456789");
              printf("%s\n", buf);
      
      then the last "9" gets chopped off and only "012345678" is printed.
      
      Plus I threw in one small related cleanup.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      60d645a4
    • D
      target: Drop bogus ERR_PTR usage in target_fabric_configfs_init · 5eff5be0
      Dan Carpenter 提交于
      In the original code, there were several places inside the
      target_fabric_configfs_init() function that returned NULL on error
      and one place the returned an ERR_PTR.  There are two places that
      call this function and they only check for NULL returns; they don't
      check for ERR_PTRs.  So I've changed the ERR_PTR so now the function
      only returns NULL on error.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5eff5be0
    • D
      target: Fix ERR_PTR dereferencing bugs · 552523dc
      Dan Carpenter 提交于
      transport_init_session() and core_tmr_alloc_req() never return NULL,
      they only return ERR_PTRs on error.
      
      v2: Fix patch to return PTR_ERR(tl_nexus->se_sess) from Ankit Jain's
      feedback.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NAnkit Jain <jankit@suse.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      552523dc
    • R
      target: Convert transport_deregister_session_configfs nacl_sess_lock to save irq state · 23388864
      Roland Dreier 提交于
      This patch converts transport_deregister_session_configfs() to save/restore
      spinlock IRQ state for struct se_node_acl->nacl_sess_lock access as tcm_qla2xxx
      logic expects to call transport_deregister_session_configfs() code with
      irq save already held for struct qla_hw_data.
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      23388864
    • N
      target: Fix transport_get_lun_for_tmr failure cases · 7fd29aa9
      Nicholas Bellinger 提交于
      This patch fixes two possible NULL pointer dereferences in target v4.0
      code where se_tmr release path in core_tmr_release_req() can OOPs upon
      transport_get_lun_for_tmr() failure by attempting to access se_device or
      se_tmr->tmr_list without a valid member of se_device->tmr_list during
      transport_free_se_cmd() release.  This patch moves the se_tmr->tmr_dev
      pointer assignment in transport_get_lun_for_tmr() until after possible
      -ENODEV failures during unpacked_lun lookup.
      
      This addresses an OOPs originally reported with LIO v4.1 upstream on
      .39 code here:
      
          TARGET_CORE[qla2xxx]: Detected NON_EXISTENT_LUN Access for 0x00000000
          BUG: unable to handle kernel NULL pointer dereference at 0000000000000550
          IP: [<ffffffff81035ec4>] __ticket_spin_trylock+0x4/0x20
          PGD 0
          Oops: 0000 [#1] SMP
          last sysfs file: /sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_map
          CPU 1
          Modules linked in: netconsole target_core_pscsi target_core_file
      tcm_qla2xxx target_core_iblock tcm_loop target_core_mod configfs
      ipmi_devintf ipmi_si ipmi_msghandler serio_raw i7core_edac ioatdma dca
      edac_core ps_bdrv ses enclosure usbhid usb_storage ahci qla2xxx hid
      uas e1000e mpt2sas libahci mlx4_core scsi_transport_fc
      scsi_transport_sas raid_class scsi_tgt [last unloaded: netconsole]
      
          Pid: 0, comm: kworker/0:0 Tainted: G        W   2.6.39+ #1 Xyratex Storage Server
          RIP: 0010:[<ffffffff81035ec4>] [<ffffffff81035ec4>]__ticket_spin_trylock+0x4/0x20
          RSP: 0018:ffff88063e803c08  EFLAGS: 00010286
          RAX: ffff880619ab45e0 RBX: 0000000000000550 RCX: 0000000000000000
          RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000550
          RBP: ffff88063e803c08 R08: 0000000000000002 R09: 0000000000000000
          R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000568
          R13: 0000000000000001 R14: 0000000000000000 R15: ffff88060cd96a20
          FS:  0000000000000000(0000) GS:ffff88063e800000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
          CR2: 0000000000000550 CR3: 0000000001a03000 CR4: 00000000000006e0
          DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
          DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
          Process kworker/0:0 (pid: 0, threadinfo ffff880619ab8000, task ffff880619ab45e0)
          Stack:
           ffff88063e803c28 ffffffff812cf039 0000000000000550 0000000000000568
           ffff88063e803c58 ffffffff8157071e ffffffffa028a1dc ffff88060f7e4600
           0000000000000550 ffff880616961480 ffff88063e803c78 ffffffffa028a1dc
          Call Trace:
      <IRQ>
           [<ffffffff812cf039>] do_raw_spin_trylock+0x19/0x50
           [<ffffffff8157071e>] _raw_spin_lock+0x3e/0x70
           [<ffffffffa028a1dc>] ? core_tmr_release_req+0x2c/0x60 [target_core_mod]
           [<ffffffffa028a1dc>] core_tmr_release_req+0x2c/0x60 [target_core_mod]
           [<ffffffffa028d0d2>] transport_free_se_cmd+0x22/0x50 [target_core_mod]
           [<ffffffffa028d120>] transport_release_cmd_to_pool+0x20/0x40 [target_core_mod]
           [<ffffffffa028e525>] transport_generic_free_cmd+0xa5/0xb0 [target_core_mod]
           [<ffffffffa0147cc4>] tcm_qla2xxx_handle_tmr+0xc4/0xd0 [tcm_qla2xxx]
           [<ffffffffa0191ba3>] __qla24xx_handle_abts+0xd3/0x150 [qla2xxx]
           [<ffffffffa0197651>] qla_tgt_response_pkt+0x171/0x520 [qla2xxx]
           [<ffffffffa0197a2d>] qla_tgt_response_pkt_all_vps+0x2d/0x220 [qla2xxx]
           [<ffffffffa0171dd3>] qla24xx_process_response_queue+0x1a3/0x670 [qla2xxx]
           [<ffffffffa0196281>] ? qla24xx_atio_pkt+0x81/0x120 [qla2xxx]
           [<ffffffffa0174025>] ? qla24xx_msix_default+0x45/0x2a0 [qla2xxx]
           [<ffffffffa0174198>] qla24xx_msix_default+0x1b8/0x2a0 [qla2xxx]
           [<ffffffff810dadb4>] handle_irq_event_percpu+0x54/0x210
           [<ffffffff810dafb8>] handle_irq_event+0x48/0x70
           [<ffffffff810dd5ee>] ? handle_edge_irq+0x1e/0x110
           [<ffffffff810dd647>] handle_edge_irq+0x77/0x110
           [<ffffffff8100d362>] handle_irq+0x22/0x40
           [<ffffffff8157b28d>] do_IRQ+0x5d/0xe0
           [<ffffffff81571413>] common_interrupt+0x13/0x13
      <EOI>
           [<ffffffff813003f7>] ? intel_idle+0xd7/0x130
           [<ffffffff813003f0>] ? intel_idle+0xd0/0x130
           [<ffffffff8144832b>] cpuidle_idle_call+0xab/0x1c0
           [<ffffffff8100a26b>] cpu_idle+0xab/0xf0
           [<ffffffff81566c59>] start_secondary+0x1cb/0x1d2
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7fd29aa9
  3. 27 5月, 2011 6 次提交
  4. 25 5月, 2011 6 次提交
  5. 17 5月, 2011 1 次提交
  6. 10 4月, 2011 1 次提交
  7. 31 3月, 2011 1 次提交
  8. 24 3月, 2011 6 次提交
    • N
      [SCSI] tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module · 3703b2c5
      Nicholas Bellinger 提交于
      This patch adds the TCM_Loop Linux/SCSI LLD fabric module for
      accessing TCM device backstores as locally accessable SCSI LUNs in
      virtual SAS, FC, and iSCSI Target ports using the generic fabric
      TransportID and Target Port WWN naming handlers from TCM's
      target_core_fabric_lib.c The TCM_Loop module uses the generic fabric
      configfs infratructure provided by target_core_fabric_configfs.c and
      adds a module dependent attribute for the creation/release of the
      virtual I_T Nexus connected the TCM_Loop Target and Initiator Ports.
      
      TCM_Loop can also be used with scsi-generic and BSG drivers so that
      STGT userspace fabric modules, QEMU-KVM and other hypervisor SCSI
      passthrough support can access TCM device backstore and control CDB
      emulation.
      
      For more information please see:
      
      http://linux-iscsi.org/wiki/Tcm_loop
      
      [jejb: fixed up checkpatch stuff]
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      3703b2c5
    • 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: Fix FILEIO fd_buffered_io= token typo · 58c3e647
      Nicholas Bellinger 提交于
      This patch fixes a token typo for the TCM/FILEIO match_table_t used
      for toggling O_SYNC usage for individual struct file backend access.
      Reported-by: NChristophe Fergeau <cfergeau@gmail.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      58c3e647
    • N
      [SCSI] target: Fix bogus return in transport_add_device_to_core_hba failure path · 12a18bdc
      Nicholas Bellinger 提交于
      This patch removes a bogus conditional+return check within the failure path
      of transport_add_device_to_core_hba().  This breakage was introduced during
      the v4 conversion to remove struct se_cmd passthrough ops for INQUIRY /
      READ_CAPCITY during struct se_device creation and registration process.
      Reported-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      12a18bdc
    • J
      [SCSI] target: Avoid mem leak and needless work in transport_generic_get_mem · 87210568
      Jesper Juhl 提交于
      In drivers/target/target_core_transport.c::transport_generic_get_mem()
      there are a few potential memory leaks in the error paths. This patch
      makes sure that we free previously allocated memory when other allocations
      fail.  It also moves some work (INIT_LIST_HEAD() and assignment to
      se_mem->se_len) below all the allocations so that if something fails we
      don't do the work at all.
      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>
      87210568