The sysfs API is supported from kernel 2.6.26 on and uses the swap()
macro while the swap() macro was introduced in kernel 2.6.29. Hence
provide a definition of the swap() macro for kernels before 2.6.29.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
[bvanassche: Moved swap() definition a few lines down and added #ifndef/#endif]
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5269 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Since the time during which a PR read or write lock is held is short,
use a mutex to implement PR read and write locking. So although this
patch excludes multiple simultaneous readers that shouldn't affect the
time needed to process a PR operation measurably.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5254 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Kernel versions before 2.6.26 do not have a definition for the
ACCESS_ONCE() macro, hence provide one.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5220 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Reduce the number of reservation state variables from (one per
device + one per session) to one per device. Introduce helper
functions for manipulating the SPC-2 reservation state.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5218 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Apparently RHEL 5.9 has an implementation of set_cpus_allowed_ptr()
but RHEL 5.10 not. Work around this by providing an implementation.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5147 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that compilation fails on RHEL 5.9. In the RHEL 5.9 kernel headers
neither __printf() nor sg_is_last() has been defined. Additionally, the
variable 'fd' in vdisk_unmap_range() is only defined when building against
kernel version > 2.6.27.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
By default data receive error it should be assumed that no data
received, not that all data received as it is currently
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5138 d57e44dd-8a1f-0410-8b47-8ef2f437770f
A quote from SBC-3 about WRITE SAME (10): "If the number of
logical blocks specified to be unmapped or written exceeds the value
indicated in the MAXIMUM WRITE SAME LENGTH field in the Block Limits
VPD page (see 6.6.3), then the device server shall terminate the command
with CHECK CONDITION status with the sense key set to ILLEGAL REQUEST
and the additional sense code set to INVALID FIELD IN CDB."
This patch fixes the following crash since with the current implementation
data_len >= 2**63 makes (unsigned)ws_sg_cnt >= 2**31 and this causes
sg_init_table() to crash as follows:
BUG: unable to handle kernel paging request at 00000027ffffffe8
IP: [<ffffffff8120d51e>] sg_init_table+0x5e/0x90
CPU: 1 PID: 10297 Comm: disk014_1 Tainted: G O 3.11.0-debug+ #1
RIP: 0010:[<ffffffff8120d51e>] [<ffffffff8120d51e>] sg_init_table+0x5e/0x90
Call Trace:
[<ffffffffa02e4b46>] scst_write_same+0x236/0x340 [scst]
[<ffffffffa034db30>] ? vdisk_exec_write_same_unmap.isra.35+0x170/0x170 [scst_vdisk]
[<ffffffffa034dba4>] vdisk_exec_write_same+0x74/0x170 [scst_vdisk]
[<ffffffffa034824e>] vdev_do_job+0x15e/0x390 [scst_vdisk]
[<ffffffffa03484a5>] vdisk_exec+0x25/0x70 [scst_vdisk]
[<ffffffffa02cafb5>] scst_do_real_exec+0xa5/0x3d0 [scst]
[<ffffffffa02ce2da>] scst_exec_check_blocking+0xea/0x310 [scst]
[<ffffffffa02ce695>] scst_exec_check_sn+0x195/0x2f0 [scst]
[<ffffffffa02cff31>] scst_process_active_cmd+0x521/0x750 [scst]
[<ffffffffa02d01e1>] scst_do_job_active+0x81/0x1a0 [scst]
[<ffffffffa02d0537>] scst_cmd_thread+0x157/0x340 [scst]
[<ffffffff81069ea6>] kthread+0xd6/0xe0
[<ffffffff814debfc>] ret_from_fork+0x7c/0xb0
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5122 d57e44dd-8a1f-0410-8b47-8ef2f437770f
I think the comments in scst.h for data_direction and expected_data_direction
can be made more clear. The patch below makes the comments for these two
variables more detailed.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5121 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This patch does not change any functionality other than the message
printed when it takes more than one second before the completion is
signalled.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5086 d57e44dd-8a1f-0410-8b47-8ef2f437770f
There is not a way to specify an attribute that applies to only one
target or target driver. This patch provides such an interface.
Copyright (C) 2013 Emulex. All rights reserved.
This software is provided as-is, without any express or implied warranty. In
no event will Emulex be held liable for any damages arising from the use of
this software. Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and redistribute it
freely. If you use this software in a product, an acknowledgment in the
product documentation would be appreciated, but is not required. This notice
may be removed from any source code distribution that includes all or any part
of the original software.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4970 d57e44dd-8a1f-0410-8b47-8ef2f437770f
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
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
Disallow READS in exclusive access mode by initiators that do not hold
the reservation. Disallow READS in exclusive access mode - all registrants
by initiators that did not register the key. This behavior is required by
SPC-4. This patch fixes a regression introduced on the trunk on June 29 2012
(r4392). PGR support in released versions, e.g. 2.2.1, works fine as far as
I know.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4814 d57e44dd-8a1f-0410-8b47-8ef2f437770f
1. It doesn't work well with NPIV-like targets
2. Without it struct scst_tgt is read-mostly
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4811 d57e44dd-8a1f-0410-8b47-8ef2f437770f