1. 23 8月, 2011 14 次提交
    • N
      target: Fix task SGL chaining breakage with transport_allocate_data_tasks · c3c74c7a
      Nicholas Bellinger 提交于
      This patch fixes two bugs associated with transport_do_task_sg_chain()
      operation where transport_allocate_data_tasks() was incorrectly setting
      task_padded_sg for all tasks, and causing bogus task->task_sg_nents
      assignments + OOPsen with fabrics depending upon this code.  The first bit
      here adds a task_sg_nents_padded check in transport_allocate_data_tasks()
      to include an extra SGL vector when necessary for tasks that expect to
      be linked using sg_chain().
      
      The second change involves making transport_do_task_sg_chain() properly
      account for the extra SGL vector when task->task_padded_sg is set for
      the non trailing ->task_sg or single ->task_sg allocations.  Note this
      patch also removes the BUG_ON(!task->task_padded_sg) check within
      transport_do_task_sg_chain() as we expect this to happen normally
      with the updated logic in transport_allocate_data_tasks(), along with
      being bogus for CONTROL_SG_IO_CDB type payloads.
      
      So far this bugfix has been tested with tcm_qla2xxx and iblock backends
      in (task_count > 1)( and (task_count == 1) operation.
      Reported-by: NKiran Patil <kiran.patil@intel.com>
      Cc: Kiran Patil <kiran.patil@intel.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c3c74c7a
    • N
      target: Fix task count > 1 handling breakage and use max_sector page alignment · 525a48a2
      Nicholas Bellinger 提交于
      This patch addresses recent breakage with multiple se_task (task_count > 1)
      operation following backend dev->se_sub_dev->se_dev_attrib.max_sectors in new
      transport_allocate_data_tasks() code.  The initial bug here was a bogus
      task->task_sg_nents assignment in transport_allocate_data_tasks() based on
      the passed parameter, which now uses DIV_ROUND_UP(task_size, PAGE_SIZE) to
      determine the proper number of per task SGL entries for the (task_count > 1)
      case.
      
      This also means we now need to enforce a PAGE_SIZE aligned max_sector count
      value for this to work as expected without bringing back the pre v3.1
      transport_map_mem_to_sg() logic to handle SGL offsets across multiple tasks.
      So this patch adds se_dev_align_max_sectors() to round down max_sectors as
      necessary to ensure this alignment via se_dev_set_default_attribs() and
      se_dev_align_max_sectors() and keeps it simple for (task_count > 1)
      operation.
      
      So far this bugfix has been tested with (task_count > 1) operation
      using iscsi-target and iblock backends.
      Reported-by: NChris Boot <bootc@bootc.net>
      Cc: Kiran Patil <kiran.patil@intel.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      525a48a2
    • N
      target: Add missing DATA_SG_IO transport_cmd_get_valid_sectors check · 01cde4d5
      Nicholas Bellinger 提交于
      This patch adds the missing transport_cmd_get_valid_sectors() check for
      SCF_SCSI_DATA_SG_IO_CDB type payloads to ensure that a received LBA + range
      does not exeed past the end of associated backend struct se_device.
      
      This patch also fixes a bug in the failure path of transport_new_cmd_obj()
      where this check can fail, so change to use a signed 'rc' and return '-EINVAL'
      to signal proper transport_generic_request_failure() handling.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      01cde4d5
    • N
      target: Fix SYNCHRONIZE_CACHE zero LBA + range breakage · 7abbe7f3
      Nicholas Bellinger 提交于
      This patch fixes a SYNCHRONIZE_CACHE CDB handling bug with IBLOCK/FILEIO
      backends where transport_cmd_get_valid_sectors() was incorrectly rejecting
      a zero LBA + range CDB from being processed, and returning CHECK_CONDITION.
      
      This includes changing transport_cmd_get_valid_sectors() to return '0' on
      success and '-EINVAL' on failure (this makes more sense than sectors),
      and to only check transport_cmd_get_valid_sectors() when a non zero LBA +
      range SYNCHRONIZE_CACHE operation has been receieved for the non passthrough
      case.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7abbe7f3
    • N
      target: Remove duplicate task completions in transport_emulate_control_cdb · 72f4ba1e
      Nicholas Bellinger 提交于
      This patch removes a duplicate set of transport_complete_task() calls in
      target_emulate_unmap() and target_emulate_write_same() as the completion
      call is already done within transport_emulate_control_cdb()
      
      This patch also adds a check in transport_emulate_control_cdb() for the
      existing SCF_EMULATE_CDB_ASYNC flag currently used by SYNCHRONIZE_CACHE
      in order to handle IMMEDIATE processing.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      72f4ba1e
    • N
      target: Fix WRITE_SAME usage with transport_get_size · 12850626
      Nicholas Bellinger 提交于
      For all flavours of WRITE_SAME, we only expect to handle a single block
      of data-out buffer payload, regardless of the number of logical blocks
      presented in the CDB.  This patch changes all flavours of WRITE_SAME in
      transport_generic_cmd_sequencer() to pass '1' into transport_get_size()
      instead of the extracted 'sectors' to properly handle the default usage
      of sg_write_same without the --xferlen parameter.
      Reported-by: NEric Seppanen <eric@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      12850626
    • N
      target: Add WRITE_SAME (10) parsing and refactor passthrough checks · 706d5860
      Nicholas Bellinger 提交于
      This patch adds initial WRITE_SAME (10) w/ UNMAP=1 support following updates in
      sbcr26 to allow UNMAP=1 for the non 16 + 32 byte CDB case.  It also refactors
      current pSCSI passthrough passthrough checks into target_check_write_same_discard()
      ahead of UNMAP=0 w/ write payload support into target_core_iblock.c.
      
      This includes the support for handling WRITE_SAME in transport_emulate_control_cdb(),
      and converts target_emulate_write_same to accept num_blocks directly for
      WRITE_SAME, WRITE_SAME_16 and WRITE_SAME_32.
      Reported-by: NEric Seppanen <eric@purestorage.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      706d5860
    • N
      target: Fix write payload exception handling with ->new_cmd_map · 16ab8e60
      Nicholas Bellinger 提交于
      This patch fixes a bug for fabrics using tfo->new_cmd_map() that
      are expect transport_generic_request_failure() to be calling
      transport_send_check_condition_and_sense() for both READ and WRITE,
      instead of only for READ exceptions.
      
      This was originally observed with a failed WRITE_SAME_16 w/ unmap=0
      using tcm_loop.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      16ab8e60
    • D
      iscsi-target: forever loop bug in iscsit_attach_ooo_cmdsn() · 387e96c0
      Dan Carpenter 提交于
      This patch fixes a forever loop bug in iscsit_attach_ooo_cmdsn()
      while walking sess->sess_ooo_cmdsn_list when the received
      CmdSN is less than the tail of the list.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      387e96c0
    • D
      iscsi-target: remove duplicate return · c2337c70
      Dan Carpenter 提交于
      We returned on the line before already.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c2337c70
    • J
      target: Convert target_core_rd.c to use use BUG_ON · 6fc61488
      Julia Lawall 提交于
      Use BUG_ON(x) rather than if(x) BUG();
      
      The semantic patch that fixes this problem is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@ identifier x; @@
      -if (x) BUG();
      +BUG_ON(x);
      
      @@ identifier x; @@
      -if (!x) BUG();
      +BUG_ON(!x);
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6fc61488
    • J
      iscsi-target: Fix leak on failure in iscsi_copy_param_list() · 9be08c58
      Jesper Juhl 提交于
      We leak memory if the allocations for 'new_param->name' or
      'new_param->value' fail in iscsi_target_parameters.c::iscsi_copy_param_list()
      
      We also do a lot of variable assignments that are completely pointless
      if the allocations fail.
      
      So, let's move the allocations before the assignments and also make
      sure that we free whatever was allocated to one if the allocation fail.
      
      There's also some small CodingStyle fixups in there (curly braces on
      both branches of if statement, only one variable per line) since I was
      in the area anyway. And finally, error messages in the function are
      put on a single line for easy grep'abillity.
      Signed-off-by: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9be08c58
    • T
      target: Use ERR_CAST inlined function · e1750ba2
      Thomas Meyer 提交于
      Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
      
      The semantic patch that makes this output is available
      in scripts/coccinelle/api/err_cast.cocci.
      
      More information about semantic patching is available at
      http://coccinelle.lip6.fr/Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e1750ba2
    • N
      target: Make standard INQUIRY return 'not connected' for tpg_virt_lun0 · 052605c6
      Nicholas Bellinger 提交于
      This patch changes target_emulate_inquiry_std() to set the 'not connected'
      (0x35) bit in standard INQUIRY response data when we are processing a
      request to a virtual LUN=0 mapping from struct se_device *g_lun0_dev that
      have been setup for us in transport_lookup_cmd_lun().
      
      This addresses an issue where qla2xxx FC clients need to be able
      to create demo-mode I_T FC Nexuses by default, but should not be
      exposing the default set of TPG LUNs to all FC clients.  This includes
      adding an new optional target_core_fabric_ops->tpg_check_demo_mode_login_only()
      caller to allow demo_mode nexuses to skip the old default of bulding
      a demo-mode MappedLUNs list via core_tpg_add_node_to_devs().
      
      (roland: Add missing tpg_check_demo_mode_login_only check in core_dev_add_lun)
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      052605c6
  2. 17 8月, 2011 1 次提交
  3. 15 8月, 2011 3 次提交
  4. 14 8月, 2011 22 次提交