1. 24 10月, 2011 36 次提交
  2. 11 10月, 2011 1 次提交
  3. 16 9月, 2011 1 次提交
    • R
      target: Fix race between multiple invocations of target_qf_do_work() · bcac364a
      Roland Dreier 提交于
      When work is scheduled with schedule_work(), the work can end up
      running on multiple CPUs at the same time -- this happens if
      the work is already running on one CPU and schedule_work() is called
      on another CPU.  This leads to list corruption with target_qf_do_work(),
      which is roughly doing:
      
      	spin_lock(...);
      	list_for_each_entry_safe(...) {
      		list_del(...);
      		spin_unlock(...);
      
      		// do stuff
      
      		spin_lock(...);
      	}
      
      With multiple CPUs running this code, one CPU can end up deleting the
      list entry that the other CPU is about to work on.
      
      Fix this by splicing the list entries onto a local list and then
      operating on that in the work function.  This way, each invocation of
      target_qf_do_work() operates on its own local list and so multiple
      invocations don't corrupt each other's list.  This also avoids dropping
      and reacquiring the lock for each list entry.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      bcac364a
  4. 23 8月, 2011 2 次提交
    • R
      target: Make locking in transport_deregister_session() IRQ safe · e63a8e19
      Roland Dreier 提交于
      At least the tcm_qla2xxx fabric driver calls into transport_deregister_session()
      while holding an IRQ-disabled spinlock, so the inner locking needs to
      use spin_lock_irqsave() instead of spin_lock_bh().
      
      This fixes warnings seen with tcm_qla2xxx like:
      
          WARNING: at kernel/softirq.c:159 local_bh_enable_ip+0x98/0xb0()
          Call Trace:
           [<ffffffff8104e65f>] warn_slowpath_common+0x7f/0xc0
           [<ffffffff8104e6ba>] warn_slowpath_null+0x1a/0x20
           [<ffffffff81055368>] local_bh_enable_ip+0x98/0xb0
           [<ffffffff814d5284>] _raw_spin_unlock_bh+0x14/0x20
           [<ffffffffa027b7f6>] transport_deregister_session+0x96/0x180 [target_core_mod]
           [<ffffffffa00f7731>] tcm_qla2xxx_free_session+0xd1/0x170 [tcm_qla2xxx]
           [<ffffffffa01b9173>] qla_tgt_sess_put+0xc3/0x140 [qla2xxx]
           [<ffffffffa01bf40f>] qla_tgt_stop_phase1+0x8f/0x2c0 [qla2xxx]
           [<ffffffffa00f735e>] tcm_qla2xxx_tpg_store_enable+0x6e/0xd0 [tcm_qla2xxx]
           [<ffffffffa026ca29>] target_fabric_tpg_attr_store+0x39/0x40 [target_core_mod]
           [<ffffffffa00a575d>] configfs_write_file+0xbd/0x120 [configfs]
           [<ffffffff811464a6>] vfs_write+0xc6/0x180
           [<ffffffff811467c1>] sys_write+0x51/0x90
           [<ffffffff814dd382>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e63a8e19
    • 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