1. 22 7月, 2011 4 次提交
    • N
      target/iblock: Use request_queue->nr_request for se_device defaults · 8f3d14e2
      Nicholas Bellinger 提交于
      This patch converts iblock_create_virtdevice() to use request_queue->nr_request
      for se_dev_limits usage of ->hw_queue_depth and ->queue_depth for individual
      struct se_device export.
      
      It also removes the now unused defines for IBLOCK_DEVICE_QUEUE_DEPTH and
      IBLOCK_MAX_DEVICE_QUEUE_DEPTH
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8f3d14e2
    • A
      target: Updates from AGrover and HCH (round 3) · a1d8b49a
      Andy Grover 提交于
      This patch contains a squashed version of third round series cleanups,
      improvements ,and simplfications from Andy and Christoph ahead of the
      heavy lifting between round 3 -> 4 for the target core SGL conversion.
      
      This include cleanups to the main target I/O path and other miscellaneous
      updates.
      
      target: Replace custom sg<->buf functions with lib funcs
      target: Simplify sector limiting code
      target: get_cdb should never return NULL
      target: Simplify transport_memcpy_se_mem_read_contig
      target: Use assignment rather than increment for t_task_cdbs
      target: Don't pass dma_size to generic_get_mem
      target: Pass sg with type scatterlist in transport_map_sg_to_mem
      target: Move task_sg_num next to task_sg in struct se_task
      target: inline struct se_transport_task into struct se_cmd
      target: Change name & semantics of transport_get_sectors()
      target: Remove unused members of se_cmd
      target: Rename se_cmd.t_task_cdbs to t_task_list_num
      target: Fix some spelling
      target: Remove unused var from transport_generic_do_tmr
      target: map_sg_to_mem: return sg_count in return value
      target/pscsi: Use min_t for sector limits
      target/pscsi: Unused param for pscsi_get_bio()
      target: Rename get_cdb_count to allocate_tasks
      target: Make transport_generic_new_cmd() available for iscsi-target
      target: Remove fabric callback to allocate iovecs
      target: Fix transport_generic_new_cmd WRITE comment
      
      (hch: Use __GFP_ZERO usage for alloc_pages() usage)
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a1d8b49a
    • 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
  2. 24 3月, 2011 2 次提交
    • 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
  3. 10 3月, 2011 1 次提交
  4. 02 3月, 2011 1 次提交
  5. 13 2月, 2011 2 次提交
    • N
      [SCSI] target/iblock: Fix failed bd claim NULL pointer dereference · bc665524
      Nicholas Bellinger 提交于
      This patch adds an explict check for struct iblock_dev->ibd_bd in
      iblock_free_device() before calling blkdev_put(), which will otherwise hit
      the following NULL pointer dereference @ ib_dev->ibd_bd when iblock_create_virtdevice()
      fails to claim an already in-use struct block_device via blkdev_get_by_path().
      
      [  112.528578] Target_Core_ConfigFS: Allocated struct se_subsystem_dev: ffff88001e750000 se_dev_su_ptr: ffff88001dd05d70
      [  112.534681] Target_Core_ConfigFS: Calling t->free_device() for se_dev_su_ptr: ffff88001dd05d70
      [  112.535029] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
      [  112.535029] IP: [<ffffffff814987a3>] mutex_lock+0x14/0x35
      [  112.535029] PGD 1e5d0067 PUD 1e274067 PMD 0
      [  112.535029] Oops: 0002 [#1] SMP
      [  112.535029] last sysfs file: /sys/devices/pci0000:00/0000:00:07.1/host2/target2:0:0/2:0:0:0/type
      [  112.535029] CPU 0
      [  112.535029] Modules linked in: iscsi_target_mod target_core_stgt scsi_tgt target_core_pscsi target_core_file target_core_iblock target_core_mod configfs sr_mod cdrom sd_mod ata_piix mptspi mptscsih libata mptbase [last unloaded: scsi_wait_scan]
      [  112.535029]
      [  112.535029] Pid: 3345, comm: python2.5 Not tainted 2.6.37+ #1 440BX Desktop Reference Platform/VMware Virtual Platform
      [  112.535029] RIP: 0010:[<ffffffff814987a3>]  [<ffffffff814987a3>] mutex_lock+0x14/0x35
      [  112.535029] RSP: 0018:ffff88001e6d7d58  EFLAGS: 00010246
      [  112.535029] RAX: 0000000000000000 RBX: 0000000000000020 RCX: 0000000000000082
      [  112.535029] RDX: ffff88001e6d7fd8 RSI: 0000000000000083 RDI: 0000000000000020
      [  112.535029] RBP: ffff88001e6d7d68 R08: 0000000000000000 R09: 0000000000000000
      [  112.535029] R10: ffff8800000be860 R11: ffff88001f420000 R12: 0000000000000020
      [  112.535029] R13: 0000000000000083 R14: ffff88001d809430 R15: ffff88001d8094f8
      [  112.535029] FS:  00007ff17ca7d6e0(0000) GS:ffff88001fa00000(0000) knlGS:0000000000000000
      [  112.535029] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  112.535029] CR2: 0000000000000020 CR3: 000000001e5d2000 CR4: 00000000000006f0
      [  112.535029] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  112.535029] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [  112.535029] Process python2.5 (pid: 3345, threadinfo ffff88001e6d6000, task ffff88001e2d0760)
      [  112.535029] Stack:
      [  112.535029]  ffff88001e6d7d88 0000000000000000 ffff88001e6d7d98 ffffffff811187fc
      [  112.535029]  ffff88001d809430 ffff88001dd05d70 ffff88001e750860 ffff88001e750000
      [  112.535029]  ffff88001e6d7db8 ffffffffa00e3757 ffff88001e6d7db8 0000000000000004
      [  112.535029] Call Trace:
      [  112.535029]  [<ffffffff811187fc>] blkdev_put+0x28/0x107
      [  112.535029]  [<ffffffffa00e3757>] iblock_free_device+0x1d/0x36 [target_core_iblock]
      [  112.535029]  [<ffffffffa00a319c>] target_core_drop_subdev+0x15f/0x18d [target_core_mod]
      [  112.535029]  [<ffffffffa00960db>] client_drop_item+0x25/0x31 [configfs]
      [  112.535029]  [<ffffffffa00967b5>] configfs_rmdir+0x1a1/0x223 [configfs]
      [  112.535029]  [<ffffffff810fa8cd>] vfs_rmdir+0x7e/0xd3
      [  112.535029]  [<ffffffff810fc3be>] do_rmdir+0xa3/0xf4
      [  112.535029]  [<ffffffff810fc446>] sys_rmdir+0x11/0x13
      [  112.535029]  [<ffffffff81002a92>] system_call_fastpath+0x16/0x1b
      [  112.535029] Code: 8b 04 25 88 b5 00 00 48 2d d8 1f 00 00 48 89 43 18 31 c0 5e 5b c9 c3 55 48 89 e5 53 48 89 fb 48 83 ec 08 e8 c4 f7 ff ff 48 89 df <3e> ff 0f 79 05 e8 1e ff ff ff 65 48 8b 04 25 88 b5 00 00 48 2d
      [  112.535029] RIP  [<ffffffff814987a3>] mutex_lock+0x14/0x35
      [  112.535029]  RSP <ffff88001e6d7d58>
      [  112.535029] CR2: 0000000000000020
      [  132.679636] ---[ end trace 05754bb48eb828f0 ]---
      
      Note it also adds an second explict check for ib_dev->ibd_bio_set before calling
      bioset_free() to fix the same possible NULL pointer deference during an early
      iblock_create_virtdevice() failure.
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      bc665524
    • D
      [SCSI] target: iblock/pscsi claim checking for NULL instead of IS_ERR · 3ae279d2
      Dan Carpenter 提交于
      blkdev_get_by_path() returns an ERR_PTR() or error and it doesn't return
      a NULL.  It looks like this bug would be easy to trigger by mistake.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NNicholas A. Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      3ae279d2
  6. 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