Commit Graph

202 Commits

Author SHA1 Message Date
Bart Van Assche
904b3c1eb3 iscsi-scst: Kernel 3.19 build fix
Change the data type of iscsi_conn.read_iov into struct kvec * and
switch from iscsi_conn.read_size to iscsi_conn.read_msg.count for
kernel version 3.19 and later. Cast the return type of
get_zeroed_page() to void * since with this patch the read_iov
data type depends on the kernel version. Remove the (void __force
__user *) casts when assigning to iov_base since for a kvec iov_base
is a kernel pointer instead of a user space pointer. Switch to
iov_iter_kvec() to initialize conn->read_msg.msg_iter.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-04-13 18:44:00 +02:00
Bart Van Assche
02c014bf90 iscsi-scst: Prepare for kernel 3.19
Rework the iSCSI target driver code such that it becomes easier
to port this code to kernel 3.19.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-04-13 18:44:00 +02:00
Bart Van Assche
e860c56bcd iscsi-scst: Suppress put_page_callback patch warnings
The put_page_callback patch only improves performance on single-socket
systems but not on systems with multiple CPU sockets. Hence do not
print a warning if the put_page_callback patch has not been applied.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-04-13 18:44:00 +02:00
Vladislav Bolkhovitin
5cc7555cd9 iscsi-scst: Rework sparse annotations
Do not declare kernel pointers as __user but instead cast these to
__user just before assigning these to iov_base.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6156 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-03-26 00:33:45 +00:00
Vladislav Bolkhovitin
fe38e4acb2 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-03-19 00:01:03 +00:00
Vladislav Bolkhovitin
4ac6d7a26d [PATCH] scst: Drop detect() method
There is no need for a detect() method - code that is present in such
a method can be moved to module_init(). Hence declare this method
obsolete. Leave the detect pointer member in the target template for
now for out-of-tree SCST drivers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>

with some improvements



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6113 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-02-21 04:32:36 +00:00
Bart Van Assche
9707f85c0b Fix kernel 3.17 checkpatch warnings about 'long long unsigned'
Avoid that checkpatch reports the following warning:

WARNING: type 'long long unsigned' should be specified in 'unsigned long long' order.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-11-26 08:16:44 +00:00
Bart Van Assche
23bfab0626 iscsi-scst: Make iscsi_thread_pool locking more fine-grained
Protect iscsi_thread_pool.threads_list via tp_mutex instead of
scst_mutex.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5852 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-10-18 08:56:23 +00:00
Vladislav Bolkhovitin
9c2fb52429 iscsi-scst: Micro-optimize cmnd_prepare_recv_pdu()
Instead of adding sg[idx].offset to addr and immediately subtracting
sg[idx].offset again, leave out both arithmetic operations.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5735 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-08-27 02:55:28 +00:00
Vladislav Bolkhovitin
d45aab69a9 Fix incorrect address computation during receive PDUs preparations
Found and fix suggested by Кирилл Тюшев <kirill.tyushev8@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5721 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-08-21 05:17:47 +00:00
Vladislav Bolkhovitin
726be64769 iscsi-scst: Handle data buffers with non-zero offset correctly
Start at the proper offset in the receive buffer if sg[0].offset != 0.
Return the proper data to the initiator if sg[0].offset != 0.

This patch reworks trunk r5281, "iscsi-scst: fix offset
calculation", February 13, 2014.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5683 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-07-19 03:54:33 +00:00
Vladislav Bolkhovitin
b6f2a47ee8 Change BUG_ON(1) into BUG()
With CONFIG_BUG=y both BUG() and BUG_ON(1) halt the system. However,
with CONFIG_BUG=n BUG() halts the system but BUG_ON(1) not. To avoid
such subtleties, change BUG_ON(1) into BUG().

See also patch Josh Triplett, "bug: Make BUG() always stop the machine",
7 April 2014 (commit ID a4b5d580e07875f9be29f62a57c67fbbdbb40ba2).

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5618 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-06-20 04:10:40 +00:00
Vladislav Bolkhovitin
6b32f4ae81 scst, iscsi-scst: Fix RHEL 5 compilation warnings
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5615 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-06-20 04:03:40 +00:00
Vladislav Bolkhovitin
ca9b38693b scst: Switch from the cpu_*() to the cpumask_*() API
The cpus_*() functions were deprecated via patch "cpumask:
introduce new API, without changing anything" (November 2008,
commit ID 2d3854a37e8b). Hence switch from the cpus_*() API to
the cpumask_*() API.

This patch has the intended side effect of not adding the "[key]"
property to cpumask sysfs attributes that contain the default
cpumask. The current code namely reads uninitialized bits on
systems where nr_cpu_ids < NR_CPUS because cpus_equal() compares
more bits than those that were set by cpumask_copy().

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5596 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-06-13 04:52:18 +00:00
Vladislav Bolkhovitin
416958ee4b iscsi-scst: One major number per thread pool
Assign one major number per thread pool instead of as many major
numbers as there are threads in a thread pool. Do not increment
'major' if thread pool allocation fails. Micro-optimize
iscsi_threads_pool_get() by eliminating the assignment to 'fn'
and the write via snprintf() into name[].

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5520 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-05-15 01:39:12 +00:00
Vladislav Bolkhovitin
8d4a2f0a49 Cleanups and logging improvements
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5503 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-05-06 23:22:32 +00:00
Vladislav Bolkhovitin
8599ec4452 Reimplement dropping of TM requests in a more reliable manner
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5395 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-03-26 23:51:36 +00:00
Vladislav Bolkhovitin
b4ba1b24c7 iscsi-scst: fix offset calculation
Fixed a subtle bug in iSCSI-SCST with incorrectly calculated offsets
for non-page aligned transfers. Originally discovered, investigated and
fix suggested by Кирилл Тюшев, then Shahar Salzman tested and proved it.
See http://sourceforge.net/mailarchive/message.php?msg_id=31924078



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5281 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-02-13 04:02:56 +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
Vladislav Bolkhovitin
10840a381f A problem we are hitting is that we could hit a network issue
when a command/data is in the process of being sent. The snd
buffer space goes to zero and sendpage returns -EAGAIN. We then
wait for space to open. If space never opens then the cmd rsp timer
fires and the session/connection is dropped.

During that time we could try to send a nop as a ping, but it
is stuck behind that other command that got EAGAIN and we are
waiting for space to open to send them. We would expect the
nop in timer to fire before the cmd rsp timer, but it cannot
becuase the nop is sitting in the internal iscsi-scst queue.

This patch just has us start the timer ont he nop in right
away.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5091 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-11-09 03:02:59 +00:00
Vladislav Bolkhovitin
b96ab2a8bf iscsi-scst: Fix a race condition triggered by logout
This patch fixes the following crash:

general protection fault: 0000 [#1] PREEMPT SMP
Modules linked in: scst_local(O) iscsi_scst(O) scst_vdisk(O) libcrc32c scst(O) brd netconsole target_core_mod configfs fcoe libfcoe libfc scsi_transport_fc scsi_tgt ib_iser rdma_cm ib_addr iw_cm ib_cm ib_sa ib_mad ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi aesni_intel aes_x86_64 glue_he
lper parport_pc ppdev lrw gf128mul ablk_helper cryptd joydev microcode mperf psmouse i2c_piix4 processor button intel_agp intel_gtt agpgart lp parport hid_generic usbhid hid ext4 jbd2 mbcache floppy ata_piix
CPU: 0 PID: 7735 Comm: iscsiwr3 Tainted: G           O 3.11.0-debug+ #1
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
task: ffff88000850cfc0 ti: ffff88002ea5c000 task.ti: ffff88002ea5c000
RIP: 0010:[<ffffffffa038dd7b>]  [<ffffffffa038dd7b>] target_del_all_sess+0x9b/0x180 [iscsi_scst]
RSP: 0018:ffff88002ea5dcc0  EFLAGS: 00010286
RAX: 00000000fffffffe RBX: dead0000000fefc0 RCX: 0000000000000001
RDX: ffff88000e609460 RSI: 001e00004f011780 RDI: ffff88000e609460
RBP: ffff88002ea5dce8 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88000e6093b0
R13: ffff88000e609460 R14: 0000000000000000 R15: ffff88003e948158
FS:  0000000000000000(0000) GS:ffff88000f800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000427248 CR3: 0000000036d64000 CR4: 00000000000407f0
Stack:
 ffff88000e6093b0 ffff88003e85d600 ffff88003e948000 0000000000000030
 0000000000000000 ffff88002ea5dd28 ffffffffa038002b 0000000000000001
 ffff88003e55f880 ffff88002ea5dd28 ffffffffa0384d13 ffff88003e948000
Call Trace:
 [<ffffffffa038002b>] cmnd_tx_end+0x1db/0x1e0 [iscsi_scst]
 [<ffffffffa0384d13>] ? iscsi_do_send+0x23/0x60 [iscsi_scst]
 [<ffffffffa0385021>] iscsi_send+0x2d1/0x480 [iscsi_scst]
 [<ffffffff8104a802>] ? local_bh_enable_ip+0x82/0x110
 [<ffffffffa0380e8f>] ? conn_get+0x1f/0x70 [iscsi_scst]
 [<ffffffffa0385290>] scst_do_job_wr+0xc0/0x2d0 [iscsi_scst]
 [<ffffffffa038560d>] istwr+0x16d/0x2e0 [iscsi_scst]
 [<ffffffff8106a2e0>] ? wake_up_bit+0x40/0x40
 [<ffffffffa03854a0>] ? scst_do_job_wr+0x2d0/0x2d0 [iscsi_scst]
 [<ffffffff81069ea6>] kthread+0xd6/0xe0
 [<ffffffff81069dd0>] ? kthread_create_on_node+0x110/0x110
 [<ffffffff814debfc>] ret_from_fork+0x7c/0xb0
Code: 00 00 49 8b 94 24 b0 00 00 00 48 8b 1a 48 8d b2 c0 ee ff ff 48 81 eb 40 11 00 00 49 39 d5 74 28 44 89 f2 4c 89 e7 e8 15 fd ff ff <48> 8b 8b 40 11 00 00 48 89 de 48 8d 93 40 11 00 00 49 39 d5 48
[  474.156827] RIP  [<ffffffffa038dd7b>] target_del_all_sess+0x9b/0x180 [iscsi_scst]
 RSP <ffff88002ea5dcc0>

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5019 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-10-03 05:04:15 +00:00
Bart Van Assche
75f9be4b34 iscsi-scst: Spelling fix - change dublicate into duplicate
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4926 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-07-29 10:43:00 +00:00
Bart Van Assche
88ae3b7c78 iSCSI-SCST: Fix a sparse warning introduced via r4852
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4854 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-18 15:48:17 +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
Vladislav Bolkhovitin
82f7d66e5e Cleanup: remove unused variable
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4810 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-25 23:03:05 +00:00
Vladislav Bolkhovitin
2cadcc2c64 Cache alignment review
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4809 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-23 01:38:31 +00:00
Vladislav Bolkhovitin
b9c0b9d92d Another micro-optimization: cache align all fast path structures
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4785 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-04 23:51:16 +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
b3908d7447 Wrong task attribute isn't error, so warning message should be issued instead
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4753 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-02-04 23:55:34 +00:00
Vladislav Bolkhovitin
b30651cda0 Cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4622 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-14 23:48:52 +00:00
Vladislav Bolkhovitin
05bff10f05 During nexus loss reservations should not be cleared + add possibility for device specific states be retained during nexus loss as well.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4546 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-10-04 20:32:59 +00:00
Vladislav Bolkhovitin
e9008a5b12 Fix possible BUG_ON() on multiple forced commands release
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4513 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-09-11 20:38:57 +00:00
Vladislav Bolkhovitin
3861a12da5 Fix incorrect errors handling. Detected by smatch.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4492 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-27 22:12:15 +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
Vladislav Bolkhovitin
e1d73542b2 iSCSI-SCST: Fix a typo in an error message
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4251 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-04-30 19:29:47 +00:00
Vladislav Bolkhovitin
921e533528 Rename scst_alloc()/scst_free() to scst_alloc_sg()/scst_free_sg()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4247 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-04-28 00:25:41 +00:00
Vladislav Bolkhovitin
eb95049061 Copyrights updated + cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4216 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-04-18 02:26:39 +00:00
Vladislav Bolkhovitin
0dd7573989 Fix for missed mempool_destroy() in case when CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION not defined noticed by Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4208 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-04-13 20:28:50 +00:00
Vladislav Bolkhovitin
49c56244a1 Fix 3.3 checkpatch warnings about min()and max()
Fix three occurrences of the following warnings reported by the checkpatch
script included with Linux kernel version 3.3:
WARNING: min() should probably be min_t()
WARNING: max() should probably be max_t()

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4172 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-03-27 01:46:51 +00:00
Vladislav Bolkhovitin
d5ffb2234b Cleanup mgmt parameters initialization.
It's better to do it via a single function.

Patch from Alexey Obitotskiy <alexeyo1@open-e.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4165 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-03-23 22:03:22 +00:00
Vladislav Bolkhovitin
50120c37b3 scst_cmd_aborted() is a bad and ambiguous name. Rename it to scst_cmd_aborted_on_xmit() and create a new version, which truly reflects its semantic.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4143 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-02-24 02:24:06 +00:00
Vladislav Bolkhovitin
7872837b6b Replace list_entry((a)->next, b, c) by list_first_entry(a, b, c).
BSD-signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3965 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-12-10 03:50:24 +00:00
Vladislav Bolkhovitin
295adebc0f Use get/put_unaligned_be<n>(...) instead of
get/put_unaligned(cpu_to_be<n>(...)).

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3941 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-12-01 03:28:39 +00:00
Bart Van Assche
49147b3d8d Change __constant_cpu_... into cpu_... since the latter is also evaluated at compile time.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3806 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-08-14 19:03:03 +00:00
Bart Van Assche
705c3754a2 Remove superfluous double quotes from around #warning messages because checkpatch 3.0 complains about these.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3789 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-07-29 12:58:13 +00:00
Vladislav Bolkhovitin
2f1745eec1 Set data_out_in_data_receiving for preliminary completed commands as
well to prevent releasing them too early in iscsi_check_tm_data_wait_timeouts()



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3546 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-06-06 21:04:04 +00:00
Bart Van Assche
c37081aed5 Move spaces in long #warning/#error lines to the end of the previous line to shut up checkpatch.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3495 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-06-01 06:59:40 +00:00
Bart Van Assche
b901fe2958 iSCSI-SCST builds again on RHEL 5.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3488 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-28 10:37:46 +00:00
Bart Van Assche
fc82862369 iscsi-scst: Fixed a compilation error that only occurred with GENERATING_UPSTREAM_PATCH defined.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3452 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-13 06:13:52 +00:00
Vladislav Bolkhovitin
5e7544e5a4 TM handling fixes, part2, hopefully, final.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3450 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-12 01:31:01 +00:00