Commit Graph

4768 Commits

Author SHA1 Message Date
Bart Van Assche
b71ab710d8 scst_tg: Convert dynamic into static initialization
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-06 14:57:13 +02:00
Bart Van Assche
947bdc3227 scst_sysfs: Remove dead code
Detected by Coverity.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-06 14:57:13 +02:00
Bart Van Assche
631ad2560b scst_targ: Remove dead code
Detected by Coverity.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-06 14:57:13 +02:00
Bart Van Assche
af94d2ce4f scst: Fix a race between scst_del_threads() and the sysfs API
kthread_stop() not only stops a thread but also frees the associated
task struct. Avoid that functions that iterate over the thread list
can encounter an invalid task structure pointer. This patch fixes the
following kernel crash:

general protection fault: 0000 [#2] PREEMPT SMP
RIP: 0010:[<ffffffff81080e9c>]  [<ffffffff81080e9c>] __task_pid_nr_ns+0x9c/0x1b0
Call Trace:
[<ffffffffa045ed7d>] task_pid_vnr+0xd/0x10 [scst]
[<ffffffffa0460418>] scst_tgt_dev_thread_pid_show+0x78/0xd0 [scst]
[<ffffffffa045929f>] scst_show+0xf/0x20 [scst]
[<ffffffff81231acb>] sysfs_kf_seq_show+0xab/0x130
[<ffffffff81230176>] kernfs_seq_show+0x26/0x30
[<ffffffff811daf10>] seq_read+0xe0/0x3e0
[<ffffffff81230ab5>] kernfs_fop_read+0x125/0x180
[<ffffffff811b0138>] __vfs_read+0x28/0xe0
[<ffffffff811b07ca>] vfs_read+0x8a/0x140
[<ffffffff811b1669>] SyS_read+0x49/0xb0
[<ffffffff814ffd32>] system_call_fastpath+0x16/0x7a

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-06 13:56:52 +02:00
Bart Van Assche
38cd0a345d scst, T10-PI: Kernel 2.6.30 build fix
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-06 08:26:15 +02:00
Bart Van Assche
cb823d4d66 Merge branch 'svn-trunk' into master 2015-05-06 08:25:45 +02:00
Vladislav Bolkhovitin
e719f0eca5 ib_srpt: cleanup fixed
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6203 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-06 02:05:54 +00:00
Vladislav Bolkhovitin
627f79738f Fix proc build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6202 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-06 01:02:04 +00:00
Vladislav Bolkhovitin
9b66034f3f T10-PI documentation
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6201 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-06 00:49:13 +00:00
Vladislav Bolkhovitin
2a5679df53 T10-PI clarifications
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6200 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-06 00:48:42 +00:00
Vladislav Bolkhovitin
e919c5bb20 Cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6199 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-06 00:47:22 +00:00
Bart Van Assche
9fcfc5ff90 qla2xxx: Declare local symbols 'static'
Additionally, remove unused code. Detected by sparse.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-05 11:46:10 +02:00
Bart Van Assche
7e4d8fb1dd scst_targ: Kernel 2.6.36 build fix
See also patch "scst: Rework sess_tgt_dev_list locking" (commit
ID 5af7d9277d).

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-05 11:46:10 +02:00
Bart Van Assche
168e81c523 scst_targ: Fix a debug statement
See also patch "Merge t10-pi branch back" (commit ID 906f4dfefb).

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-05 09:23:03 +02:00
Bart Van Assche
f835be1355 scst_sysfs: Do not suspend I/O for LUN management
The previous patches make it safe to remove a LUN from
sess_tgt_dev_list while I/O is in progress. Hence this patch
that allows LUN management without suspending I/O.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 10:51:09 +02:00
Bart Van Assche
7af292fa68 scst: Introduce scst_acg_repl_lun()
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 10:51:09 +02:00
Bart Van Assche
7ac6a64fa8 scst_lib: Move more functionality into scst_del_acg_dev()
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 10:50:52 +02:00
Bart Van Assche
691daf7c04 scst_sysfs: Rework __scst_process_luns_mgmt_store()
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 10:49:24 +02:00
Bart Van Assche
7d1926f773 scst_lib: Introduce scst_del_tgt_dev()
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 10:49:20 +02:00
Bart Van Assche
5af7d9277d scst: Rework sess_tgt_dev_list locking
Protect modifications of sess_tgt_dev_list with the new mutex
tgt_dev_list_mutex. Protect read-only accesses of this list via
RCU. Do no longer lock scst_mutex when invoking any of the
following functions:
* scst_queue_report_luns_changed_UA().
* scst_report_luns_changed_sess().
* scst_lookup_tgt_dev() when invoked outside of command context.
* scst_nexus_loss().
* scst_do_nexus_loss_sess().
* scst_abort_all_nexus_loss_sess().
* scst_do_nexus_loss_tgt().

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 10:49:20 +02:00
Bart Van Assche
d22ba32ea1 scst: Avoid that a high I/O load prevents activity to be suspended
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 08:35:06 +02:00
Bart Van Assche
ec5e922002 scst_targ: Add more debug code in scst_unblock_aborted_cmds()
Use lockdep to verify that the caller holds scst_mutex if the
scst_mutex_held argument has not been set.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 07:12:54 +02:00
Bart Van Assche
8cf0fcbe86 scst_lib: Fix a use-after-free in an error path
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 07:12:37 +02:00
Bart Van Assche
63961f14aa scst_vdisk: Fix proc build
See also "Merge T10-PI branch back" (commit ID 906f4dfefb).

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-04 07:11:21 +02:00
Bart Van Assche
018df6aeca dev_handlers: Report invalid block sizes
If while attaching a pass-through device the READ CAPACITY command
reports an invalid sector size, log an error message.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 20:59:46 +02:00
Bart Van Assche
80ee34c059 scst_vdisk: Remove several superfluous casts
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 20:59:38 +02:00
Bart Van Assche
4177648d92 isert: Declare a local function static
Detected by checkpatch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 20:59:37 +02:00
Bart Van Assche
7abae677f1 iscsi-scst: Surround complex values with parentheses
Detected by checkpatch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 20:59:36 +02:00
Bart Van Assche
8108c2c3cb scst.h: Use tabs for indentation
Reported by checkpatch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 20:59:17 +02:00
Bart Van Assche
5be9e4ed4b scst_proc: Fix indentation level inconsistencies
Detected by smatch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 19:09:46 +02:00
Bart Van Assche
7be6652ea4 scst_user: Fix indentation
Detected by smatch.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 19:09:45 +02:00
Bart Van Assche
e392bcad89 scst_lib: WRITE SAME performance improvement fix
Fix the argument of the second kunmap() call. Detected by smatch.
See also patch "scst_lib: Improve WRITE SAME performance" (commit
ID a15628d683). Note: this patch does not have any impact on
64-bit architectures since kunmap() doesn't to anything on such
architectures.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-03 19:09:28 +02:00
Bart Van Assche
1c71987ad6 Merge branch 'svn-iser'
Conflicts:
	Makefile
	fcst/Makefile
	iscsi-scst/Makefile
	iscsi-scst/include/iscsi_scst.h
	iscsi-scst/include/iscsi_scst_ver.h
	iscsi-scst/kernel/Makefile
	iscsi-scst/kernel/config.c
	iscsi-scst/kernel/conn.c
	iscsi-scst/kernel/digest.c
	iscsi-scst/kernel/digest.h
	iscsi-scst/kernel/event.c
	iscsi-scst/kernel/iscsi.c
	iscsi-scst/kernel/iscsi.h
	iscsi-scst/kernel/iscsi_dbg.h
	iscsi-scst/kernel/iscsi_hdr.h
	iscsi-scst/kernel/nthread.c
	iscsi-scst/kernel/param.c
	iscsi-scst/kernel/session.c
	iscsi-scst/kernel/target.c
	iscsi-scst/usr/Makefile
	iscsi-scst/usr/chap.c
	iscsi-scst/usr/config.c
	iscsi-scst/usr/conn.c
	iscsi-scst/usr/ctldev.c
	iscsi-scst/usr/event.c
	iscsi-scst/usr/iscsi_adm.c
	iscsi-scst/usr/iscsi_adm.h
	iscsi-scst/usr/iscsi_hdr.h
	iscsi-scst/usr/iscsi_scstd.c
	iscsi-scst/usr/iscsid.c
	iscsi-scst/usr/iscsid.h
	iscsi-scst/usr/isns.c
	iscsi-scst/usr/isns_proto.h
	iscsi-scst/usr/log.c
	iscsi-scst/usr/message.c
	iscsi-scst/usr/misc.c
	iscsi-scst/usr/misc.h
	iscsi-scst/usr/param.c
	iscsi-scst/usr/param.h
	iscsi-scst/usr/session.c
	iscsi-scst/usr/target.c
	iscsi-scst/usr/types.h
	nightly/conf/nightly.conf
	qla2x00t/qla2x00-target/Makefile
	qla2x00t/qla2x00-target/README
	qla2x00t/qla2x00-target/qla2x00t.c
	qla2x00t/qla2x00-target/qla2x00t.h
	qla2x00t/qla2x_tgt.h
	qla2x00t/qla2x_tgt_def.h
	qla2x00t/qla_attr.c
	qla2x00t/qla_init.c
	qla2x00t/qla_inline.h
	qla2x00t/qla_isr.c
	qla2x00t/qla_mbx.c
	qla2x00t/qla_os.c
	scripts/generate-release-archive
	scripts/rebuild-rhel-kernel-rpm
	scripts/run-regression-tests
	scst.spec.in
	scst/Makefile
	scst/README
	scst/README_in-tree
	scst/include/scst.h
	scst/include/scst_const.h
	scst/include/scst_debug.h
	scst/include/scst_sgv.h
	scst/include/scst_user.h
	scst/src/Makefile
	scst/src/dev_handlers/Makefile
	scst/src/dev_handlers/scst_cdrom.c
	scst/src/dev_handlers/scst_changer.c
	scst/src/dev_handlers/scst_disk.c
	scst/src/dev_handlers/scst_modisk.c
	scst/src/dev_handlers/scst_processor.c
	scst/src/dev_handlers/scst_raid.c
	scst/src/dev_handlers/scst_tape.c
	scst/src/dev_handlers/scst_user.c
	scst/src/dev_handlers/scst_vdisk.c
	scst/src/scst_debug.c
	scst/src/scst_lib.c
	scst/src/scst_main.c
	scst/src/scst_mem.c
	scst/src/scst_mem.h
	scst/src/scst_module.c
	scst/src/scst_pres.c
	scst/src/scst_pres.h
	scst/src/scst_priv.h
	scst/src/scst_proc.c
	scst/src/scst_sysfs.c
	scst/src/scst_targ.c
	scst/src/scst_tg.c
	scst_local/scst_local.c
	srpt/Makefile
	srpt/README
	srpt/README.ofed
	srpt/conftest/gid_change/Makefile
	srpt/src/ib_srpt.c
	srpt/src/ib_srpt.h
	usr/fileio/Makefile
	usr/fileio/common.c
	usr/fileio/common.h
	usr/fileio/debug.c
	usr/fileio/debug.h
	usr/fileio/fileio.c
	www/comparison.html
	www/contributing.html
	www/downloads.html
	www/handler_fileio_tgt.html
	www/index.html
	www/mc_s.html
	www/scst_admin.html
	www/scstvslio.html
	www/scstvsstgt.html
	www/solutions.html
	www/target_emulex.html
	www/target_fcoe.html
	www/target_ibmvscsi.html
	www/target_iscsi.html
	www/target_local.html
	www/target_lsi.html
	www/target_mvsas.html
	www/target_old.html
	www/target_qla2x00t.html
	www/target_srp.html
	www/targets.html
	www/users.html
2015-05-03 19:07:39 +02:00
Bart Van Assche
b08c870ad2 Merge branch 'svn-trunk' (r6198)
Conflicts:
	scst/src/dev_handlers/scst_disk.c
	scst/src/scst_lib.c
2015-05-02 07:56:59 +02:00
Bart Van Assche
d3a4387b6d qla2x00t: Update how-to with instructions for 16 Gb HBA
Add instructions for how to download and install the 16 Gb/s FC HBA
driver. Remove the "optional step" since this step should not be
needed after various recent fixes in the SCST makefiles. Recommend
to blacklist the distro QLA initiator driver even if the kernel is
not being rebuilt.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-02 07:38:08 +02:00
Bart Van Assche
0a6cb6e531 iscsi-scst/README: Update
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-02 07:38:08 +02:00
Vladislav Bolkhovitin
c9de099c74 Cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6198 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-02 01:13:08 +00:00
Vladislav Bolkhovitin
1ecb7f1fe3 qla2x00t: Fix source code indentation
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6197 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-02 01:08:25 +00:00
Vladislav Bolkhovitin
80be46ae7b scst_targ: Avoid incorrect block size changes
The scst_block_generic_dev_done() function parses the READ CAPACITY
response without checking whether the response buffer has been
initialized. This can lead to incorrect block size changes and also
to the following kernel warning:

WARNING: at scst/src/scst_lib.c:7353 scst_calc_block_shift+0x7f/0xb0 [scst]()
1 << 23 != 12595456
 [<ffffffff816071e3>] dump_stack+0x19/0x1b
 [<ffffffff8106e23d>] warn_slowpath_common+0x7d/0xc0
 [<ffffffff8106e336>] warn_slowpath_fmt+0x46/0x50
 [<ffffffffa0712e2f>] scst_calc_block_shift+0x7f/0xb0 [scst]
 [<ffffffffa072dbd7>] scst_block_generic_dev_done.part.39+0x6a/0x7d [scst]
 [<ffffffffa07162a4>] scst_block_generic_dev_done+0x34/0x40 [scst]
 [<ffffffffa0066205>] dev_user_disk_done+0x15/0x20 [scst_user]
 [<ffffffffa070c119>] scst_dev_done+0x49/0x150 [scst]
 [<ffffffffa070e1a0>] scst_process_active_cmd+0x240/0x390 [scst]
 [<ffffffffa070e7e1>] scst_process_redirect_cmd+0x121/0x1e0 [scst]
 [<ffffffffa070e916>] scst_cmd_done_local+0x76/0x120 [scst]
 [<ffffffffa006843a>] dev_user_process_reply_exec+0x8a/0x370 [scst_user]
 [<ffffffffa00699e2>] dev_user_process_reply+0x242/0x2e0 [scst_user]
 [<ffffffffa0069b80>] dev_user_reply_get_cmd.isra.17+0x100/0x2d0 [scst_user]
 [<ffffffffa0069ea7>] dev_user_ioctl+0x157/0x428 [scst_user]
 [<ffffffff811d999a>] do_vfs_ioctl+0x7a/0x2e0
 [<ffffffff811d9c91>] SyS_ioctl+0x91/0xb0
 [<ffffffff8161b269>] system_call_fastpath+0x16/0x1b

Avoid this by additionally checking cmd->completed

Reported-by: Gal Rosen <galr@storone.com>
Reported-by: Abacus Liang <abacusl@hotmail.com>
Reported-by: Shahar Salzman <shahar.salzman@kaminario.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6196 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-02 01:01:15 +00:00
Vladislav Bolkhovitin
734bd675bd Cleanup
Since SAM_STAT_GOOD is 0, it does not change any functionality



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6195 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-02 00:11:22 +00:00
Vladislav Bolkhovitin
a3f8a4eff1 scst: Log a warning if the block size is modified
A block size change is an important change so log such changes.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6194 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-01 23:52:51 +00:00
Vladislav Bolkhovitin
b59ce01ead Decrease time cpu_cmd_counter is held taken for suspending case for debug
mode to minimize race window described in
http://sourceforge.net/p/scst/mailman/message/34074831/



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6193 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-01 23:49:20 +00:00
Bart Van Assche
6bd70c1b5f Restore "scst: Fix WRITE SAME parsing"
This reverts commit d36f821c9d.

Conflicts:
	scst/src/dev_handlers/scst_vdisk.c
	scst/src/scst_lib.c
2015-05-01 08:32:39 +02:00
Bart Van Assche
4f445f4c33 Merge branch 'svn-trunk' r6192
Conflicts:
	scst/include/scst.h
	scst/src/dev_handlers/scst_vdisk.c
2015-05-01 08:15:50 +02:00
Bart Van Assche
d36f821c9d Revert "scst: Fix WRITE SAME parsing" to make the next merge easier
This reverts commit bf9d2668a5.
2015-05-01 08:13:10 +02:00
Bart Van Assche
b493c5b8f6 Merge branch 'svn-trunk' (r6189)
Conflicts:
	iscsi-scst/kernel/nthread.c
	qla2x00t/qla_iocb.c
	scst/src/scst_lib.c
	www/target_emulex.html
2015-05-01 08:07:43 +02:00
Bart Van Assche
48b8f91547 scripts/generate-kernel-patch: Add support for kernel versions >= 4.0.1
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-05-01 07:56:57 +02:00
Vladislav Bolkhovitin
906f4dfefb Merge t10-pi branch back
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6192 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-01 04:21:56 +00:00
Vladislav Bolkhovitin
0b4fe40d3e scst_lib: Improve WRITE SAME performance
Some storage devices have a block size of 512 bytes and a minimum
I/O size and/or optimal I/O size of 4096 bytes. Improve WRITE SAME
performance for such devices by increasing the I/O granularity from
512 bytes to 4096 bytes.

Based on a patch written by Vishal Tripathi <vishal.tripathi@calsoftinc.com>
and Sushil Sharma <sushil.sharma@calsoftinc.com>.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>

+ with some minor changes



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6189 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-05-01 02:04:39 +00:00
Bart Van Assche
39e51c048e scst_lib: Make a debug statement more informative 2015-04-30 09:01:31 +02:00