Commit Graph

776 Commits

Author SHA1 Message Date
Bart Van Assche
398d41e753 scst: Revert "Increase tgt_dev_cmd_count by one" (r8465)
Because of the previous patch, r8465 is no longer necessary.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8518 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-08-23 03:44:52 +00:00
Bart Van Assche
92c6e461f0 scst: Revert "scst: Free removed LUNs asynchronously" (r8478)
r8478 was not necessary to fix the reported problem. Additionally, it
introduced a new problem, namely that detach_tgt was not called if the
associated device was deleted after the LUN was deleted and before it
was freed.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8517 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-08-23 03:43:33 +00:00
Bart Van Assche
740f3a6e63 scst: Make device deletion again synchronous
Some scripts that use the SCST sysfs interface depend on filp_close()
having been called before device deletion via the sysfs interface
finishes. Hence make device deletion again synchronous.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8510 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-08-19 02:59:18 +00:00
Bart Van Assche
c6e8013f48 scst: Only free a device after all associated commands and LUNs have finished
Merge scst_free_device() and scst_finally_free_device() into a single
function. Increase dev->refcnt when registering a device or virtual
device. Kill and decrease dev->refcnt when unregistering a device or
virtual device. These changes ensure that a scst_free_device() is
only called after all users (commands and tgt_devs) have stopped
accessing the SCST device.

Fixes: 3f2d50b589 ("scst: Do not suspend command processing when deleting a device"; r8067)



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8501 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-08-12 01:41:26 +00:00
Bart Van Assche
b20c82a521 scst: Complain about unbalanced reference counts in the command processing path
There is no evidence that this is possible. This patch is a debugging help.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8497 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-08-05 01:44:34 +00:00
Bart Van Assche
7c46bc3630 scst: Backport {init,destroy}_rcu_head()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8484 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-25 04:36:15 +00:00
Bart Van Assche
5930b4db71 scst: Fix the MOFED build
Reported-by: Dmitry Popovich <dsp@mvdnet.org>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8479 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-24 15:33:53 +00:00
Bart Van Assche
7426031e91 scst: Free removed LUNs asynchronously
Since scst_free_tgt_dev() is called as soon as the tgt_dev refcount
drops to zero and since scst_del_tgt_dev() decrements that reference
count, remove all scst_free_tgt_dev() calls that follow a
scst_del_tgt_dev() call. Set nr_deleted_tgt_devs in scst_acg_add_lun()
to -1 to avoid that all scst_del_tgt_dev() calls try to free the
associated acg_dev.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8478 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-24 02:19:54 +00:00
Bart Van Assche
0ac23deee2 scst: Introduce tgt_dev.tgtt
A later patch will free tgt_devs after an RCU grace period. Make it
safe to access the target template pointer after an RCU grace period.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8474 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-24 01:09:25 +00:00
Bart Van Assche
98cbaa121f scst: Revert r8466
Since r8466 is causing trouble, revert it temporarily.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8471 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-23 19:18:38 +00:00
Bart Van Assche
cf2167c2b9 scst: Free removed LUNs asynchronously
Instead of waiting until all commands associated with a LUN have finished,
do not wait and free LUN data structures once all associated commands have
finished. This commit should fix https://sourceforge.net/p/scst/tickets/23/.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8466 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-21 01:52:03 +00:00
Bart Van Assche
5b0f9ef0b9 scst: Increase tgt_dev_cmd_count by one
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8465 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-21 01:49:38 +00:00
Bart Van Assche
0979cd90e4 scst: Make a comment more clear
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8461 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-07-21 01:47:11 +00:00
Bart Van Assche
70e055ea0d scst: Fix a Linux kernel v4.10 warning about redefining FC_PORT_ROLE_NVME_INITIATOR
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8433 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-06-20 17:09:32 +00:00
Bart Van Assche
c4793a793d qla2x00t-32gbit: display FC-NVMe port roles
Currently the FC-NVMe driver is leveraging the SCSI FC transport class to
access the remote ports. Which means that all FC-NVMe remote ports will be
visible to the fc transport layer, but due to missing definitions the port
roles will always be 'unknown'.  This patch adds the missing definitions to
the fc transport class to that the port roles are correctly displayed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[ bvanassche: Ported this patch to SCST ]

See also upstream commit a6a6d0589ac4 ("scsi: scsi_transport_fc: nvme:
display FC-NVMe port roles") # v5.2-rc1.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8414 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-06-03 03:34:16 +00:00
Bart Van Assche
c03d826b95 scst/include/backport.h: Modifications for script/specialize-patch
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8403 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-05-31 01:56:57 +00:00
Bart Van Assche
4486fd014e scst/include/backport.h: Fix build against MOFED >= 4.5 for lk < v4.18
Avoid that the following error is reported when building SCST against
a Linux kernel older than v4.18 combined with MOFED >= 4.5:

scst/include/backport.h:910:21: error: redefinition of 'kvcalloc'
 static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
                     ^
In file included from ./include/linux/highmem.h:8:0,
                 from ./include/linux/bio.h:21,
                 from ./scst/include/backport.h:24,
                 from ./scst/include/scst_debug.h:42,
                 from isert-scst/isert_dbg.h:29,
                 from isert-scst/iser_global.c:40:
/usr/src/ofa_kernel/default/include/linux/mm.h:78:21: note: previous definition of 'kvcalloc' was here
 static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
                     ^

Signed-off-by: Sergey Gorenko <sergeygo@mellanox.com>
[bvanassche: renamed MOFED_*_VERSION INTO MOFED_*]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8398 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-05-30 13:42:42 +00:00
Bart Van Assche
22f1132073 Makefiles: Rework build mode switching
Move the build_mode file from the top level into the scst directory. Write
build mode defines into scst/include/build_mode.h and include that file
directly or indirectly in all source files that depend on these #defines.
This approach has the advantage that "make clean" does no longer has to
be run when switching between build modes because the kernel build system
recognizes build_mode.h as a dependency and triggers a rebuild of all
source files that directly or indirectly include the build_mode.h header
file.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8347 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-05-05 18:19:38 +00:00
Bart Van Assche
74354ff7f0 scst: Fix the build against Ubuntu kernel 4.15.0
Reported-by: Tomohiro Kusumi


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8271 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-23 01:00:43 +00:00
Bart Van Assche
86c69ab494 scst/include/backport.h: Remove the wait_event_lock_irq_timeout() backport
Due to the previous patch this backport is no longer needed. Note: the
wait_event_lock_irq_timeout() needs more work.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8238 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-14 16:25:46 +00:00
Bart Van Assche
a359ed4904 scst/include/backport.h: Port recent changes to RHEL 6 and RHEL 7
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8195 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-14 01:11:31 +00:00
Bart Van Assche
a2ed73c287 scst/include/backport.h: Backport FC_PORTSPEED_64GBIT
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8194 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-13 22:57:18 +00:00
Bart Van Assche
e4a05976e7 scst/include/backport.h: Add wait_event_lock_irq_timeout() backport
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8193 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-13 22:56:39 +00:00
Bart Van Assche
5a85f399c8 scst/include/backport.h: Backport wwn_to_u64()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8192 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-13 22:55:58 +00:00
Bart Van Assche
83875a3051 scst/include/backport.h: Backport irq_set_affinity_notifier()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8177 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-10 14:59:12 +00:00
Bart Van Assche
556a7f6cf2 scst: Support the SLUB allocator
Although the SLAB allocator exports the kmalloc_track_caller() function,
the SLUB allocator does not. Hence use kmalloc() instead of
kmalloc_track_caller().


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8163 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-06 23:16:51 +00:00
Bart Van Assche
c749a72feb scst/include/backport.h: Add a mempool_destroy() backport
This patch makes it safe to call mempool_destroy(NULL) for kernel versions
before v4.3.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8150 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-05 01:03:04 +00:00
Bart Van Assche
b011fdf316 scst/include/backport.h: Add a kmem_cache_destroy() backport
This patch makes it safe to call kmem_cache_destroy(NULL) on kernel v4.2
and before.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8149 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-04 00:37:15 +00:00
Bart Van Assche
a1ae8be4d7 scst/include/backport.h: Add dummy pcie_capability_read_*() backports
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8142 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-03 00:48:15 +00:00
Bart Van Assche
3c75a7c47e scst/include/backport.h: Add an IS_ENABLED() backport
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8137 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-02 04:15:18 +00:00
Bart Van Assche
ef1b78ba49 scst/include/backport.h: Add an alloc_workqueue() backport
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8130 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-04-02 04:09:54 +00:00
Bart Van Assche
e24843ced5 scst: Fix kvfree() backport version check for kernel versions v3.12.41..
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8112 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-31 04:20:09 +00:00
Bart Van Assche
e97314ebd7 scst/include/backport.h: Suppress a compiler warning triggered by including <scsi/scsi_transport_fc.h>
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8090 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-29 01:27:45 +00:00
Bart Van Assche
c8533e86a4 scst/include/backport.h: Fix kvcalloc() backport
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8089 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-29 01:19:28 +00:00
Bart Van Assche
796edfc6f8 scst/include/backport.h: Fixes for RHEL 6 and 7
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8086 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-28 02:25:41 +00:00
Bart Van Assche
23a2753a9c scst/include/backport.h: Add backports for additional kernel functions, constants and data structures
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8085 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-27 23:09:20 +00:00
Bart Van Assche
bd373cfa6e scst: Fix the kernel_write() backport for RHEL 6.x
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8078 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-25 22:05:10 +00:00
Bart Van Assche
11d56f4129 scst/include/backport.h: Fix the timer_setup() backport and add a from_timer() backport
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8070 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-25 04:19:24 +00:00
Bart Van Assche
c597df93a1 scst/include/backport.h: Make it possible to include this header file first
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8069 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-25 04:18:40 +00:00
Bart Van Assche
94018a42e3 scst: Use kernel_{read,write}() instead of scst_{read,write}()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8065 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-21 02:56:02 +00:00
Bart Van Assche
43a252aef2 scst, ib_srpt: Add support for kernel version v5.1
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8064 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-21 02:54:31 +00:00
Bart Van Assche
eb83c6971b scst: Add a round_up() backport
A call to round_up() was introduced in r7854 / commit 434207ab53.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8061 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-20 02:01:13 +00:00
Bart Van Assche
4c09bc9db7 scst: Add a pr_warn_once() backport
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8053 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-14 01:48:24 +00:00
Bart Van Assche
a4c05a4b31 scst: Backport the percpu-ref code to kernel version 3.17 and before
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8046 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-11 02:53:24 +00:00
Bart Van Assche
b9969a09a5 scst: Simplify the percpu-ref code for RHEL 7
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8045 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-11 02:51:09 +00:00
Bart Van Assche
3d35b7477f scst: Avoid switching explicitly to per-cpu
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8044 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-11 02:50:21 +00:00
Bart Van Assche
c03a6ffd5e scst, backport.h: Fix RHEL 7 build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8037 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-10 05:18:41 +00:00
Bart Van Assche
c9680a33ec scst: Add a percpu_ref backport for kernel versions before 3.11, e.g. RHEL 6
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8036 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-10 05:14:42 +00:00
Bart Van Assche
f2342573a1 scst: Rework per-device command reference counting
Restore the original meaning of dev_cmd_count and introduce the refcnt
member.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8035 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-10 04:45:00 +00:00
Bart Van Assche
759bdca73a scst: Use a per-cpu counter to track the number of commands per device
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8027 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-10 01:24:43 +00:00