1. 03 10月, 2012 11 次提交
    • D
      target/iscsi: precedence bug in iscsit_set_dataout_sequence_values() · d7ca663c
      Dan Carpenter 提交于
      Clang warns about this bug:
      drivers/target/iscsi/iscsi_target_erl0.c:52:45: warning: operator '?:'
      	has lower precedence than '+'; '+' will be evaluated first
      	[-Wparentheses]
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d7ca663c
    • N
      target: Add control CDB READ payload zero work-around · 944981c7
      Nicholas Bellinger 提交于
      This patch carries forward a work-around from tcm_loop to target
      core code to explicitly clear control CDB READ paylods in order to
      avoid bugs in scsi-generic user-space code for INQUIRY that do not
      explicitly zero CDB payload memory.
      
      (v2: Drop TARGET_SCF_MAP_CLEAR_MEM, and perform the explicit zero
           of READ memory for all target_submit_cmd_map_sgls users)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      944981c7
    • N
      tcm_loop: Convert I/O path to use target_submit_cmd_map_sgls · 8f9f44f8
      Nicholas Bellinger 提交于
      This patch converts tcm_loop to use target_submit_cmd_map_sgls() for
      I/O submission and mapping of pre-allocated SGL memory from incoming
      scsi_cmnd -> se_cmd descriptors.
      
      This includes removing the original open-coded fabric uses of target
      core callers to support transport_generic_map_mem_to_cmd() between
      target_setup_cmd_from_cdb() and transport_handle_cdb_direct() logic.
      
      (v2: Use renamed target_submit_cmd_map_sgls)
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8f9f44f8
    • N
      target: Add target_submit_cmd_map_sgls for SGL fabric memory passthrough · a026757f
      Nicholas Bellinger 提交于
      This patch adds a new target_submit_cmd_map_sgls() to pass pre-allocated
      SGL memory using transport_generic_map_mem_to_cmd() logic into the generic
      target submit I/O codepath.
      
      It also adds a target_submit_cmd() wrapper around target_submit_cmd_map_sgls()
      for existing fabric code that already assumes internal target-core SGL memory
      allocation.
      
      (v2: Rename to target_submit_cmd_map_sgls + drop TARGET_SCF_MAP_MEM flag
           in favor of non zero sgl_count check)
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      a026757f
    • N
      iscsi-target: Add explicit set of cache_dynamic_acls=1 for TPG demo-mode · 38b11bae
      Nicholas Bellinger 提交于
      We've had reports in the past about this specific case, so it's time to
      go ahead and explicitly set cache_dynamic_acls=1 for generate_node_acls=1
      (TPG demo-mode) operation.
      
      During normal generate_node_acls=0 operation with explicit NodeACLs ->
      se_node_acl memory is persistent to the configfs group located at
      /sys/kernel/config/target/$TARGETNAME/$TPGT/acls/$INITIATORNAME, so in
      the generate_node_acls=1 case we want the reservation logic to reference
      existing per initiator IQN se_node_acl memory (not to generate a new
      se_node_acl), so go ahead and always set cache_dynamic_acls=1 when
      TPG demo-mode is enabled.
      Reported-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      38b11bae
    • N
      iscsi-target: Change iscsi_target_seq_pdu_list.c to honor MaxXmitDataSegmentLength · b094a4bd
      Nicholas Bellinger 提交于
      This patch converts iscsi_target_seq_pdu_list.c code for DataSequenceInOrder=No +
      DataPDUInOrder=No operation to honor the MaxXmitDataSegmentLength value
      for iscsi_cmd->se_cmd.data_direction == DMA_TO_DEVICE cases.
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b094a4bd
    • N
      iscsi-target: Add MaxXmitDataSegmentLength connection recovery check · 1c417f39
      Nicholas Bellinger 提交于
      The iSCSI TMR TASK_REASSIGN completion logic in iscsi_tmr_task_reassign()
      does an explict check for MRDSL across task reassignment, so go ahead and
      add an explict MaxXmitDataSegmentLength check here as well to be safe.
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      1c417f39
    • N
      iscsi-target: Convert incoming PDU payload checks to MaxXmitDataSegmentLength · 21f5aa7e
      Nicholas Bellinger 提交于
      Now that iscsi-target supports a local configurable MaxXmitDataSegmentLength,
      go ahead and make ISCSI_OP_SCSI_CMD, ISCSI_OP_SCSI_DATA_OUT, ISCSI_OP_NOOP_OUT
      and ISCSI_OP_TEXT PDU payload checks honor conn_ops->MaxXmitDataSegmentLength.
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      21f5aa7e
    • N
      iscsi-target: Enable MaxXmitDataSegmentLength operation in login path · 9977bb18
      Nicholas Bellinger 提交于
      This patch activates MaxXmitDataSegmentLength usage that performs the
      following sequence of events:
      
      - Once the incoming initiator's MAXRECVDATASEGMENTLENGTH key is detected
        within iscsi_check_acceptor_state(), save the requested MRDSL into
        conn->conn_ops->MaxRecvDataSegmentLength
      
      - Next change the outgoing target's MaxRecvDataSegmenthLength key=value
        based upon the local TPG's MaxXmitDataSegmentLength attribute value.
      
      - Change iscsi_set_connection_parameters() to skip the assignment of
        conn->conn_ops->MaxRecvDataSegmentLength, now setup within
        iscsi_check_acceptor_state()
      
      Also update iscsi_decode_text_input() -> iscsi_check_acceptor_state()
      code-path to accept struct iscsi_conn *.
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9977bb18
    • N
      iscsi-target: Add base MaxXmitDataSegmentLength code · e004cb25
      Nicholas Bellinger 提交于
      This patch introduces a new per connection MaxXmitDataSegmentLength
      parameter value used to represent the outgoing MaxRecvDataSegmentLength
      that is actually sent over the wire during iSCSI login response back
      to the initiator side.
      
      It also adds a new MaxXmitDataSegmentLength configfs attribute to
      represent this value within the existing TPG parameter group under
      /sys/kernel/config/target/iscsi/$TARGETNAME/$TPGT/param/
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e004cb25
    • N
      target/file: Re-enable optional fd_buffered_io=1 operation · b32f4c7e
      Nicholas Bellinger 提交于
      This patch re-adds the ability to optionally run in buffered FILEIO mode
      (eg: w/o O_DSYNC) for device backends in order to once again use the
      Linux buffered cache as a write-back storage mechanism.
      
      This logic was originally dropped with mainline v3.5-rc commit:
      
      commit a4dff304
      Author: Nicholas Bellinger <nab@linux-iscsi.org>
      Date:   Wed May 30 16:25:41 2012 -0700
      
          target/file: Use O_DSYNC by default for FILEIO backends
      
      This difference with this patch is that fd_create_virtdevice() now
      forces the explicit setting of emulate_write_cache=1 when buffered FILEIO
      operation has been enabled.
      
      (v2: Switch to FDBD_HAS_BUFFERED_IO_WCE + add more detailed
           comment as requested by hch)
      Reported-by: NFerry <iscsitmp@bananateam.nl>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b32f4c7e
  2. 23 9月, 2012 2 次提交
  3. 18 9月, 2012 21 次提交
  4. 08 9月, 2012 6 次提交
    • P
      target: go through normal processing for zero-length REQUEST_SENSE · 6abbdf38
      Paolo Bonzini 提交于
      Now that spc_emulate_request_sense has been taught to process zero-length
      REQUEST SENSE correctly, drop the special handling of unit attention
      conditions from transport_generic_new_cmd.  However, for now REQUEST SENSE
      will be the only command that goes through emulation for zero lengths.
      
      (nab: Fix up zero-length check in transport_generic_new_cmd)
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6abbdf38
    • P
      target: support zero allocation length in REQUEST SENSE · 32a8811f
      Paolo Bonzini 提交于
      Similar to INQUIRY and MODE SENSE, construct the sense data in a
      buffer and later copy it to the scatterlist.  Do not do anything,
      but still clear a pending unit attention condition, if the allocation
      length is zero.
      
      However, SPC tells us that "If a REQUEST SENSE command is terminated with
      CHECK CONDITION status [and] the REQUEST SENSE command was received on
      an I_T nexus with a pending unit attention condition (i.e., before the
      device server reports CHECK CONDITION status), then the device server
      shall not clear the pending unit attention condition."  Do the
      transport_kmap_data_sg early to detect this case.
      
      It also tells us "Device servers shall not adjust the additional sense
      length to reflect truncation if the allocation length is less than the
      sense data available", so do not do that!  Note that the err variable
      is write-only.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      32a8811f
    • P
      target: support zero-size allocation lengths in transport_kmap_data_sg · 3717ef0c
      Paolo Bonzini 提交于
      In order to support zero-size allocation lengths, do not assert
      that we have a scatterlist until after checking cmd->data_length.
      
      But once we do this, we can have two cases of transport_kmap_data_sg
      returning NULL: a zero-size allocation length, or an out-of-memory
      condition.  Report the latter using sense codes, so that the SCSI
      command that triggered it will fail.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      3717ef0c
    • P
      target: fail REPORT LUNS with less than 16 bytes of payload · 9b16b9ed
      Paolo Bonzini 提交于
      SPC says:
      
      "The ALLOCATION LENGTH field is defined in 4.3.5.6. The allocation length
      should be at least 16.  Device servers compliant with SPC return CHECK
      CONDITION status, with the sense key set to ILLEGAL REQUEST, and the
      additional sense code set to INVALID FIELD IN CDB when the allocation
      length is less than 16 bytes".
      
      Testcase: sg_raw -r8 /dev/sdb a0 00 00 00 00 00 00 00 00 08 00 00
          should fail with ILLEGAL REQUEST / INVALID FIELD IN CDB sense
          does not fail without the patch
          fails correctly with the patch
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9b16b9ed
    • P
      target: report too-small parameter lists everywhere · 0d7f1299
      Paolo Bonzini 提交于
      Several places were not checking that the parameter list length
      was large enough, and thus accessing invalid memory.  Zero-length
      parameter lists are just a special case of this.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0d7f1299
    • P
      target: go through normal processing for zero-length PSCSI commands · 306c11b2
      Paolo Bonzini 提交于
      Right now, commands with a zero-size payload are skipped completely.
      This is wrong; such commands should be passed down to the device and
      processed normally.
      
      For physical backends, this ignores completely things such as START
      STOP UNIT.  For virtual backends, we have a hack in place to clear a
      unit attention state on a zero-size REQUEST SENSE, but we still do
      not report errors properly on zero-length commands---out-of-bounds
      0-block reads and writes, too small parameter list lengths, etc.
      
      This patch fixes this for PSCSI.  Uses of transport_kmap_data_sg are
      guarded with a check for non-zero cmd->data_length; for all other
      commands a zero length is handled properly in pscsi_execute_cmd.
      The sole exception will be for now REPORT LUNS, which is handled
      through the normal SPC emulation.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      306c11b2