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
For code 08h (EXTENDED FORM) minimal response length is 32, see table
"READ POSITION data format, extended form". In SSC-[2,3] table "READ
POSITION service action codes" requests minimum response lenght 28
bytes, but it is an apparent typo, because the actual data format is 32
bytes long. In SSC-4 it is fixed.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5740 d57e44dd-8a1f-0410-8b47-8ef2f437770f
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
Since scst.h contains a backport of the definition of set_cpus_allowed_ptr(),
the set_cpus_allowed() invocations are superfluous. Hence remove these.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5734 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make it possible to figure out what went wrong from inspecting the
system log only by mentioning the incorrect filename in the system
log.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5733 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Make the SCSI device identification page (83h) EUI-64 and NAA
IDs configurable. If neither the eui64_id nor the naa_id sysfs
attribute has been set, export the first eight bytes of the
t10_dev_id as an EUI-64 ID. If the NAA ID but not the EUI-64 ID
has been set, report the NAA ID only. If both IDs have been set,
report both.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5730 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Allow a set of completion vectors to be associated with each InfiniBand
HCA port and allocate the completion vector for each session in a
round-robin fashion from the per-port set. This helps to spread the
InfiniBand interrupt workload over multiple CPU's, at least if different
InfiniBand MSI-X vectors are associated with different CPU's.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5728 d57e44dd-8a1f-0410-8b47-8ef2f437770f