Commit Graph

2797 Commits

Author SHA1 Message Date
Bart Van Assche
1f17f29658 qla2x00t: Remove a superfluous check from q2t_remove_target() (merge r4312 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4634 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-28 14:17:32 +00:00
Bart Van Assche
47f66b3bad qla2x00t: Correct q2t_abort_task() (merge r4457 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4633 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-28 14:07:13 +00:00
Bart Van Assche
caf9e827e9 qla2x00t: Eliminate double req_q_cnt checks when there is enough headroom (merge r4135 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4632 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-28 14:02:31 +00:00
Bart Van Assche
e0e724f022 qla2x00t: q2t_pci_map_calc_cnt() cleanup and microoptimization (merge r4273 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4631 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-28 14:00:16 +00:00
Bart Van Assche
2e53594570 qla2x00t: Remove a superfluous cast (merge r4487 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4630 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-28 13:57:51 +00:00
Bart Van Assche
77d2f1aaf0 qla2x00t: Keep smatch happy (merge r4486 from trunk)
Smatch reports two warnings on the qla2x00t code:
* sess->local being tested while sess can be NULL.
* The code after the out_unreg_target2x label is only necessary in the procfs build.


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4629 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-28 13:41:44 +00:00
Bart Van Assche
f781ba691a Fix incorrect error handling (merge r4494 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4628 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-25 08:48:29 +00:00
Bart Van Assche
0544c28695 scst_sysfs: Fix a help text (see also trunk r4483)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4627 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-25 08:37:37 +00:00
Bart Van Assche
391ae47690 Increment session refcount in scst_pre_rx_mgmt_cmd() instead of scst_post_rx_mgmt_cmd() (merge r4423 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4626 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-25 08:12:26 +00:00
Bart Van Assche
7ba44bbc51 ib_srpt: Avoid that module unloading races with closing sessions (merge r4446 from trunk)
Fixed issue:
    
BUG: unable to handle kernel paging request at ffffffffa04dc479
IP: [<ffffffffa04dc479>] 0xffffffffa04dc478
Oops: 0010 [#1] SMP
Pid: 29313, comm: srpt_mlx4_0-2 Tainted: G           O 3.6.0-rc1-debug+ #1
Process srpt_mlx4_0-2
Call Trace:
 [<ffffffff8106254e>] ? kthread+0xae/0xc0
 [<ffffffff81418464>] ? kernel_thread_helper+0x4/0x10
 [<ffffffff8140f080>] ? _raw_spin_unlock_irq+0x30/0x50
 [<ffffffff810983ad>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff8140f359>] ? retint_restore_args+0xe/0xe
 [<ffffffff810624a0>] ? __init_kthread_worker+0x70/0x70
 [<ffffffff81418460>] ? gs_change+0xb/0xb
Code:  Bad RIP value.



git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4625 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-23 13:44:26 +00:00
Bart Van Assche
a646aba835 scst: Don't suspend activity during removal of a SCSI device (merge r4399 from trunk)
SCST allows SCSI pass-through to SCSI devices registered with the SCSI
initiator core. SCST I/O activity has to be suspended before a LUN
that corresponds to such a SCSI device can be removed safely. Do not
suspend I/O when a SCSI device is being removed that has not been
exported as an SCST LUN such that removal of such devices does not
slow down I/O.



git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4624 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-23 09:02:10 +00:00
Bart Van Assche
e7ccb78272 RHEL 5.6 build fix (merge r3408 from trunk).
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4599 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 19:37:37 +00:00
Bart Van Assche
4c2c2c10c1 scst: Build fix for r4573
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4598 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 15:57:48 +00:00
Bart Van Assche
780f46cef4 scstadmin: Only enable /etc/init.d/scst in runlevels 3 and 5 since networking is not available in runlevels 2 or 4 (merge r4152 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4597 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 15:12:31 +00:00
Bart Van Assche
c9f05992d3 scstadmin: Suggest the user to use systemctl (systemd) instead of the LSB installation script if available (merge r4153 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4596 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 15:08:58 +00:00
Bart Van Assche
737aa4e5c7 scstadmin: Make /etc/init.d/scst status work on RHEL 6.2 (merge r4163 from trunk).
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4595 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:55:13 +00:00
Bart Van Assche
2ab470f796 scstadmin, FC (NPIV): Make -write_config save the "node_name" and "parent_host" attributes (merge r4306 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4594 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:53:17 +00:00
Bart Van Assche
7cc3997fd5 scstadmin: Make -write_config save the scst_local session name (merge r4304 and r4305 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4593 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:49:46 +00:00
Bart Van Assche
bc6da2b006 scstadmin: Allow hash signs to be escaped (merge r4391 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4592 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:48:14 +00:00
Bart Van Assche
ff41d8c887 scstadmin: Make _syswrite() translate EBUSY into "writing failed" (merge r4400 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4591 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:45:49 +00:00
Bart Van Assche
e991bd4845 scstadmin: Use $(DESTDIR) when uninstalling SCST 2.x startup scripts (merge r4536 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4590 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:42:15 +00:00
Bart Van Assche
9430abe77c scstadmin: Create /etc/default if it does not yet exist (merge r4537 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4589 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:40:33 +00:00
Bart Van Assche
d96929b17d qla2x00t: Relax the severity level of a diagnostic message (r4497)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4588 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:39:06 +00:00
Bart Van Assche
e562179bab scstadmin: Handle -EAGAIN when reading from sysfs (merge r4498 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4587 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:37:21 +00:00
Bart Van Assche
c758bd4ebd scst: Fix a comment in scst/include/scst.h (merge r4503 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4586 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:33:51 +00:00
Bart Van Assche
b5325996cf qla2x00t: Display a clear error message if the kernel is too old (merge r4510 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4585 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:32:40 +00:00
Bart Van Assche
c9b55878ad qla2x00t: Send back proper task management response code (merge r4529 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4584 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:30:10 +00:00
Bart Van Assche
3e8f92d470 SCST README: Document the LUN addressing method (merge r4527 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4583 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:28:21 +00:00
Bart Van Assche
1b3287f042 scst_vdisk/procfs: Fix a copy/paste error (merge r4528 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4582 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:26:40 +00:00
Bart Van Assche
917b56374d iscsi-scstd: Fix code for replacing an attribute value (merge r4545 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4581 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:15:23 +00:00
Bart Van Assche
5b106ecf63 scst, procfs: Fix a potential out-of-range array access (merge r4555 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4580 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:12:45 +00:00
Bart Van Assche
48f5401f55 iscsi-scstd: Add missing list_del() in the session creation error path (merge r4569 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4579 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:11:04 +00:00
Bart Van Assche
24ca2b8076 nightly build: Merge up to and including r4569 from trunk
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4578 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:05:18 +00:00
Bart Van Assche
b8dcba41c7 scripts: Merge up to and including r4569 from trunk
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4577 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 14:03:32 +00:00
Bart Van Assche
f6afe9f3ff Update for 3.6 kernels (merge r4538 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4576 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:59:50 +00:00
Bart Van Assche
287def7141 scst_local: Avoid deadlock during module removal with kernel 3.6 (merge r4566 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4575 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:56:12 +00:00
Bart Van Assche
18196379a8 Update for 3.6 kernels (merge r4538 and r4539 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4574 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:54:51 +00:00
Bart Van Assche
043b678ef4 scst_vdisk: Build fix for kernel 3.5.0 and later. Unfortunately this means (for now) no thin provisioning support on the 2.2.x branch with kernel 3.5.0 or later. Such support is available on the SCST trunk though.
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4573 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:52:27 +00:00
Bart Van Assche
4efdfaf368 nightly build: Add kernel 3.5 build infrastructure (merge r4460 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4572 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:29:38 +00:00
Bart Van Assche
2ae9bb3655 Update for 3.5 kernel (merge r4458 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4571 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:27:32 +00:00
Bart Van Assche
2d2df09c5a scst: Move ioctx manipulation code (merge r4254 from trunk)
Move the code for obtaining and releasing an I/O context out of
scst_process_active_cmd() in order to improve source code
readability.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4570 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-03 13:22:29 +00:00
Bart Van Assche
a67be01951 scst: Fix race between closing a session and adding a LUN
Fixes this call stack (kernel 3.2.15):
WARNING: at lib/kref.c:34 kref_get+0x2d/0x30()
Hardware name: X8ST3
Modules linked in: scst_vdisk ib_srpt scst
Pid: 2159, comm: scst_uid Tainted: G W 3.2.15-07+ #2
Call Trace:
[<ffffffff81059cba>] warn_slowpath_common+0x7a/0xb0
[<ffffffff81059d05>] warn_slowpath_null+0x15/0x20
[<ffffffff812a5d7d>] kref_get+0x2d/0x30
[<ffffffff812a46ba>] kobject_get+0x1a/0x30
[<ffffffff812a471b>] kobject_add_internal+0x4b/0x240
[<ffffffff812a4bf3>] kobject_init_and_add+0x63/0x90
[<ffffffffa001082b>] ? scst_tgt_dev_setup_threads+0xab/0x310 [scst]
[<ffffffffa001a722>] scst_tgt_dev_sysfs_create+0x42/0x80 [scst]
[<ffffffffa0010e8c>] scst_alloc_add_tgt_dev+0x31c/0x4b0 [scst]
[<ffffffffa001362e>] scst_acg_add_lun+0xfe/0x230 [scst]
[<ffffffff812b4511>] ? _kstrtoull+0x31/0x90
[<ffffffffa001777c>] scst_luns_mgmt_store_work_fn+0x29c/0x6b0 [scst]
[<ffffffffa0019634>] sysfs_work_thread_fn+0xd4/0x2e0 [scst]
[<ffffffff8107a020>] ? wake_up_bit+0x40/0x40
[<ffffffffa0019560>] ? scst_tgt_cpu_mask_show+0x20/0x20 [scst]
[<ffffffff81079ab6>] kthread+0x96/0xa0
[<ffffffff8163d7b4>] kernel_thread_helper+0x4/0x10
[<ffffffff81079a20>] ? kthread_worker_fn+0x190/0x190
[<ffffffff8163d7b0>] ? gs_change+0x13/0x13

Reported-by: Sebastian Riemer <sebastian.riemer@profitbricks.com>

(Merge r4452:4456 and r4464 from trunk).


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4506 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-09-07 10:03:02 +00:00
Bart Van Assche
23390aca64 scst: sysfs session creation error path fix
The attached patch prevents that a kernel oops is triggered if something
fails when adding a session to sysfs.

(Merge r4388 from trunk)


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4451 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-07 13:01:19 +00:00
Bart Van Assche
fc8b2d910b scripts/rebuild-rhel-kernel-rpm: Add RHEL 6.3 support (merge from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4444 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 16:54:53 +00:00
Bart Van Assche
c4c2555dc9 qla2x00t: Port to RHEL 6.1/6.2/6.3 (merge r4303 and r4419 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4442 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 16:46:58 +00:00
Bart Van Assche
5f7668e80a Merge directories scripts and nightly from trunk
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4441 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 16:28:23 +00:00
Bart Van Assche
59294a39f8 qla2x00t: Make out-of-tree build possible (backport r3910 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4440 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 16:26:28 +00:00
Bart Van Assche
4f57176241 qla2x00t: IRQ handlers can be called without IRQs disabled and IRQF_DISABLED
doesn't work with IRQF_SHARED on modern kernels (merge r4100 from trunk).


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4439 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 14:28:39 +00:00
Bart Van Assche
6ecb9f2aff qla2x00t: Fix a deadlock crash
The symptom of the crash is that one finds the system deadlocked
spinning on scsi_qla_host_t.hardware_lock in qla2x00_enable_tgt_mode
with a stack something like this:

crash> bt
PID: 6155   TASK: ffff88006e4bc3c0  CPU: 1   COMMAND: "scst_uid"
 #0 [ffff88007b915b28] machine_kexec at ffffffff8103163b
 #1 [ffff88007b915b88] crash_kexec at ffffffff810b8e52
 #2 [ffff88007b915c58] panic at ffffffff814ed0ab
 #3 [ffff88007b915cd8] spin_bug at ffffffff8127cd46
 #4 [ffff88007b915d18] _raw_spin_lock at ffffffff8127d015
 #5 [ffff88007b915d68] _spin_lock_irqsave at ffffffff814f02e4
 #6 [ffff88007b915d88] qla2x00_enable_tgt_mode at ffffffffa047b672 [qla2xxx]
 #7 [ffff88007b915db8] q2t_host_action at ffffffffa06db6a6 [qla2x00tgt]
 #8 [ffff88007b915df8] q2t_enable_tgt at ffffffffa06db6ea [qla2x00tgt]
 #9 [ffff88007b915e18] scst_process_tgt_enable_store at ffffffffa04f102e [scst]
#10 [ffff88007b915e48] scst_tgt_enable_store_work_fn at ffffffffa04f1176 [scst]
#11 [ffff88007b915e58] scst_process_sysfs_works at ffffffffa04e8bbe [scst]
#12 [ffff88007b915e78] sysfs_work_thread_fn at ffffffffa04e8db5 [scst]
#13 [ffff88007b915ed8] kthread at ffffffff8108f976
#14 [ffff88007b915f48] kernel_thread at ffffffff8100c20a

I was pulling my hair out on this one, because with the spinlock
debugging (enhanced to capture the PID along with the task pointer), I
figured out that the task (and process) that originally locked the lock
was gone!  It got really confusing when I added more spinlock debug code
to the kernel to detect locks held in the task switching and
task/process termination paths -- and didn't catch anything terminating
with locks held!

I finally tracked the problem down to two things:

1.  When qla24xx_create_vhost creates a new virtual scsi_qla_host_t it
does it by copying the physical (aka parent) scsi_qla_host_t.  Under the
right unlucky conditions, this can happen with the hardware_lock held
(the spinlock is embedded in the structure).

2.  The code should only be locking the hardware_lock of the physical
scsi_qla_host_t, because the lock is associated with the hardware.
Unfortunately, quite a few places are not using to_qla_parent to make
sure they lock the correct lock.  One of those places is
qla2x00_enable_tgt_mode.  Along with the deadlock, this has the
potential to leave the hardware and driver structures in unpredictable
states, because the lock isn't always providing serialization.

The fix entails two things:

1. Zeroing the lock after copying the scsi_qla_host_t structure:  This
won't stop the deadlock, but will enable the spinlock debug code to
easily catch anything that misbehaves and locks the wrong lock.  I also
initialized the other locks because they could have the same problem.  I
also initialized the list heads, because they could end up holding
dangling references.  I did not initialize all pointers, because there
are quite a few that point to read only data and are OK (and I didn't
have time to research all of them).

2.  Using to_qla_parent everywhere when locking and the scsi_qla_host_t
structure might be virtual.  This is a lot of changes, but they are the
same thing over and over again.

I did not make an effort to look for scalar or pointer fields that are
being picked from the wrong structure.  That's getting to be as much
pain as merging up to the latest QLogic driver (which would have gotten
rid of this problem).

From "Robinson, Herbie" <Herbie.Robinson@stratus.com>

(Merge r4420 from trunk)


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4438 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 14:23:58 +00:00
Bart Van Assche
d7b35cc58f qla2x00t: Add a comment (merge r4418 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4437 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-29 14:21:14 +00:00