Commit Graph

5820 Commits

Author SHA1 Message Date
Bart Van Assche
3041f41330 Merge branch 'svn-trunk' 2017-06-09 20:22:34 -07:00
Vladislav Bolkhovitin
213a11e07b scst: minor cleanup for previous commit
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7207 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-07 01:23:59 +00:00
Vladislav Bolkhovitin
e174d00f08 scst: update ALUA documentation (Active/Non-Optimized)
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7206 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-07 01:13:58 +00:00
Vladislav Bolkhovitin
64d07d25cf scst_vdisk: 'numa_node_id' signed attribute value fix
The "numa_node_id" attribute reside in the scst_vdisk_dev struct as
signed integer and may well be negative values (eg, -1), so move fetching
it above the unsigned attributes and use kstrtoll() to retrieve the
values.

Signed-off-by: Marc A. Smith <marc.smith@parodyne.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7205 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-06 04:20:09 +00:00
Vladislav Bolkhovitin
0ae66a082e Fix dereference beyond last sg element
Reported-By: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7204 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-03 04:02:22 +00:00
Vladislav Bolkhovitin
93bea9e0e8 Update to 4.11 kernels
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7203 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-03 02:38:51 +00:00
Bart Van Assche
e5fa5bb587 Merge branch 'svn-trunk' 2017-05-31 21:37:56 -07:00
Vladislav Bolkhovitin
a614104023 usr: fix -Wmissing-prototypes warnings
Fix all twelve [-Wmissing-prototypes] warnings by adding "static" to their
declarations.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7202 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-01 04:08:02 +00:00
Vladislav Bolkhovitin
5358fb06f8 scst: remove a few unnecessary shadow declarations
Remove a few "shadow" declarations that appear unnecessary and probably
unintended.  (These are cases where a declaration in an inner scope hides
another declaration of the same name in an outer scope.)

Not all shadow declarations are superfluous -- so this particular compiler
warning is one that cannot be simply heeded while half asleep.  But these
particular ones I removed appear to be superfluous.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7201 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-01 04:04:45 +00:00
Vladislav Bolkhovitin
41a287734f iscsi-scst: fix a couple of bad-function-cast warnings
This is a "marginal" warning, but there are only six of them in the SCST code
and this fixes two of those.

session.c:105:4: warning: cast from function call of type void * to non-matching type _Bool [-Wbad-function-cast]
target.c:668:14: warning: cast from function call of type void * to non-matching type _Bool [-Wbad-function-cast]

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7200 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-01 03:53:08 +00:00
Vladislav Bolkhovitin
c4e9bab97c scst: scst_free_acg() not dereference NULL acg->tgt for proc interface
Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7199 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-01 03:49:26 +00:00
Vladislav Bolkhovitin
c1d798a788 scst: cleanup of dead code
Reported-By: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7198 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-06-01 03:46:06 +00:00
Bart Van Assche
e8d42282ad Merge branch 'svn-trunk' 2017-05-30 22:46:21 -07:00
Vladislav Bolkhovitin
bd67b31c9e scst: a better version of possible memory reclaim deadlock fix r7194
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7197 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-31 04:01:00 +00:00
Bart Van Assche
5bc93b023d Merge branch 'svn-trunk' 2017-05-26 21:43:00 -07:00
Vladislav Bolkhovitin
4a8a18cc34 scst_vdisk: add "active" attridute to the list of BLOCKIO add device attributes
This is forgotten piece to r7187



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7196 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-26 02:45:47 +00:00
Bart Van Assche
9a92ba306d Merge branch 'svn-trunk' 2017-05-24 20:59:12 -07:00
Vladislav Bolkhovitin
e5e4531049 iscsi-scst: cleanup
There's no need to end-align the padding. Plus, it's not optimal to
access front misaligned memory

Reported-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7195 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-25 02:11:06 +00:00
Vladislav Bolkhovitin
7caed6e7c4 scst: prevent possible memory reclaim deadlock
Reported by lockdep:

[  415.813281] =================================
[  415.817626] [ INFO: inconsistent lock state ]
[  415.821974] 4.10.12-scst-dbg #4 Tainted: G           O
[  415.827360] ---------------------------------
[  415.831705] inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.
[  415.838217] kswapd0/558 [HC0[0]:SC0[0]:HE1:SE1] takes:
[  415.843342]  (sgv_pools_mutex){+.+.?.}, at: [<ffffffffa036d300>] __sgv_shrink+0x90/0x1d0 [scst]
[  415.852075] {RECLAIM_FS-ON-W} state was registered at:
[  415.857208]   mark_held_locks+0x6c/0x90
[  415.861034]   lockdep_trace_alloc+0x8a/0xd0
[  415.865210]   kmem_cache_alloc_node+0x32/0x2f0
[  415.869670]   sgv_pool_create_node+0x186/0x2e0 [scst]
[  415.874735]   sgv_pool_create+0x12/0x20 [scst]
[  415.879194]   scst_sgv_pools_init+0xb9/0x3c0 [scst]
[  415.884065]   __dev_user_set_opt+0x152/0x5f0 [scst_user]
[  415.889367]   do_one_initcall+0x59/0x190
[  415.893280]   do_init_module+0x6a/0x230
[  415.897106]   load_module+0x591/0x830
[  415.900758]   SYSC_init_module+0xd3/0x120
[  415.904758]   SyS_init_module+0xe/0x10
[  415.908501]   entry_SYSCALL_64_fastpath+0x18/0xad
[  415.913193] irq event stamp: 3831137
[  415.916763] hardirqs last  enabled at (3831137): [<ffffffff8106ff37>] __local_bh_enable_ip+0x67/0xd0
[  415.925878] hardirqs last disabled at (3831135): [<ffffffff8106fefe>] __local_bh_enable_ip+0x2e/0xd0
[  415.935018] softirqs last  enabled at (3831136): [<ffffffffa036c72d>] __sgv_can_be_shrunk+0x9d/0x180 [scst]
[  415.944764] softirqs last disabled at (3831134): [<ffffffffa036c6e3>] __sgv_can_be_shrunk+0x53/0x180 [scst]
[  415.954481]
[  415.954481] other info that might help us debug this:
[  415.960994]  Possible unsafe locking scenario:
[  415.960994]
[  415.966899]        CPU0
[  415.969336]        ----
[  415.971774]   lock(sgv_pools_mutex);
[  415.975339]   <Interrupt>
[  415.977950]     lock(sgv_pools_mutex);
[  415.981691]
[  415.981691]  *** DEADLOCK ***
[  415.981691]
[  415.987599] 1 lock held by kswapd0/558:
[  415.991424]  #0:  (shrinker_rwsem){++++..}, at: [<ffffffff811ace5c>] T.1898+0x4c/0x100
[  415.999329]
[  415.999329] stack backtrace:
[  416.003677] CPU: 2 PID: 558 Comm: kswapd0 Tainted: G           O    4.10.12-scst-dbg #4
[  416.011663] Hardware name: Dell Inc. PowerEdge R710/00NH4P, BIOS 2.2.10 11/09/2010
[  416.019216] Call Trace:
[  416.021661]  dump_stack+0x6b/0xa0
[  416.024968]  print_usage_bug+0x182/0x190
[  416.028881]  ? print_circular_bug+0x110/0x110
[  416.033226]  mark_lock_irq+0xee/0x290
[  416.036879]  mark_lock+0x113/0x1a0
[  416.040271]  mark_irqflags+0xb0/0x180
[  416.043924]  __lock_acquire+0x245/0x610
[  416.047750]  ? __lock_release+0x408/0x470
[  416.051750]  lock_acquire+0xce/0x2b0
[  416.055343]  ? __sgv_shrink+0x90/0x1d0 [scst]
[  416.059689]  ? mutex_lock_nested+0x47/0x750
[  416.063863]  mutex_lock_nested+0x82/0x750
[  416.067888]  ? __sgv_shrink+0x90/0x1d0 [scst]
[  416.072236]  ? put_lock_stats+0xe/0x30
[  416.075975]  ? __lock_release+0x408/0x470
[  416.080001]  ? __sgv_shrink+0x90/0x1d0 [scst]
[  416.084349]  ? debug_smp_processor_id+0x17/0x20
[  416.088868]  ? put_lock_stats+0xe/0x30
[  416.092633]  ? __sgv_can_be_shrunk+0x9d/0x180 [scst]
[  416.097588]  ? mark_held_locks+0x6c/0x90
[  416.101500]  ? __local_bh_enable_ip+0x67/0xd0
[  416.105873]  __sgv_shrink+0x90/0x1d0 [scst]
[  416.110047]  ? __local_bh_enable_ip+0x67/0xd0
[  416.114420]  sgv_scan_shrink+0x5d/0x120 [scst]
[  416.118853]  do_shrink_slab+0x19b/0x5f0
[  416.122678]  ? T.1898+0x4c/0x100
[  416.125899]  ? down_read_trylock+0x60/0x80
[  416.129985]  T.1898+0xb4/0x100
[  416.133031]  shrink_node+0x62/0xa0
[  416.136424]  balance_pgdat+0x1c8/0x2c0
[  416.140164]  kswapd+0xa0/0x2b0
[  416.143211]  ? preempt_count_sub+0x9f/0xe0
[  416.147409]  ? schedule+0x4e/0xc0
[  416.150715]  ? balance_pgdat+0x2c0/0x2c0
[  416.154627]  kthread+0x111/0x150
[  416.157849]  ? call_usermodehelper_exec_work+0xa0/0xa0
[  416.162974]  ? __kthread_init_worker+0x80/0x80
[  416.167407]  ? call_usermodehelper_exec_work+0xa0/0xa0
[  416.172534]  ? call_usermodehelper_exec_work+0xa0/0xa0
[  416.177660]  ret_from_fork+0x2e/0x40



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7194 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-23 03:50:43 +00:00
Bart Van Assche
d411309fef Merge branch 'svn-trunk' 2017-05-22 20:50:39 -07:00
Vladislav Bolkhovitin
27db06eb7c qla2x00t: fix broken 4.9 kernels build
Reported-By: Marc Smith <marc.smith@parodyne.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7193 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-23 02:23:38 +00:00
Bart Van Assche
f7e1feb0a8 Merge branch 'svn-trunk' 2017-05-19 20:52:25 -07:00
Vladislav Bolkhovitin
c729d1934a scst: minor cleanup
Let's keep it simple without unused functionality



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7192 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-20 03:29:41 +00:00
Vladislav Bolkhovitin
e452378d1e scst: restore locking documentation comments
Better to follow the common rule and always have locking expectations
documented in addition to runtime checks. Partial revert of r7095.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7191 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-20 03:19:54 +00:00
Vladislav Bolkhovitin
36f2612eb1 scst: fix possible NULL dereference in TM code
TM command accessing a non-existing LUN might lead NULL dereference in
scst_call_dev_task_mgmt_fn_done().

Reported-By: <Ilan Steinberg <ilan.steinberg@kaminario.com>>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7190 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-20 03:00:28 +00:00
Bart Van Assche
53e6be9bb8 Merge branch 'svn-trunk' 2017-05-19 19:25:14 -07:00
Vladislav Bolkhovitin
b3758b0db9 scst: compute max_transfer args as long, not int
Compute max_transfer args as long, not int, to avoid overflow when
max_sg_cnt=32768 and PAGE_SHIFT=16 (64K PAGE_SIZE).  Note it is not
only the min() call, but also the << PAGE_SHIFT needs to be long.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7189 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-20 02:04:16 +00:00
Bart Van Assche
c7f43429af Merge branch 'svn-trunk' 2017-05-18 21:08:28 -07:00
Vladislav Bolkhovitin
8d3a9f440a qla2x00t: Disable Out-of-order processing by default
From: Quinn Tran <quinn.tran@cavium.com>

Out of order(OOO) processing requires initiator, switch
and target to support OOO. In today¹s environment, none
of the switches support OOO. OOO requires extra buffer
space which affect performance. By turning ON this feature
in QLogic's FW, it delays error recovery because droped
frame is treated as out of order frame. We¹re turning OFF
this option of speed up error recovery.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>

Merge of mainline commit 300af14bdb28157090f0c6f89d244fda940082da

EXPERIMENTAL!



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7188 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-19 02:58:23 +00:00
Vladislav Bolkhovitin
9d21169f8c scst: implement BLOCKIO devices "active" attribute
Intended to be able to load  on passive side as described in
https://sourceforge.net/p/scst/mailman/message/35549446/

Suggested-by: Кирилл Тюшев <kirill.tyushev8@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7187 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-19 02:37:49 +00:00
Bart Van Assche
4675562fcc Merge branch 'svn-trunk' 2017-05-15 19:10:49 -07:00
Bart Van Assche
81f80e1708 isert-scst: Fix a race condition that was introduced accidentally in r7184
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7186 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-16 02:04:47 +00:00
Bart Van Assche
07e6d21634 Merge branch 'svn-trunk' 2017-05-14 11:56:35 -07:00
Bart Van Assche
b2b15e1d55 scst_local: Fix a race condition
Avoid that the following crash can occur:

general protection fault: 0000 [#1] PREEMPT SMP
RIP: 0010:scsi_is_host_device+0x7/0x20 [scsi_mod]
Call Trace:
 scst_process_aens+0x95/0x1d0 [scst_local]
 scst_aen_work_fn+0x6f/0x120 [scst_local]
 process_one_work+0x20b/0x6c0
 worker_thread+0x4e/0x4a0
 kthread+0x113/0x150
 ret_from_fork+0x31/0x40


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7185 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 18:56:09 +00:00
Bart Van Assche
830369e50d isert-scst: Avoid that shutdown sporadically hangs
Waiting for other threads to release an object using code like
"while (object->refcnt > 0) msleep(100)" without holding a reference
on 'object' is wrong because the memory object points at may be freed
before or while this loop is in progress. Hence introduce a global
portal object count and wait on that count instead of waiting for
the per-portal reference count to reach zero.

The use-after-free was introduced in r6952 ("isert: faster release
of isert_scst module").

See also https://sourceforge.net/p/scst/tickets/2/.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7184 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 18:53:01 +00:00
Bart Van Assche
cda5cadb1c isert-scst: Enable type checking for isert portal pointers
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7183 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 18:49:04 +00:00
Bart Van Assche
f5f161ae70 scst_local: Fix a race condition
Avoid that the following crash occurs:

general protection fault: 0000 [#1] PREEMPT SMP
RIP: 0010:scsi_is_host_device+0x7/0x20 [scsi_mod]
Call Trace:
 scst_process_aens+0x95/0x1d0 [scst_local]
 scst_aen_work_fn+0x6f/0x120 [scst_local]
 process_one_work+0x20b/0x6c0
 worker_thread+0x4e/0x4a0
 kthread+0x113/0x150
 ret_from_fork+0x31/0x40
2017-05-14 11:12:14 -07:00
Bart Van Assche
473a7be156 isert-scst: Fix a use-after-free
Waiting for other threads to release an object using code like
"while (object->refcnt > 0) msleep(100)" without holding a reference
on object is wrong because the memory object points at may be freed
before or while this loop is in progress. Hence introduce a global
portal object count and wait on that count instead of waiting for
the per-portal reference count to reach zero.
2017-05-14 09:42:17 -07:00
Bart Van Assche
1f10c8c269 isert-scst: Enable type checking for isert portal pointers 2017-05-14 09:15:56 -07:00
Bart Van Assche
b799130680 ib_srpt: Fix a logging statement
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7182 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 14:55:00 +00:00
Bart Van Assche
060d4f2d21 ib_srpt: Remove ib_backport.h again 2017-05-14 07:53:20 -07:00
Bart Van Assche
7d7bc5c41b Merge branch 'svn-trunk' 2017-05-14 07:50:20 -07:00
Israel Rukshin
28c5d73550 isert-scst: fix isert connection teardown flow
Synchronizing the rdma_disconnect() with the post drain wr
as other ULPs like iSER do.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7181 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 13:45:02 +00:00
Bart Van Assche
f21fe1094e Merge branch 'svn-trunk' 2017-05-13 21:26:56 -07:00
Bart Van Assche
8315bfdd0f scst_vdisk: Avoid shifting left by a negative number of bits
scst_calc_block_shift() can return a negative number. Hence avoid
1 << scst_calc_block_shift().  Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7180 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 03:49:39 +00:00
Bart Van Assche
4acdf66303 Merge branch 'svn-trunk' 2017-05-13 20:19:54 -07:00
Bart Van Assche
cb070d9a7f scst/include/backport.h: Add a backport of rcu_dereference_protected()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7179 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 03:13:56 +00:00
Bart Van Assche
b4118ea0f1 scst/include/backport.h: Add a kref_read() backport
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7178 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 03:06:54 +00:00
Bart Van Assche
4a18e68c3f scst/include/backport.h: Fix kthread_create_on_node() definition
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7177 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 02:55:24 +00:00
Bart Van Assche
9a1d8ed867 Merge branch 'svn-trunk' 2017-05-13 17:57:11 -07:00