It is possible for a target driver to pass a scatterlist via
scst_cmd_set_tgt_sg() that is valid for the vdisk_fileio handler
but not for the vdisk_blockio handler. Complain loudly if an invalid
scatterlist is passed to vdisk_blockio because such scatterlists
cause silent data corruption with most Linux block drivers.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5933 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This change makes integration with OpenStack easier since OpenStack GUIDs
are 36 characters long: 32 hex characters and four dashes.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5932 d57e44dd-8a1f-0410-8b47-8ef2f437770f
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
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