Commit Graph

483 Commits

Author SHA1 Message Date
Bart Van Assche
59f48c1f33 ib_srpt: Avoid that disabling a target triggers a race condition
Avoid that disabling a target triggers a race condition with
SRP relogin. At least in theory this race condition could result
in a kernel crash.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5268 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-02-06 14:17:49 +00:00
Vladislav Bolkhovitin
00851a7501 Merge of adding iSER web page and copyright updates from the iSER branch
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5241 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-28 05:17:26 +00:00
Bart Van Assche
08623d3115 ib_srpt: Clarify a log message
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5225 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-27 19:01:24 +00:00
Bart Van Assche
a0bc415649 ib_srpt, ib_srpt.h: Fix kernel-doc warnings
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5186 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-07 14:26:25 +00:00
Bart Van Assche
f239f4d071 ib_srpt: procfs build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5123 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-19 08:14:08 +00:00
Bart Van Assche
5475aa9a47 ib_srpt: Correct context passed to scst_rx_mgmt_fn_*()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5120 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-18 14:55:48 +00:00
Bart Van Assche
6d2efd72fd ib_srpt: Add per-target "device" attribute
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5119 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-18 13:06:55 +00:00
Bart Van Assche
107b228f15 ib_srpt: Move the srpt_close_session() source code
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5116 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-18 12:53:02 +00:00
Bart Van Assche
47c7997c11 ib_srpt: Log an info message instead of an error message if a target is not enabled
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5115 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-18 12:41:33 +00:00
Bart Van Assche
08f3caecaa ib_srpt: Log an info message instead of an error message if a target is not enabled
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5114 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-18 12:40:59 +00:00
Bart Van Assche
cdf784a6ad ib_srpt: Simplify the code for waking up the srpt thread after login
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5054 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-10-10 12:53:59 +00:00
Bart Van Assche
858d02e558 [PATCH] ib_srpt: Always set RSPVALID flag in task management replies
The SRP spec requires not only to set the RSPVALID flag and the RSP_CODE
field if a task management function failed but also if it succeeded. This
patch avoids that the SRP initiator interprets task managment functions
that succeeded as failed.

Reported-by: Jack Wang <jinpu.wang@profitbricks.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5002 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-09-27 13:40:58 +00:00
Bart Van Assche
47c84d3ec8 ib_srpt: Build fix for r4984
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4992 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-09-09 05:46:22 +00:00
Bart Van Assche
08bfd4c19a ib_srpt: Rework r4984 (skip Ethernet ports)
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4991 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-09-08 10:20:54 +00:00
Bart Van Assche
523e2b3e59 ib_srpt: Skip Ethernet ports
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4984 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-09-02 07:31:12 +00:00
Bart Van Assche
85e9255f37 ib_srpt: Add P_Key support
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4980 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-27 06:39:45 +00:00
Bart Van Assche
9642081700 ib_srpt: Clean up srpt_handle_send_comp()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4979 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-27 06:36:52 +00:00
Bart Van Assche
70017e3883 ib_srpt: Remove two statements that became superfluous from srpt_abort_cmd()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4978 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-27 06:35:39 +00:00
Bart Van Assche
8b0230b152 ib_srpt: Introduce srpt_init_tgt()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4925 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-07-29 07:08:14 +00:00
Vladislav Bolkhovitin
6e31fd8306 Relax and cleanup HARDWARE ERROR sense usage
HARDWARE ERROR sense is very strong considered be "internal failure", so
might lead to serios initiator side issues up to disconnect from device. In
many cases WRITE or READ ERROR sense can be used instead. All remaining
usages must be logged.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4911 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-07-04 02:46:49 +00:00
Vladislav Bolkhovitin
2093dd7561 Make it possible to forcibly close SRP and FC sessions via sysfs
That patch contains the following changes:
* Move the code for creating a "close_sess" sysfs attribute from iscsi-scst to
  the SCST core such that it becomes available for other target drivers. This
  does not change the functionality of iscsi-scst.
* Add code in ib_srpt and qla2x00t to allow a session to be forcibly closed from
  user space.

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




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4852 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-18 00:52:46 +00:00
Bart Van Assche
63bbba8b50 ib_srpt: Source code cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4846 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-04-28 19:48:50 +00:00
Bart Van Assche
c927e1dd73 ib_srpt: Fix another bug that was introduced in r4784
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4845 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-04-28 19:48:06 +00:00
Bart Van Assche
1a4aa10db8 ib_srpt: Fix a bug that was introduced in r4784
Reported by: Matteo Tescione <matteo@rmnet.it>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4844 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-04-27 19:05:22 +00:00
Bart Van Assche
210b5d466e ib_srpt: Restore the "connecting" channel state
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4827 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-28 15:17:13 +00:00
Bart Van Assche
0763baaad6 ib_srpt: Process cmd_wait_list immediately after QP RTS transition
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4826 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-27 15:32:31 +00:00
Bart Van Assche
546073cfb4 ib_srpt: Process cmd_wait_list after QP RTS transition
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4825 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-27 15:31:42 +00:00
Bart Van Assche
a6a71c8248 ib_srpt: Candidate fix for QLogic HCAs
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4824 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-27 15:29:47 +00:00
Vladislav Bolkhovitin
ef5fe3dcd0 Correct sg_next_inline() misuse.
Previously sg_next_inline() didn't check if this sg is last.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4822 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-27 01:12:02 +00:00
Bart Van Assche
9fe9158574 ib_srpt: Include state in unexpected command state messages
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4815 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-26 06:59:08 +00:00
Bart Van Assche
74eba54940 ib_srpt: Micro-optimize SCSI command processing
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4784 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-04 13:40:56 +00:00
Bart Van Assche
20b20c2769 ib_srpt: Minor source code cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4783 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-04 13:40:15 +00:00
Vladislav Bolkhovitin
10ca1d2f20 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4767 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-02-20 02:05:29 +00:00
Vladislav Bolkhovitin
8d32ad63a1 Performance micro-optimization: use sg_next_inline() instead of sg_next()
Now we have sg_next_inline(), so let's use it everywhere.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4761 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-02-16 04:03:58 +00:00
Vladislav Bolkhovitin
bd7c893f04 Multiple makefiles: autodetect SCST include directory
It is cumbersome to change SCST_INC_DIR and SCST_DIR in each Makefile
before and after a release. Hence modify the Makefiles such that these
paths are detected automatically.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4740 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-01-16 00:12:38 +00:00
Bart Van Assche
3c7920b48e ib_srpt: Defer reenabling interrupts until after completion processing finished
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4675 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-01-03 09:19:09 +00:00
Bart Van Assche
4963e2a4c9 ib_srpt: Avoid that max_compl_time_ms is zero due to an integer overflow
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4662 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-12-21 12:04:19 +00:00
Bart Van Assche
edadea8fd0 ib_srpt: RHEL 5.3 build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4603 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-05 08:53:35 +00:00
Bart Van Assche
9e1b02afa8 ib_srpt: Remove an unused variable
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4554 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-10-08 14:09:27 +00:00
Bart Van Assche
8801f5babf ib_srpt: Convert 'sizeof e' into 'sizeof(e)'
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4540 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-10-02 08:29:45 +00:00
Bart Van Assche
3d1468cfac ib_srpt: Convert two functions two single-exit style
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4516 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-09-13 08:15:23 +00:00
Vladislav Bolkhovitin
8ce28aaba2 Avoid that enabling a target too quickly triggers a crash
The sysfs attributes of a target can be accessed before scst_tgt.tgt_priv
has been set. Avoid that such an access triggers a crash.

Symptom:
BUG: unable to handle kernel NULL pointer dereference at 000000000000004c
IP: [<ffffffffa1345848>] iscsi_is_target_enabled+0x8/0x20 [iscsi_scst]
PGD 150a4c067 PUD 13cacb067 PMD 0
Oops: 0000 [#1] SMP
CPU 1
Modules linked in: zfs(P) iscsi_scst(O) scst_vdisk(O) scst(O) zcommon(P) znvpair(P) zavl(P) zunicode(P) spl(O) [last unloaded: zfs]
Pid: 3974, comm: scst_uid1864 Tainted: P           O 3.2.23-zfsiscsi-std-ipv6-64 #3 Supermicro X6DVA/X6DVA
RIP: 0010:[<ffffffffa1345848>]  [<ffffffffa1345848>] iscsi_is_target_enabled+0x8/0x20 [iscsi_scst]
RSP: 0018:ffff88015071ddc0  EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff880181fdaa00 RCX: ffff88012d41f380
RDX: ffff88015071c010 RSI: 0000000000000000 RDI: ffff880181fdaa00
RBP: ffff88015071ddc0 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: ffffffffa134a608
R13: 0000000000000000 R14: 0000000000000129 R15: ffffffffa134a4c0
FS:  0000000000000000(0000) GS:ffff88019fc80000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 000000000000004c CR3: 0000000151927000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process scst_uid1864 (pid: 3974, threadinfo ffff88015071c000, task ffff880194d57500)
Stack:
 ffff88015071de10 ffffffffa12ee89a 00000000fffffffc 01ff88015071de98
 ffff88015071de80 ffff8801932a48d8 00000000fffffffc ffff88015071de98
 ffff88015071de80 ffff880194d57500 ffff88015071de30 ffffffffa12f582e
Call Trace:
 [<ffffffffa12ee89a>] __scst_is_relative_target_port_id_unique+0x6a/0xc0 [scst]
 [<ffffffffa12f582e>] gen_relative_target_port_id+0x6e/0xd0 [scst]
 [<ffffffffa12fdb8a>] scst_tgt_enable_store_work_fn+0x3a/0xe0 [scst]
 [<ffffffffa12f9397>] sysfs_work_thread_fn+0xc7/0x2e0 [scst]
 [<ffffffffa12f92d0>] ? scst_tgtt_release+0x20/0x20 [scst]
 [<ffffffffa12f92d0>] ? scst_tgtt_release+0x20/0x20 [scst]
 [<ffffffff810b44f6>] kthread+0x96/0xa0
 [<ffffffff81b8ed74>] kernel_thread_helper+0x4/0x10
 [<ffffffff810b4460>] ? kthread_worker_fn+0x180/0x180
 [<ffffffff81b8ed70>] ? gs_change+0xb/0xb
Code: 42 c8 74 0f 39 78 48 75 ea c9 c3 0f 1f 84 00 00 00 00 00 31 c0 c9 c3 66 66 66 2e 0f 1f 84 00 00 00 00 00 48 8b 47 48 55 48 89 e5 <0f> b6 40 4c c9 83 e0 01 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00
RIP  [<ffffffffa1345848>] iscsi_is_target_enabled+0x8/0x20 [iscsi_scst]
 RSP <ffff88015071ddc0>
CR2: 000000000000004c
---[ end trace 6311d4069703be07 ]---

Reported-by: Etienne Dechamps <e-t172@akegroup.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org> with some modifications



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4515 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-09-12 22:13:43 +00:00
Bart Van Assche
36a77c3708 ib_srpt: Avoid that module unloading races with closing sessions
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/trunk@4446 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-04 08:36:57 +00:00
Vladislav Bolkhovitin
955113f493 Sense handling improvements
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4408 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-18 21:28:57 +00:00
Bart Van Assche
47b2487b94 ib_srpt: Fix a checkpatch complaint
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4363 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-06-19 07:26:24 +00:00
Bart Van Assche
f53d181d40 ib_srpt: Fix procfs build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4362 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-06-19 06:23:21 +00:00
Bart Van Assche
bef07c9d31 ib_srpt: Add one target per port support. Makes it possible to configure LUN
masking per IB HCA port instead of per HCA, just like what is possible with FC.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4354 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-06-18 12:10:53 +00:00
Bart Van Assche
178d0bd692 ib_srpt: Remove a superfluous comparison statement
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4353 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-06-18 11:27:02 +00:00
Bart Van Assche
065a1d7529 ib_srpt: Add a comment
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4315 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-05-23 08:24:05 +00:00
Bart Van Assche
907bc8222d ib_srpt: Make sure that a DREP is sent to the initiator if a DREQ is received while a session is being closed
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4313 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-05-23 07:32:02 +00:00