For SCST devices with a short name determining which SCST command
threads serve a given LUN requires an (expensive) walk of the
process table. For SCST devices with a long name it is not possible
to determine unambiguously which command threads serve a given
LUN. Hence add a thread_pid sysfs attribute that makes it easy to
figure out which command threads serve a LUN.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5851 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The sessions/<sess>/lun<X> sysfs attribute "active_commands" is not
yet documented. Hence add documentation for that sysfs attribute.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5850 d57e44dd-8a1f-0410-8b47-8ef2f437770f
While the BLOCK DESCRIPTOR LENGTH field spans a single byte in the
Mode parameter header(6), the size of this field in the Mode parameter
header(10) is two bytes. Interpret both bytes while executing a MODE
SELECT(10) command.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5849 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Since 'address' points at kernel space memory, change its type
from uint8_t __user * into uint8_t *. This change reduces the
number of casts between uint8_t __user * to uint8_t * in
fileio_exec_write().
This patch does not change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5848 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The 'iov_base' member of 'struct iovec' is declared in
<uapi/linux/uio.h> with type 'void __user *'. Adding an integer
to a void pointer has the same effect as adding an integer to
a char pointer in the C language. This means that it is safe to
remove the cast in front of the eiv->iov_base pointer.
Please note that a similar construct already exists in the iSCSI
target driver. From the nthread.c source file:
iop->iov_base += rest;
iop->iov_len -= rest;
This patch does not change any functionality.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5847 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Avoid that the following memory leak can occur:
- sgv_pool_alloc() is called with SGV_POOL_RETURN_OBJ_ON_ALLOC_FAIL
set, with neither SGV_POOL_NO_ALLOC_ON_CACHE_MISS nor
SGV_POOL_ALLOC_NO_CACHED set and with 'size' such that
sgv_max_local_pages < pages_to_alloc <= pool->max_cached_pages.
- sgv_get_obj() and sgv_alloc_arrays() succeed.
- sgv_alloc_sg_entries() fails.
- sgv_get_obj() returns the SGV object with no buffers.
- A call to sgv_pool_free() adds this object to the recycle list.
- sgv_pool_alloc() is called a second time with the same parameters.
- sgv_get_obj() retrieves the object that was previously added to
the recycle list.
- sgv_alloc_arrays() is called and overwrites the obj->sg_entries
pointer although it still points at allocated memory, resulting
in a memory leak.
Reported-by: Shahar Salzman <shahar.salzman@kaminario.com>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5829 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Stacked block devices impose weird restrictions on S/G-lists. Hence
make the COMPARE AND WRITE implementation independent of these
restrictions.
Additionally, reduce the MAXIMUM COMPARE AND WRITE LENGTH limit from
0xff (no limit) to 0xfe to reduce the maximum amount of memory allocated
during a COMPARE AND WRITE. Also serialize COMPARE AND WRITE
operations, fix the offset reported for miscompares and fix the start
offset of the region that is synchronized if the FUA bit has been set.
Reported-by: Vishal Tripathi <vishal.tripathi@calsoftinc.com>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5811 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Today SCST does not support LUN numbers >= 16384. Additionally,
there is a bug in older Linux initiator systems that prevents
proper handling of LUN numbers >= 2**32. See also Hannes Reinecke,
scsi_scan: Fixup scsilun_to_int(), June 25, 2014 (commit ID
d9e5d6183715e691b37afd3785c311d05cd1338d). Hence set max_lun to
16383.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5785 d57e44dd-8a1f-0410-8b47-8ef2f437770f