1. 10 Sep, 2013 3 commits
    • Nicholas Bellinger's avatar
      target: Release COMPARE_AND_WRITE mutex in generic failure path · cf6d1f09
      Nicholas Bellinger authored
      This patch adds a extra check for SCF_COMPARE_AND_WRITE within
      transport_generic_request_failure() to invoke the callback for
      compare_and_write_callback() or compare_and_write_done(), in
      order to release se_dev->caw_mutex from the generic failure
      path.
      
      It also adds to checks within compare_and_write_callback() to
      avoid processing when transport_generic_request_failure() occurs
      early enough that cmd->t_data_sg or cmd->t_bidi_data_sg have not
      been setup yet, nor se_dev->caw_mutex obtained from within
      sbc_compare_and_write().
      
      v4 changes:
       - Add explicit check for cmd->transport_complete_callback in
         transport_generic_request_failure() to handle case where
         sbc_compare_and_write()clears callback pointer (Dan Carpenter)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      cf6d1f09
    • Nicholas Bellinger's avatar
      target: Add compare_and_write_post() completion callback fall through · a2890087
      Nicholas Bellinger authored
      This patch changes target_complete_ok_work() to fall through
      after calling the se_cmd->transport_complete_callback() ->
      compare_and_write_post() callback, by keying off the existance
      of SCF_COMPARE_AND_WRITE_POST.
      
      This is necessary because once SCF_COMPARE_AND_WRITE_POST has
      been set by compare_and_write_post(), the SCSI response needs
      to be sent via TFO->queue_status().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      a2890087
    • Nicholas Bellinger's avatar
      target: Add support for COMPARE_AND_WRITE emulation · 68ff9b9b
      Nicholas Bellinger authored
      This patch adds support for COMPARE_AND_WRITE emulation on a per block
      basis.  This logic is used as an atomic test and set primative currently
      used by VMWare ESX VAAI for performing array side locking of individual
      VMFS extent ownership.
      
      This includes the COMPARE_AND_WRITE CDB parsing within sbc_parse_cdb(),
      and does the majority of the work within the compare_and_write_callback()
      to perform the verify instance user data comparision, and subsequent
      write instance user data I/O submission upon a successfull comparision.
      
      The synchronization is enforced by se_device->caw_sem, that is obtained
      before the initial READ I/O submission in sbc_compare_and_write().  The
      mutex is then released upon MISCOMPARE in compare_and_write_callback(),
      or upon WRITE instance user-data completion in compare_and_write_post().
      
      The implementation currently assumes a single logical block (NoLB=1).
      
      v4 changes:
       - Explicitly clear cmd->transport_complete_callback for two failure
         cases in sbc_compare_and_write() in order to avoid double unlock
         of ->caw_sem in compare_and_write_callback() (Dan Carpenter)
      
      v3 changes:
       - Convert se_device->caw_mutex to ->caw_sem
      
      v2 changes:
       - Set SCF_COMPARE_AND_WRITE and cmd->execute_cmd() to
         sbc_compare_and_write() during setup in sbc_parse_cdb()
       - Use sbc_compare_and_write() for initial READ submission with
         DMA_FROM_DEVICE
       - Reset cmd->execute_cmd() to sbc_execute_rw() for write instance
         user-data in compare_and_write_callback()
       - Drop SCF_BIDI command flag usage
       - Set TRANSPORT_PROCESSING + transport_state flags before write
         instance submission, and convert to __target_execute_cmd()
       - Prevent sbc_get_size() from being being called twice to
         generate incorrect size in sbc_parse_cdb()
       - Enforce se_device->caw_mutex synchronization between initial
         READ I/O submission, and final WRITE I/O completion.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      68ff9b9b
  2. 09 Sep, 2013 22 commits
    • Nicholas Bellinger's avatar
      target: Add MAXIMUM COMPARE AND WRITE LENGTH in Block Limits VPD · 0123a9ec
      Nicholas Bellinger authored
      This patch adds the MAXIMUM COMPARE AND WRITE LENGTH bit, currently
      hardcoded to a single logical block (NoLB=1) within the Block Limits
      VPD in spc_emulate_evpd_b0().
      
      Also add emulate_caw device attribute in configfs (enabled by default)
      to allow the exposure of this bit to be disabled, if necessary.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      0123a9ec
    • Nicholas Bellinger's avatar
      target: Make __target_execute_cmd() available as extern · 76dde50e
      Nicholas Bellinger authored
      Required by COMPARE_AND_WRITE for write instance user-data
      submission, in order to bypass target_execute_cmd() checks.
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      76dde50e
    • Nicholas Bellinger's avatar
      target: Add transport_reset_sgl_orig() for COMPARE_AND_WRITE · 47e459e6
      Nicholas Bellinger authored
      After COMPARE_AND_WRITE completes it's comparision, the WRITE
      payload SGLs head expect to be updated to point from the verify
      instance of user data, to the write instance of user data.
      
      So for this special case, add transport_reset_sgl_orig() usage
      within transport_free_pages() and add se_cmd->t_data_[sg,nents]_orig
      members to save the original assignments.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      47e459e6
    • Nicholas Bellinger's avatar
      target: Do memory allocation for bidi commands using target_alloc_sgl · 8cefe07b
      Nicholas Bellinger authored
      This patch updates transport_generic_new_cmd() to call target_alloc_sgl()
      for SGL + page memory allocation for se_cmd->t_bidi_data_sg.
      
      It also adds the special case for SCF_COMPARE_AND_WRITE to calculate a
      different bidi_length based upon se_cmd->t_task_nolb.
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      8cefe07b
    • Nicholas Bellinger's avatar
      target: Refactor transport_generic_get_mem to target_alloc_sgl · 20093994
      Nicholas Bellinger authored
      This patch refactors transport_generic_get_mem() to target_alloc_sgl()
      for accepting **sgl, *nents, length and zero_page as function parameters
      in order to be used for both se_cmd->t_data_sg + se_cmd->t_bidi_data_sg
      allocations.
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      20093994
    • Nicholas Bellinger's avatar
      target: Convert se_cmd->t_bidi_data_sg checks to use SCF_BIDI · 64577407
      Nicholas Bellinger authored
      Stop keying off se_cmd->t_bidi_data_sg within transport_complete_qf()
      + target_complete_ok_work(), and just use SCF_BIDI instead.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      64577407
    • Nicholas Bellinger's avatar
      target: Allow sbc_ops->execute_rw() to accept SGLs + data_direction · a82a9538
      Nicholas Bellinger authored
      COMPARE_AND_WRITE expects to be able to send down a DMA_FROM_DEVICE
      to obtain the necessary READ payload for comparision against the
      first half of the WRITE payload containing the verify user data.
      
      Currently virtual backends expect to internally reference SGLs,
      SGL nents, and data_direction, so change IBLOCK, FILEIO and RD
      sbc_ops->execute_rw() to accept this values as function parameters.
      
      Also add default sbc_execute_rw() handler for the typical case for
      cmd->execute_rw() submission using cmd->t_data_sg, cmd->t_data_nents,
      and cmd->data_direction).
      
      v2 Changes:
        - Add SCF_COMPARE_AND_WRITE command flag
        - Use sbc_execute_rw() for normal cmd->execute_rw() submission
          with expected se_cmd members.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      a82a9538
    • Nicholas Bellinger's avatar
      target: Add TCM_MISCOMPARE_VERIFY sense handling · 818b571c
      Nicholas Bellinger authored
      This patch adds TCM_MISCOMPARE_VERIFY (ASC=0x1d, ASCQ=0x00) sense
      handling to transport_send_check_condition_and_sense(), which is
      required for a COMPARE_AND_WRITE comparision failure.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      818b571c
    • Nicholas Bellinger's avatar
      target: Add return for se_cmd->transport_complete_callback · a6b0133c
      Nicholas Bellinger authored
      This patch adds a sense_reason_t return to ->transport_complete_callback(),
      and updates target_complete_ok_work() to invoke the call if necessary to
      transport_send_check_condition_and_sense() during the failure case.
      
      Also update xdreadwrite_callback() to use this return value.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      a6b0133c
    • Nicholas Bellinger's avatar
      scsi: Add CDB definition for COMPARE_AND_WRITE · 1c68cc16
      Nicholas Bellinger authored
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      1c68cc16
    • Dan Carpenter's avatar
      target/pscsi: remove an unneeded check · fdb4c1f3
      Dan Carpenter authored
      blk_get_request() just returns NULL on error, it doesn't return an
      ERR_PTR.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      fdb4c1f3
    • Nicholas Bellinger's avatar
      iscsi-target: Convert to per-cpu ida_alloc + ida_free command map · 988e3a85
      Nicholas Bellinger authored
      This patch changes iscsi-target to use transport_alloc_session_tags()
      pre-allocation logic for per-cpu session tag pooling with internal
      ida_alloc() + ida_free() calls based upon the saved se_cmd->map_tag id.
      
      This includes tag pool setup based upon per NodeACL queue_depth after
      locating se_node_acl in iscsi_target_locate_portal().
      
      Also update iscsit_allocate_cmd() and iscsit_release_cmd() to use
      percpu_ida_alloc() and percpu_ida_free() respectively.
      
      v5 changes;
        - Convert to percpu_ida.h include
      
      v2 changes:
        - Fix bug with SessionType=Discovery in iscsi_target_locate_portal()
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      988e3a85
    • Nicholas Bellinger's avatar
      iscsi/iser-target: Convert to command priv_size usage · d703ce2f
      Nicholas Bellinger authored
      This command converts iscsi/isert-target to use allocations based on
      iscsit_transport->priv_size within iscsit_allocate_cmd(), instead of
      using an embedded isert_cmd->iscsi_cmd.
      
      This includes removing iscsit_transport->alloc_cmd() usage, along
      with updating isert-target code to use iscsit_priv_cmd().
      
      Also, remove left-over iscsit_transport->release_cmd() usage for
      direct calls to iscsit_release_cmd(), and drop the now unused
      lio_cmd_cache and isert_cmd_cache.
      
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@daterainc.com>
      d703ce2f
    • Nicholas Bellinger's avatar
      vhost/scsi: Add pre-allocation for tv_cmd SGL + upages memory · 3aee26b4
      Nicholas Bellinger authored
      This patch adds support for pre-allocation of per tv_cmd descriptor
      scatterlist + user-space page pointer memory using se_sess->sess_cmd_map
      within tcm_vhost_make_nexus() code.
      
      This includes sanity checks within vhost_scsi_map_to_sgl()
      to reject I/O that exceeds these initial hardcoded values, and
      the necessary cleanup in tcm_vhost_make_nexus() failure path +
      tcm_vhost_drop_nexus().
      
      v3 changes:
        - Rebase to v3.11-rc5 code
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Reviewed-by: default avatarAsias He <asias@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3aee26b4
    • Nicholas Bellinger's avatar
      vhost/scsi: Convert to per-cpu ida_alloc + ida_free command map · 4824d3bf
      Nicholas Bellinger authored
      This patch changes vhost/scsi to use transport_init_session_tags()
      pre-allocation logic for per-cpu session tag pooling with internal
      ida_alloc() + ida_free() calls based upon the saved se_cmd->map_tag id.
      
      FIXME: Make transport_init_session_tags() number of tags setup
      configurable per vring client setting via configfs
      
      v5 changes:
       - Convert to percpu_ida.h include
      
      v3 changes:
       - Update to percpu-ida usage
       - Rebase to v3.11-rc5 code
      
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      4824d3bf
    • Nicholas Bellinger's avatar
      target: Add transport_init_session_tags using per-cpu ida · c0add7fd
      Nicholas Bellinger authored
      This patch adds lib/idr.c based transport_init_session_tags() logic
      that allows fabric drivers to setup a per-cpu se_sess->sess_tag_pool
      and associated se_sess->sess_cmd_map for basic tagged pre-allocation
      of fabric descriptor sized memory.
      
      v5 changes:
        - Convert to percpu_ida.h include
      
      v4 changes:
        - Add transport_alloc_session_tags() for fabrics that need early
          transport_init_session()
      
      v3 changes:
        - Update to percpu-ida usage
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: Asias He <asias@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      c0add7fd
    • Kent Overstreet's avatar
      idr: Percpu ida · 798ab48e
      Kent Overstreet authored
      Percpu frontend for allocating ids. With percpu allocation (that works),
      it's impossible to guarantee it will always be possible to allocate all
      nr_tags - typically, some will be stuck on a remote percpu freelist
      where the current job can't get to them.
      
      We do guarantee that it will always be possible to allocate at least
      (nr_tags / 2) tags - this is done by keeping track of which and how many
      cpus have tags on their percpu freelists. On allocation failure if
      enough cpus have tags that there could potentially be (nr_tags / 2) tags
      stuck on remote percpu freelists, we then pick a remote cpu at random to
      steal from.
      
      Note that there's no cpu hotplug notifier - we don't care, because
      steal_tags() will eventually get the down cpu's tags. We _could_ satisfy
      more allocations if we had a notifier - but we'll still meet our
      guarantees and it's absolutely not a correctness issue, so I don't think
      it's worth the extra code.
      
      From akpm:
      
          "It looks OK to me (that's as close as I get to an ack :))
      
      v6 changes:
        - Add #include <linux/cpumask.h> to include/linux/percpu_ida.h to
          make alpha/arc builds happy (Fengguang)
        - Move second (cpu >= nr_cpu_ids) check inside of first check scope
          in steal_tags() (akpm + nab)
      
      v5 changes:
        - Change percpu_ida->cpus_have_tags to cpumask_t (kmo + akpm)
        - Add comment for percpu_ida_cpu->lock + ->nr_free (kmo + akpm)
        - Convert steal_tags() to use cpumask_weight() + cpumask_next() +
          cpumask_first() + cpumask_clear_cpu() (kmo + akpm)
        - Add comment for alloc_global_tags() (kmo + akpm)
        - Convert percpu_ida_alloc() to use cpumask_set_cpu() (kmo + akpm)
        - Convert percpu_ida_free() to use cpumask_set_cpu() (kmo + akpm)
        - Drop percpu_ida->cpus_have_tags allocation in percpu_ida_init()
          (kmo + akpm)
        - Drop percpu_ida->cpus_have_tags kfree in percpu_ida_destroy()
          (kmo + akpm)
        - Add comment for percpu_ida_alloc @ gfp (kmo + akpm)
        - Move to percpu_ida.c + percpu_ida.h (kmo + akpm + nab)
      
      v4 changes:
      
        - Fix tags.c reference in percpu_ida_init (akpm)
      Signed-off-by: default avatarKent Overstreet <kmo@daterainc.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      798ab48e
    • Nicholas Bellinger's avatar
      iser-target: Updates for login negotiation multi-plexing support · 6faaa85f
      Nicholas Bellinger authored
      This patch updates iser-target code to support login negotiation
      multi-plexing.  This includes only using isert_conn->conn_login_comp
      for the first login request PDU, pushing the subsequent processing
      to iscsi_conn->login_work -> iscsi_target_do_login_rx(), and turning
      isert_get_login_rx() into a NOP.
      
      v3 changes:
         - Drop unnecessary LOGIN_FLAGS_READ_ACTIVE bit set in
           isert_rx_login_req()
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      6faaa85f
    • Nicholas Bellinger's avatar
      iscsi-target: Remove left-over iscsi_target_do_login_io · ea3a179a
      Nicholas Bellinger authored
      There is no need for iscsi_target_do_login_io() anymore in modern code,
      so go ahead and call iscsi_target_do_tx_login_io() directly within
      iscsi_target_do_login().
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      ea3a179a
    • Nicholas Bellinger's avatar
      iscsi-target: Add sk->sk_state_change to cleanup after TCP failure · bb048357
      Nicholas Bellinger authored
      This patch adds a sock->sk_state_change() -> iscsi_target_sk_state_change()
      callback in order to handle transient TCP failures during the login process,
      where sock->sk_data_ready() -> iscsi_target_sk_data_ready() may not be
      called to release connection resources, and relinquish tpg->np_login_lock
      via iscsit_deaccess_np()
      
      It performs the sk->sk_state check using iscsi_target_sk_state_check() to
      look for TCP_CLOSE_WAIT + TCP_CLOSE, and invokes schedule_delayed_work() ->
      iscsi_target_do_cleanup() to perform the remaining cleanup from process
      context.
      
      It adds an explicit sk_state_check to iscsi_target_do_login() in order
      to determine a state failure when iscsi_target_sk_state_change() may
      not be able to proceed before LOGIN_FLAGS_READY=1 is set.
      
      Also use sk->sk_sndtimeo -> sk->sk_rcvtimeo settings during login to
      iscsi_target_set_sock_callbacks(), and revert back post login to use
      MAX_SCHEDULE_TIMEOUT in iscsi_target_restore_sock_callbacks().
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      bb048357
    • Nicholas Bellinger's avatar
      iscsi-target: Add login negotiation multi-plexing support · d381a801
      Nicholas Bellinger authored
      This patch adds support for login negotiation multi-plexing in
      iscsi-target code.
      
      This involves handling the first login request PDU + payload and
      login response PDU + payload within __iscsi_target_login_thread()
      process context, and then changing struct sock->sk_data_ready()
      so that all subsequent exchanges are handled by workqueue process
      context, to allow other incoming login requests to be received
      in parallel by __iscsi_target_login_thread().
      
      Upon login negotiation completion (or failure), ->sk_data_ready()
      is replaced with the original kernel sockets handler saved in
      iscsi_conn->orig_data_ready.
      
      v3 changes:
        - Convert iscsi_target_sk_data_ready() lock access to
          write[lock,unlock]_bh()
        - Only clear LOGIN_FLAGS_READ_ACTIVE when iscsi_target_do_login()
          returns zero
        - Add LOGIN_FLAGS_READY + LOGIN_FLAGS_CLOSED bit checks to
          iscsi_target_sk_data_ready()
        - Make INIT_DELAYED_WORK() + iscsi_target_set_sock_callbacks() setup
          happen earlier by moving from iscsi_target_start_negotiation() into
          iscsi_target_locate_portal()
        - Set LOGIN_FLAGS_READY bit in iscsi_target_start_negotiation()
          after iscsi_target_do_login() returns zero.
      
      v2 changes:
        - Add login_timer in iscsi_target_do_login_rx() to avoid
          possible endless sleep with MSG_WAITALL for traditional
          iscsi-target in certain network configurations.
        - Convert lprintk() -> pr_debug()
        - Remove forward declarations of iscsi_target_set_sock_callbacks(),
          iscsi_target_restore_sock_callbacks() and iscsi_target_sk_data_ready()
        - Make iscsi_target_set_sock_callbacks + iscsi_target_restore_sock_callbacks()
          static (Fengguang)
        - Make iscsi_target_do_login_rx() safe for iser-target w/o conn->sock
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      d381a801
    • Nicholas Bellinger's avatar
      iscsi-target: Prepare login code for multi-plexing support · a91eb7d9
      Nicholas Bellinger authored
      This patch prepares the iscsi-target login code for multi-plexing
      support.  This includes:
      
       - Adding iscsi_tpg_np->tpg_np_kref + iscsit_login_kref_put() for
         handling callback of iscsi_tpg_np->tpg_np_comp
       - Adding kref_put() in iscsit_deaccess_np()
       - Adding kref_put() and wait_for_completion() in
         iscsit_reset_np_thread()
       - Refactor login failure path release logic into
         iscsi_target_login_sess_out()
       - Update __iscsi_target_login_thread() to handle
         iscsi_post_login_handler() asynchronous completion
       - Add shutdown parameter for iscsit_clear_tpg_np_login_thread*()
      
      v3 changes:
       - Convert iscsi_portal_group->np_login_lock to ->np_login_sem
       - Add LOGIN_FLAGS definitions
      
      v2 changes:
       - Remove duplicate call to iscsi_post_login_handler() in
         __iscsi_target_login_thread()
       - Drop unused iscsi_np->np_login_tpg
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      a91eb7d9
  3. 13 Aug, 2013 3 commits
    • Chris Leech's avatar
      iscsi-target: ST response on IN6ADDR_ANY socket · dfecf611
      Chris Leech authored
      Odd little issue, found that if you create an IPv6 portal bound to the
      IN6ADDR_ANY wildcard address it will accept IPv4 connections (as long as
      bindv6only isn't set globally) but respond to SendTargets requests with
      an IPv4-mapped IPv6 address.
      
      Example over loopback:
      
       In targetcli create a wildcard IPv6 portal
         /iscsi/iqn.../portals/> create ::
       Which should create a portal [::]:3260
      
       Initiate SendTargets discovery to the portal using an IPv4 address
         # iscsiadm -m discovery -t st -p 127.0.0.1
       The response formats TargetAddress as [::ffff:127.0.0.1]:3260,1
      
      This still works and uses v4 on the network between two v6 sockets, but
      only if the initiator supports IPv6 with v4-mapped addresses.
      
      This change detects v4-mapped address on v6 sockets for the wildcard
      case, and instead formats the TargetAddress response as an IPv4 address.
      
      In order to not further complicate iscsit_build_sendtargets_response,
      I've actually simplified it by moving the bracket wrapping of IPv6
      address into iscsit_accept_np where local_ip and login_ip strings are
      set.  That also simplifies iscsi_stat_tgt_attr_show_attr_fail_intr_addr.
      
      Side effect of the string format change is that
      lio_target_nacl_show_info will now print login_ip bracket wrapped for
      IPv6 connections, as will a few debug prints.
      Signed-off-by: default avatarChris Leech <cleech@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      dfecf611
    • Andy Grover's avatar
      target/qla2xxx: Make demo_mode_login_only modifiable · de04a8aa
      Andy Grover authored
      Changing this attribute to 0 will mean that all initiators that login
      to the target while the target has generate_node_acls=1 will see all
      TPG LUNs, which may be the desired behavior in some cases.
      
      (nab: Apply patch without macro changes)
      Reported-by: default avatarCraig Watson <craig.watson@vanguard-rugged.com>
      Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      de04a8aa
    • Jingoo Han's avatar
      target: replace strict_strto*() with kstrto*() · 57103d7f
      Jingoo Han authored
      The usage of strict_strtoul() and strict_strtoull() is not preferred,
      because strict_strtoul() and strict_strtoull() are obsolete. Thus,
      kstrtoul() and kstrtoull() should be used.
      
      v2: Fix incorrect return in ft_add_tpg (Fengguang)
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      57103d7f
  4. 12 Aug, 2013 1 commit
  5. 11 Aug, 2013 4 commits
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · e5d081f4
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is three bug fixes: An fnic warning caused by sleeping under a
        lock, a major regression with our updated WRITE SAME/UNMAP logic which
        caused tons of USB devices (and one RAID card) to cease to function
        and a megaraid_sas firmware initialisation problem which causes kdump
        failures"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set
        [SCSI] fnic: BUG: sleeping function called from invalid context during probe
        [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel
      e5d081f4
    • Linus Torvalds's avatar
      Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc · 77f63b4d
      Linus Torvalds authored
      Pull powerpc fixes from Ben Herrenschmidt:
       "This includes small series from Michael Neuling to fix a couple of
        nasty remaining problems with the new Power8 support, also targeted at
        stable 3.10, without which some new userspace accessible registers
        aren't properly context switched, and in some case, can be clobbered
        by the user of transactional memory.
      
        Along with that, a few slightly more minor things, such as a missing
        Kconfig option to enable handling of denorm exceptions when not
        running under a hypervisor (or userspace will randomly crash when
        hitting denorms with the vector unit), some nasty bugs in the new
        pstore oops code, and other simple bug fixes worth having in now.
      
        Note: I picked up the two powerpc KVM fixes as Alex Graf asked me to
        handle KVM bits while he is on vacation.  However I'll let him decide
        whether they should go to -stable or not when he is back"
      
      * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
        powerpc/tm: Fix context switching TAR, PPR and DSCR SPRs
        powerpc: Save the TAR register earlier
        powerpc: Fix context switch DSCR on POWER8
        powerpc: Rework setting up H/FSCR bit definitions
        powerpc: Fix hypervisor facility unavaliable vector number
        powerpc/kvm/book3s_pr: Return appropriate error when allocation fails
        powerpc/kvm: Add signed type cast for comparation
        powerpc/eeh: Add missing procfs entry for PowerNV
        powerpc/pseries: Add backward compatibilty to read old kernel oops-log
        powerpc/pseries: Fix buffer overflow when reading from pstore
        powerpc: On POWERNV enable PPC_DENORMALISATION by default
      77f63b4d
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 30b229bd
      Linus Torvalds authored
      Pull s390 kvm fixes from Paolo Bonzini:
       "Two fixes for s390"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: s390: fix pfmf non-quiescing control handling
        KVM: s390: move kvm_guest_enter,exit closer to sie
      30b229bd
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 9e6bdaaa
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Some driver bugfixes for the I2C subsystem"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: mv64xxx: Document the newly introduced allwinner compatible
        i2c: Fix Kontron PLD prescaler calculation
        i2c: i2c-mxs: Use DMA mode even for small transfers
      9e6bdaaa
  6. 10 Aug, 2013 6 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · d92581fc
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "These are assorted fixes, mostly from Josef nailing down xfstests
        runs.  Zach also has a long standing fix for problems with readdir
        wrapping f_pos (or ctx->pos)
      
        These patches were spread out over different bases, so I rebased
        things on top of rc4 and retested overnight"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        btrfs: don't loop on large offsets in readdir
        Btrfs: check to see if root_list is empty before adding it to dead roots
        Btrfs: release both paths before logging dir/changed extents
        Btrfs: allow splitting of hole em's when dropping extent cache
        Btrfs: make sure the backref walker catches all refs to our extent
        Btrfs: fix backref walking when we hit a compressed extent
        Btrfs: do not offset physical if we're compressed
        Btrfs: fix extent buffer leak after backref walking
        Btrfs: fix a bug of snapshot-aware defrag to make it work on partial extents
        btrfs: fix file truncation if FALLOC_FL_KEEP_SIZE is specified
      d92581fc
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-3.11-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · b8ea0d06
      Linus Torvalds authored
      Pull NFS client bugfixes from Trond Myklebust:
      
       - Stable patch for lockd to fix Oopses due to inappropriate calls to
         utsname()->nodename
      
       - Stable patches for sunrpc to fix Oopses on shutdown when using
         AF_LOCAL sockets with rpcbind
      
       - Fix memory leak and error checking issues in nfs4_proc_lookup_mountpoint
      
       - Fix a regression with the sync mount option failing to work for nfs4
         mounts
      
       - Fix a writeback performance issue when doing cache invalidation
      
       - Remove an incorrect call to nfs_setsecurity in nfs_fhget
      
      * tag 'nfs-for-3.11-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        NFSv4: Fix up nfs4_proc_lookup_mountpoint
        NFS: Remove unnecessary call to nfs_setsecurity in nfs_fhget()
        NFSv4: Fix the sync mount option for nfs4 mounts
        NFS: Fix writeback performance issue on cache invalidation
        SUNRPC: If the rpcbind channel is disconnected, fail the call to unregister
        SUNRPC: Don't auto-disconnect from the local rpcbind socket
        LOCKD: Don't call utsname()->nodename from nlmclnt_setlockargs
      b8ea0d06
    • Linus Torvalds's avatar
      Merge branch 'for-3.11' of git://linux-nfs.org/~bfields/linux · 022e5d09
      Linus Torvalds authored
      Pull nfsd fixes from Bruce Fields:
       "Some fixes for a 4.1 feature that in retrospect probably should have
        waited for 3.12....  But it appears to be working now"
      
      * 'for-3.11' of git://linux-nfs.org/~bfields/linux:
        nfsd: Fix SP4_MACH_CRED negotiation in EXCHANGE_ID
        nfsd4: Fix MACH_CRED NULL dereference
      022e5d09
    • Linus Torvalds's avatar
      Merge tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 1e24f76e
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A couple of USB-audio fixes that should also go to stable kernels"
      
      * tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: usb-audio: do not trust too-big wMaxPacketSize values
        ALSA: 6fire: fix DMA issues with URB transfer_buffer usage
      1e24f76e
    • Linus Torvalds's avatar
      Merge tag 'staging-3.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 8ae3f1d0
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Here are 3 small fixes for staging/IIO drivers for 3.11-rc5.  Nothing
        huge, two IIO driver fixes, and a zcache fix.  All of these have been
        in linux-next for a while"
      
      * tag 'staging-3.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: zcache: fix "zcache=" kernel parameter
        iio: ti_am335x_adc: Fix wrong samples received on 1st read
        iio:trigger: Fix use_count race condition
      8ae3f1d0
    • Linus Torvalds's avatar
      Merge tag 'usb-3.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · e6e8ac44
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are 3 small USB fixes for 3.11-rc5.
      
        One is a fix that the ChromeOS developers ran into on some Intel
        hardware, one is a build fix, and the last is a MAINTAINERS update to
        help people figure out where to send USB network driver patches.
      
        All of these have been in linux-next for a while"
      
      * tag 'usb-3.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        MAINTAINERS: Add separate section for USB NETWORKING DRIVERS
        usb: xhci: add missing dma-mapping.h includes
        usb: core: don't try to reset_device() a port that got just disconnected
      e6e8ac44
  7. 09 Aug, 2013 1 commit
    • Zach Brown's avatar
      btrfs: don't loop on large offsets in readdir · db62efbb
      Zach Brown authored
      When btrfs readdir() hits the last entry it sets the readdir offset to a
      huge value to stop buggy apps from breaking when the same name is
      returned by readdir() with concurrent rename()s.
      
      But unconditionally setting the offset to INT_MAX causes readdir() to
      loop returning any entries with offsets past INT_MAX.  It only takes a
      few hours of constant file creation and removal to create entries past
      INT_MAX.
      
      So let's set the huge offset to LLONG_MAX if the last entry has already
      overflowed 32bit loff_t.   Without large offsets behaviour is identical.
      With large offsets 64bit apps will work and 32bit apps will be no more
      broken than they currently are if they see large offsets.
      Signed-off-by: default avatarZach Brown <zab@redhat.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
      db62efbb