Commit Graph

5284 Commits

Author SHA1 Message Date
Vladislav Bolkhovitin
011bc77ec9 scst_vdisk: remove parentheses from DEF_DIF_FILENAME_TMPL
DEF_DIF_FILENAME_TMPL should not have the parentheses; I used it in some
context where that became apparent.

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




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7120 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:45:15 +00:00
Vladislav Bolkhovitin
f84ed1c222 scst: remove superfluous assignment in scst_dg_add()
The "res" is unconditionally set by the call to scst_dg_sysfs_add(),
so setting it to ENOMEM above that is superfluous.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7119 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:43:55 +00:00
Vladislav Bolkhovitin
a4a1e480b1 scst: take scst_mutex before calling scst_del_free_acg() in scst_proc_cleanup_module()
Take lock before a call that ends up at the lockdep_assert_held() in
scst_del_free_acg() without locking.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7118 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:42:51 +00:00
Vladislav Bolkhovitin
bbd9b42a2e scst: take scst_mutex before calling scst_del_free_acg() in exit_scst()
scst_del_free_acg() does lockdep_assert_held(&scst_mutex), so we'd better take
the lock before calling it.

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




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7117 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:41:14 +00:00
Vladislav Bolkhovitin
c0440263b0 scst_vdisk: fix memory leak in vdisk_write_proc()
Another leak valgrind popped out, this one in vdisk_write_proc().

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7116 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:39:14 +00:00
Vladislav Bolkhovitin
d1e78984c4 scst: fix memory leak in scst_proc_group_add()
Valgrind noticed that the "name" allocated in scst_proc_group_add() was
leaking.  It turns out that scst_alloc_add_acg makes its own copy of the name
passed to it from this code, making the string duplication done here redundant
(and leaky).  The change eliminates the string duplication (along with all its
associated error handling logic) and simply passes the (unowned) incoming
string down for duplication below.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7115 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:37:13 +00:00
Vladislav Bolkhovitin
f05a100fb4 scst_vdisk: logging to distinguish different cases of EINVAL
Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7114 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:19:05 +00:00
Vladislav Bolkhovitin
bcb87d57ec iscsi: logging improvements for iscsi_scstd.c
Logging improvements for iscsi_scstd.c print more information about failures.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7113 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:16:57 +00:00
Vladislav Bolkhovitin
b71fa76b5b iscsi: fix misleading error logging in config.c
This fixes four similar instances of a very misleading and confusing logging
statement, which would print a "Wrong value" that had already been corrected by
the check function.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7112 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:15:17 +00:00
Vladislav Bolkhovitin
baba3ad195 iscsi: avoid a crash in iscsi_extracheck_is_rd_thread()
Add an extra check in iscsi_extracheck_is_rd_thread() to avoid a crash when
conn->rd_task is NULL.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7111 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:12:46 +00:00
Vladislav Bolkhovitin
2331e8ec33 Thre is potential buffer overflow in iscsi_session_alloc() due to
short computation of needed string size.  Notice the "%s@%s" in the first call
to sprintf().

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7110 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:02:18 +00:00
Vladislav Bolkhovitin
aa6c6a4c2f Change memcpy() to strncpy() because the source name string is not guaranteed
to exist as valid addressable memory beyond the NULL byte.

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

with small addition to force set last byte NULL



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7109 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 22:38:38 +00:00
Vladislav Bolkhovitin
d236725cae create_and_open_dev() returns a (-errno), so the "if (iser_fd...)" check should
detect *any* negative return value as a case when fd should be set to -1.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7108 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 22:30:25 +00:00
Vladislav Bolkhovitin
a23e34fb62 The argument to sleep() would get "promoted" to an integer with value zero.
-               sleep(0.1);
+               usleep(100*1000);

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7107 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 22:04:07 +00:00
Bart Van Assche
9529f5e5b3 ib_srpt: Ensure that the BUG_ON() argument has no side effects
Reported-by: David Butterfield <dab21774@gmail.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7106 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-11 18:48:36 +00:00
Bart Van Assche
76daca5677 scst_lib.c: Fix indentation
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7105 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-08 04:43:23 +00:00
Vladislav Bolkhovitin
d91dd9b3ed Linux kernel v4.10 build fix.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7104 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-08 04:36:45 +00:00
Bart Van Assche
1bf5d439d6 scst: Coding style update related to the use of the keyword 'unsigned'
Use 'unsigned int' instead of 'unsigned' and 'unsigned long long'
instead of 'long long unsigned'.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7103 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-02 00:10:24 +00:00
Bart Van Assche
e372a0123e scst: Coding style updates related to whitespace
This patch changes whitespace only and nothing else.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7102 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-02 00:09:14 +00:00
Bart Van Assche
0bb6de9471 scst_vdisk: Avoid that LUN refresh triggers a general protection fault
Avoid that triggering LUN referesh concurrently with device deletion
triggers the following:

general protection fault: 0000 [#1]
Workqueue: events vdev_inq_changed_fn [scst_vdisk]
Call Trace:
 _raw_spin_lock_bh+0x2b/0x30
 scst_cm_update_dev+0x87/0x190 [scst]
 scst_dev_inquiry_data_changed+0xfb/0x1b0 [scst]
 vdev_inq_changed_fn+0x60/0x120 [scst_vdisk]
 process_one_work+0x14d/0x410
 worker_thread+0x66/0x460
 kthread+0xdb/0x100
 ret_from_fork+0x3f/0x70

Reported-by: Jinpu Wang <jinpu.wang@profitbricks.com>
Tested-by: Jinpu Wang <jinpu.wang@profitbricks.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7101 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-01 15:31:59 +00:00
Bart Van Assche
08f2570761 scst_copy_mgr: Warn if LUN lookup fails
It really is a bug if LUN lookup fails. 


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7100 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-27 22:36:33 +00:00
Bart Van Assche
19212e4f29 scst_copy_mgr: Avoid that scst_cm_check_access_acg() triggers a kernel warning
Avoid that the following kernel warning is triggered:

WARNING: CPU: 2 PID: 1761 at scst/src/scst_copy_mgr.c:2835 
Call Trace:
 dump_stack+0x86/0xc3
 __warn+0xc1/0xe0
 warn_slowpath_null+0x18/0x20
 scst_cm_check_access_acg+0x1c2/0x1d0 [scst]
 scst_cm_check_access+0x155/0x280 [scst]
 scst_cm_parse_id_tgt_descr+0x2e6/0x590 [scst]
 scst_cm_parse_descriptors+0x303/0xa60 [scst]
 scst_parse_descriptors+0x5b/0x130 [scst]
 scst_tgt_pre_exec+0x370/0x4a0 [scst]
 scst_process_active_cmd+0x455/0x770 [scst]
 scst_cmd_thread+0x1fb/0x690 [scst]
 kthread+0x102/0x140
 ret_from_fork+0x31/0x40



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7099 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-25 01:56:30 +00:00
Bart Van Assche
7ad87045dc scst_copy_mgr: Avoid that scst_cm_on_add_lun() triggers a kernel warning
Avoid that the following warning is triggered:

WARNING: CPU: 1 PID: 1282 at scst/src/scst_copy_mgr.c:2784 scst_cm_on_add_lun+0x141/0x1b0 [scst]
Call Trace:
 dump_stack+0x86/0xc3
 __warn+0xc1/0xe0
 warn_slowpath_null+0x18/0x20
 scst_cm_on_add_lun+0x141/0x1b0 [scst]
 scst_acg_add_lun+0x27f/0x370 [scst]
 __scst_process_luns_mgmt_store+0x589/0x5f0 [scst]
 scst_luns_mgmt_store_work_fn+0x22/0x30 [scst]
 scst_process_sysfs_works+0x7b/0x1c0 [scst]
 sysfs_work_thread_fn+0x11b/0x280 [scst]
 kthread+0x102/0x140
 ret_from_fork+0x31/0x40


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7098 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-25 01:54:58 +00:00
Bart Van Assche
95fe66fbeb scst: Fix locking annotations
Avoid that the following warnings are triggered:

WARNING: CPU: 5 PID: 32343 at scst/src/scst_copy_mgr.c:2741 scst_cm_on_add_acg+0x12d/0x180 [scst]
Call Trace:
 [<ffffffff812a4d23>] dump_stack+0x86/0xc3
 [<ffffffff8106412b>] __warn+0xcb/0xf0
 [<ffffffff8106421d>] warn_slowpath_null+0x1d/0x20
 [<ffffffffa04f9b0d>] scst_cm_on_add_acg+0x12d/0x180 [scst]
 [<ffffffffa04b8084>] scst_alloc_add_acg+0xc4/0x280 [scst]
 [<ffffffffa0486b30>] scst_register_target+0x190/0x3a0 [scst]
 [<ffffffffa054f2de>] scst_cm_init+0xb8/0xdda [scst]
 [<ffffffffa054eab9>] init_scst+0xa06/0xc3f [scst]
 [<ffffffff8100043d>] do_one_initcall+0x3d/0x160
 [<ffffffff81154ae0>] do_init_module+0x5f/0x1f1
 [<ffffffff810efa69>] load_module+0x2719/0x2a50
 [<ffffffff810effcc>] SYSC_finit_module+0xbc/0xf0
 [<ffffffff810f001e>] SyS_finit_module+0xe/0x10
 [<ffffffff8152fe40>] entry_SYSCALL_64_fastpath+0x23/0xc1

WARNING: CPU: 2 PID: 12885 at scst/src/scst_copy_mgr.c:2826 scst_cm_check_access_acg+0x180/0x1e0 [scst]
Call Trace:
 [<ffffffff812a4d23>] dump_stack+0x86/0xc3
 [<ffffffff8106412b>] __warn+0xcb/0xf0
 [<ffffffff8106421d>] warn_slowpath_null+0x1d/0x20
 [<ffffffffa0502b00>] scst_cm_check_access_acg+0x180/0x1e0 [scst]
 [<ffffffffa0502cba>] scst_cm_check_access+0x15a/0x280 [scst]
 [<ffffffffa05030cb>] scst_cm_parse_id_tgt_descr+0x2eb/0x590 [scst]
 [<ffffffffa050a1d8>] scst_cm_parse_descriptors+0x308/0xa60 [scst]
 [<ffffffffa04d4440>] scst_parse_descriptors+0x60/0x130 [scst]
 [<ffffffffa04a3c05>] scst_tgt_pre_exec+0x375/0x4a0 [scst]
 [<ffffffffa04ac2a9>] scst_process_active_cmd+0x439/0x740 [scst]
 [<ffffffffa04adbb2>] scst_cmd_thread+0x202/0x6a0 [scst]
 [<ffffffff810883cf>] kthread+0xef/0x110
 [<ffffffff8153008f>] ret_from_fork+0x1f/0x40


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7097 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-24 07:07:41 +00:00
Bart Van Assche
ab0e7cc0be scst_copy_mgr: Avoid that LUN removal triggers a BUG()
Reported-by: Jinpu Wang <jinpu.wang@profitbricks.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7096 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-24 02:08:17 +00:00
Bart Van Assche
585c5d2fe0 scst_copy_mgr: Convert comments about locking into runtime checks
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7095 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-24 02:07:29 +00:00
Bart Van Assche
2a074789ac scstadmin: Revert r7014
The immediateExit() call introduced in r7014 prevents to assign multiple
values to attributes that support multiple values, e.g. 'allowed_portal'.
Hence revert r7014.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7092 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-02-05 06:52:06 +00:00
Vladislav Bolkhovitin
5930008dba Add scstadmin in the dist archive
Reported by David Chen <david.chen@osnexus.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7091 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-01-24 00:29:41 +00:00
Bart Van Assche
4538bc1c81 scst: Fix a memory leak
Avoid that the memory allocated for struct scst_acn and its name is
leaked by scst_del_acg().


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7090 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-01-11 01:16:07 +00:00
Bart Van Assche
b51c624855 ib_srpt: Only report that SRQ creation failed if it was attempted to create an SRQ
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7089 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-01-08 21:46:20 +00:00
Bart Van Assche
3abcc849df ib_srpt: Destroy SRQ before freeing the buffers posted on the SRQ
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7088 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-01-08 21:45:39 +00:00
Bart Van Assche
db686530c9 ib_srpt: Rename a symbolic constant
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7087 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-01-08 21:10:54 +00:00
Bart Van Assche
c9b2dfa070 ib_srpt: Remove a local variable
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7086 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-01-08 21:10:32 +00:00
Bart Van Assche
81fd215772 isert-scst: Follow-up for r7084
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7085 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-27 20:42:22 +00:00
Bart Van Assche
9cbe881f2f isert-scst: Fix CentOS 7.3 build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7084 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-27 20:26:11 +00:00
Bart Van Assche
db36d29932 isert-scst: Rename SCST_DIR into SCST_SYMVERS_DIR
Additionally, align shell code.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7083 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-27 20:25:13 +00:00
Bart Van Assche
db5426169b ib_srpt: Improve portability
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7082 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-27 20:23:31 +00:00
Bart Van Assche
6912463c2e ib_srpt: Fix nightly build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7081 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-27 20:21:53 +00:00
Vladislav Bolkhovitin
a24bf679b8 Cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7080 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-22 03:07:19 +00:00
Vladislav Bolkhovitin
e57c13a0e8 Web updates
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7079 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-21 03:42:30 +00:00
Vladislav Bolkhovitin
bdfc767077 scst: document nolockdep patches
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7078 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-21 03:39:24 +00:00
Vladislav Bolkhovitin
5e73767a1b scst: minor forwarding mode fixes
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7077 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:28:41 +00:00
Vladislav Bolkhovitin
283b30f603 scst: add thread_index sysfs attribute
This attribute exports per LUN thread index assigned by
scst_add_threads(). It can be used to look up which export thread is
serving which target since this index also appears in the export thread
name. This information then could be used to set CPU affinity for those threads to improve performance.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7076 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:27:38 +00:00
Vladislav Bolkhovitin
bdb23b8923 scst: performance improvements
This patch trying to allocate memory in per-NUMA and per-CPU manner to
(significantly) improve performance for high IOPS cases.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7075 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:21:13 +00:00
Vladislav Bolkhovitin
807836950b scst: improve latency statistics
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7074 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:17:11 +00:00
Vladislav Bolkhovitin
2475def30d scst: add max_tgt_dev_commands sysfs attribute
This per-device attribute allows to control maximum number of SCSI
commands any session to this device can have in flight. It makes
currently hardcoded constant be run time configurable.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7073 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:14:55 +00:00
Vladislav Bolkhovitin
42459a6725 scst: add ACA support
ACA (Auto Contingent Allegiance) is a way to handle CHECK CONDITION
status. It significantly improves performance of AIX systems.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7072 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:10:56 +00:00
Vladislav Bolkhovitin
4e1dc1b526 scst: improve thin provisioning support
This patch adds gen_tp_soft_threshold_reached_UA attribute for thin
provisioned devices that allows to generate THIN PROVISIONING SOFT
THRESHOLD REACHED Unit Attention.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7071 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:07:55 +00:00
Vladislav Bolkhovitin
5040dd22a4 iscsi-scst: document thread_pid attribute
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7070 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:01:34 +00:00
Vladislav Bolkhovitin
c9b301bf39 iscsi-scst: add per_sess_dedicated_tgt_threads attribute in ini groups
If this attrubute is set, each iSCSI session for this initiator has
dedicated, i.e. not shared with other sessions, pool of the iscsi{wr,rd}
kernel threads.

Useful to control per-session CPU affinity to improve performance.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7069 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-12-20 06:00:43 +00:00