Commit Graph

167 Commits

Author SHA1 Message Date
Vladislav Bolkhovitin
1e4010ce25 Cleanup
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5082 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-10-31 03:48:59 +00:00
Bart Van Assche
dad77aead4 nightly build: Add kernel 3.11 build infrastructure
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5006 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-09-28 16:04:47 +00:00
Bart Van Assche
89e96c6495 nightly build: Add kernel 3.10 support infrastructure
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4919 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-07-22 18:35:37 +00:00
Vladislav Bolkhovitin
29ff2f8c23 Cleanup: spin_is_locked() makes no sense on UP systems
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-28 03:59:57 +00:00
Bart Van Assche
11fdb1bf29 nightly build: Add kernel 3.9 build infrastructure
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4855 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-18 16:04:24 +00:00
Vladislav Bolkhovitin
0339bb8905 This change causes "make -C <dir> clean" to work. Also, use SUBDIRS=...
instead of M=... because of consistency with the rest of the Makefile.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4829 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-29 01:19:24 +00:00
Vladislav Bolkhovitin
e4fb5201e9 RHEL 5 does not support queue_flag_set_unlocked(). Hence disable the
queue_flag_set_unlocked() call on RHEL 5.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4828 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-29 01:18:09 +00:00
Vladislav Bolkhovitin
2cadcc2c64 Cache alignment review
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4809 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-23 01:38:31 +00:00
Vladislav Bolkhovitin
82d055041c Improve automatic queue depth adjustment in scst_local for older kernels
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4800 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-16 02:02:55 +00:00
Vladislav Bolkhovitin
3a84cb7baf Automatic queue depth adjustment in scst_local
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4798 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-16 01:10:43 +00:00
Vladislav Bolkhovitin
369863f015 Allow install SCST in any location
Currently the install location of SCST is pretty much hard coded into 
the Makefiles to be /usr/local.

I am custom building a system for ZFS & SCST and I want to install in 
/usr instead of /usr/local.

Currently I am doing a “find . -name Makefile -exec sed -i 's:/usr/local:/usr:g'
{} \;” to accommodate this.

This patch fixes it.

From Sietse van Zanen <sietse@wizdom.nu>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4791 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-08 21:25:45 +00:00
Vladislav Bolkhovitin
b9c0b9d92d Another micro-optimization: cache align all fast path structures
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4785 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-03-04 23:51:16 +00:00
Bart Van Assche
52f0d63ee6 nightly build: Add kernel 3.8 support files
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4769 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-02-23 13:47:51 +00:00
Vladislav Bolkhovitin
10ca1d2f20 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4767 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-02-20 02:05:29 +00:00
Vladislav Bolkhovitin
bd7c893f04 Multiple makefiles: autodetect SCST include directory
It is cumbersome to change SCST_INC_DIR and SCST_DIR in each Makefile
before and after a release. Hence modify the Makefiles such that these
paths are detected automatically.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4740 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-01-16 00:12:38 +00:00
Vladislav Bolkhovitin
c6d247254c scst_local: Remove a superfluous include path
Target drivers must not include header files from the SCST source
code directory. Hence remove -I$(SCST_DIR) from the compiler flags.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4739 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-01-16 00:08:44 +00:00
Vladislav Bolkhovitin
e7e9101efd Automate release archive generation
This patch makes it easier to generate the release archives that
can be downloaded from http://scst.sourceforge.net/downloads.html.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4679 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-01-04 00:29:30 +00:00
Vladislav Bolkhovitin
1f600fcc91 scst_local: Fix bug in error path
device_unregister() invokes scst_local_release_adapter() and hence unregisters
the session. Avoid that it is attempted a second time to unregister the
session which would result in a crash.

[3656]: scst: scst_unregister_target:680:Target local for template scst_local unregistered successfully
[3656]: scst: scst_unregister_target_template:457:Target template scst_local unregistered successfully
[3655]: scst_unregister_session:6795:Unregistering session ffff8800071a0000 (wait 0)
general protection fault: 0000 [#1] SMP
Modules linked in: iscsi_scst(O) scst_vdisk(O) scst(O) ntfs vfat msdos fat ext3 jbd ext2 brd netconsole configfs isofs ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi joydev hid_generic binfmt_misc usbhid hid intel_agp psmouse intel_gtt processor agpgart microcode i2c_piix4 button lp parport ext4 mbcache jbd2 floppy ata_piix zlib_deflate libcrc32c [last unloaded: scst_local]
CPU 1
Pid: 3655, comm: scsi_id Tainted: G           O 3.6.5-debug+ #1 Bochs Bochs
RIP: 0010:[<ffffffffa0221a74>]  [<ffffffffa0221a74>] scst_pre_rx_mgmt_cmd+0x64/0x210 [scst]
RSP: 0018:ffff88000304d598  EFLAGS: 00010246
RAX: 6b6b6b6b6b6b6b6b RBX: 0000000000000001 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 000000000000000a RDI: ffff8800071a0000
RBP: ffff88000304d5c8 R08: 0000000000000002 R09: 0000000000000000
R10: 000000000000c81d R11: 0000000000000000 R12: ffff8800071a0000
R13: 000000000000000a R14: 0000000000000000 R15: ffff880000000000
FS:  00007fb6fe8c6700(0000) GS:ffff88003e000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f2169286bd0 CR3: 000000001cd26000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process scsi_id (pid: 3655, threadinfo ffff88000304c000, task ffff88003d9a0000)
Stack:
 0000000000000000 0000000000000282 ffff88000304d650 0000000000000000
 ffff8800071a0000 dead4ead00000000 ffff88000304d638 ffffffffa0221fdf
 0000000000000004 0000000000000000 ffff88000304d5f8 ffffffffa025d6a3
Call Trace:
 [<ffffffffa0221fdf>] scst_rx_mgmt_fn+0x7f/0x3a0 [scst]
 [<ffffffffa025d6a3>] ? spin_unlock_irqrestore.constprop.0+0x13/0x20 [scst]
 [<ffffffffa025d825>] ? debug_print_with_prefix+0x165/0x1f0 [scst]
 [<ffffffffa022acaa>] scst_rx_mgmt_fn_lun.constprop.34+0x4a/0x60 [scst]
 [<ffffffffa022adf1>] scst_unregister_session+0x131/0x320 [scst]
 [<ffffffff812bfce7>] ? device_release+0x27/0xa0
 [<ffffffff8120450b>] ? kobject_release+0x8b/0x1d0
 [<ffffffff8120438c>] ? kobject_put+0x2c/0x60
 [<ffffffff812bfa97>] ? put_device+0x17/0x20
 [<ffffffff812de820>] ? scsi_host_dev_release+0xc0/0xe0
 [<ffffffff812bfce7>] ? device_release+0x27/0xa0
 [<ffffffff8120450b>] ? kobject_release+0x8b/0x1d0
 [<ffffffff8120438c>] ? kobject_put+0x2c/0x60
 [<ffffffff812bfa97>] ? put_device+0x17/0x20
 [<ffffffff812e7102>] ? scsi_target_dev_release+0x22/0x30
 [<ffffffff812bfce7>] ? device_release+0x27/0xa0
 [<ffffffff8120450b>] ? kobject_release+0x8b/0x1d0
 [<ffffffff8120438c>] ? kobject_put+0x2c/0x60
 [<ffffffff812bfa97>] ? put_device+0x17/0x20
 [<ffffffff812ea858>] ? scsi_device_dev_release_usercontext+0x108/0x120
 [<ffffffff812ea750>] ? scsi_device_cls_release+0x20/0x20
 [<ffffffff8105a996>] ? execute_in_process_context+0x86/0xa0
 [<ffffffff812ea72c>] ? scsi_device_dev_release+0x1c/0x20
 [<ffffffff812bfce7>] ? device_release+0x27/0xa0
 [<ffffffff8120450b>] ? kobject_release+0x8b/0x1d0
 [<ffffffff8120438c>] ? kobject_put+0x2c/0x60
 [<ffffffff812bfa97>] ? put_device+0x17/0x20
 [<ffffffff812dc534>] ? scsi_device_put+0x44/0x60
 [<ffffffff812f685d>] ? scsi_cd_put+0x4d/0x70
 [<ffffffff812f69b0>] ? sr_block_open+0xd0/0x120
 [<ffffffff81184389>] ? __blkdev_get+0xe9/0x4a0
 [<ffffffff81183bb4>] ? bd_acquire+0x24/0xf0
 [<ffffffff81184a90>] ? blkdev_get+0x350/0x350
 [<ffffffff81184793>] ? blkdev_get+0x53/0x350
 [<ffffffff81156a72>] ? complete_walk+0x52/0x140
 [<ffffffff81184a90>] ? blkdev_get+0x350/0x350
 [<ffffffff814ac49b>] ? _raw_spin_unlock+0x2b/0x50
 [<ffffffff81184a90>] ? blkdev_get+0x350/0x350
 [<ffffffff81184afc>] ? blkdev_open+0x6c/0x90
 [<ffffffff81148fb6>] ? do_dentry_open.isra.19+0x216/0x2a0
 [<ffffffff81149062>] ? finish_open+0x22/0x40
 [<ffffffff8115a62e>] ? do_last+0x72e/0xe20
 [<ffffffff811572d8>] ? inode_permission+0x18/0x50
 [<ffffffff8115737b>] ? link_path_walk+0x6b/0x930
 [<ffffffff8115add6>] ? path_openat+0xb6/0x4a0
 [<ffffffff81097c9d>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff8115b5d2>] ? do_filp_open+0x42/0xa0
 [<ffffffff814ac49b>] ? _raw_spin_unlock+0x2b/0x50
 [<ffffffff81168802>] ? alloc_fd+0xd2/0x120
 [<ffffffff8114a150>] ? do_sys_open+0x100/0x1e0
 [<ffffffff8114a251>] ? sys_open+0x21/0x30
 [<ffffffff814b5029>] ? system_call_fastpath+0x16/0x1b
Code: 00 00 65 48 8b 04 25 80 ba 00 00 8b b0 94 01 00 00 48 c7 c2 a0 b8 26 a0 31 c0 48 c7 c7 45 e0 27 a0 e8 23 15 28 e1 49 8b 44 24 08 <48> 8b 40 30 48 83 78 50 00 0f 84 52 01 00 00 83 fb 01 19 ff 81

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4658 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-12-20 02:32:25 +00:00
Bart Van Assche
12313bf114 nightly build: Add kernel 3.7 patches
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4647 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-12-18 08:54:50 +00:00
Vladislav Bolkhovitin
010dd8b7ec scst_local: Rework scst_local_get_initiator_port_transport_id() to make it easier to read and to verify
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4636 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-29 01:29:49 +00:00
Vladislav Bolkhovitin
486a3bcd34 scst_local: Remove superfluous casts
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4635 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-29 01:25:59 +00:00
Bart Van Assche
a88ccc6231 scst_local, RHEL 5: Avoid that AEN handling triggers a deadlock during device removal
Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4613 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-11-12 12:37:19 +00:00
Vladislav Bolkhovitin
fab0164c55 scst_local: Avoid deadlock during module removal with kernel 3.6
Since kernel 3.6 a SYNCHRONIZE CACHE command is sent to SCSI disks
during the scsi_remove_host() call. That command is sent after command
processing has been suspended in SCST and hence causes a deadlock.
Avoid this deadlock by failing all commands issued after
scst_unregister_target() has been invoked.

The output of echo w >/proc/sysrq-trigger just after module removal of
scst_local started is as follows:

SysRq : Show Blocked State
  task                        PC stack   pid father
kworker/2:1     D ffff88003d08cf40     0    37      2 0x00000000
 ffff88003d0bd830 0000000000000046 ffffffff814a849e ffff88003d08cf40
 ffff88003d08cf40 ffff88003d0bdfd8 ffff88003d0bdfd8 ffff88003d0bdfd8
 ffff88003d9a3b70 ffff88003d08cf40 0000000000000282 ffff88003d0bd860
Call Trace:
 [<ffffffff814a849e>] ? schedule_timeout+0x12e/0x230
 [<ffffffff814aabc9>] schedule+0x29/0x70
 [<ffffffff814a84a3>] schedule_timeout+0x133/0x230
 [<ffffffff8104cc00>] ? __internal_add_timer+0x140/0x140
 [<ffffffff814aaa72>] wait_for_common+0x122/0x170
 [<ffffffff81074050>] ? try_to_wake_up+0x2c0/0x2c0
 [<ffffffff814aab73>] wait_for_completion_timeout+0x13/0x20
 [<ffffffff811edc2b>] blk_execute_rq+0x17b/0x200
 [<ffffffff814aa993>] ? wait_for_common+0x43/0x170
 [<ffffffff81180a51>] ? bio_phys_segments+0x21/0x30
 [<ffffffff811e8cf0>] ? blk_rq_bio_prep+0x30/0xb0
 [<ffffffff812e46ee>] scsi_execute+0xee/0x180
 [<ffffffff812e58ed>] scsi_execute_req+0xbd/0x130
 [<ffffffff812f55c0>] sr_check_events+0xc0/0x2d0
 [<ffffffff81076218>] ? sched_clock_cpu+0xa8/0x110
 [<ffffffff8131e1cc>] cdrom_check_events+0x1c/0x40
 [<ffffffff812f5a39>] sr_block_check_events+0x19/0x20
 [<ffffffff811f0e32>] disk_events_workfn+0x62/0x160
 [<ffffffff8105affe>] process_one_work+0x1ae/0x620
 [<ffffffff8105af9d>] ? process_one_work+0x14d/0x620
 [<ffffffff811f0dd0>] ? __disk_unblock_events+0x130/0x130
 [<ffffffff8105ce97>] worker_thread+0x187/0x4e0
 [<ffffffff8105cd10>] ? manage_workers+0x320/0x320
 [<ffffffff81062a07>] kthread+0xb7/0xc0
 [<ffffffff81097b35>] ? trace_hardirqs_on_caller+0x105/0x190
 [<ffffffff814b5d04>] kernel_thread_helper+0x4/0x10
 [<ffffffff814ac870>] ? retint_restore_args+0x13/0x13
 [<ffffffff81062950>] ? flush_kthread_work+0x1e0/0x1e0
 [<ffffffff814b5d00>] ? gs_change+0x13/0x13
rmmod           D ffff88001d46a7a0     0 10456  10437 0x00000004
 ffff8800393cd7a8 0000000000000046 ffffffff814a849e ffff88001d46a7a0
 ffff88001d46a7a0 ffff8800393cdfd8 ffff8800393cdfd8 ffff8800393cdfd8
 ffffffff81a13420 ffff88001d46a7a0 0000000000000282 ffff8800393cd7d8
Call Trace:
 [<ffffffff814a849e>] ? schedule_timeout+0x12e/0x230
 [<ffffffff814aabc9>] schedule+0x29/0x70
 [<ffffffff814a84a3>] schedule_timeout+0x133/0x230
 [<ffffffff8104cc00>] ? __internal_add_timer+0x140/0x140
 [<ffffffff814aaa72>] wait_for_common+0x122/0x170
 [<ffffffff81074050>] ? try_to_wake_up+0x2c0/0x2c0
 [<ffffffff814aab73>] wait_for_completion_timeout+0x13/0x20
 [<ffffffff811edc2b>] blk_execute_rq+0x17b/0x200
 [<ffffffff814aa993>] ? wait_for_common+0x43/0x170
 [<ffffffff81063000>] ? __init_waitqueue_head+0x60/0x60
 [<ffffffff812e46ee>] scsi_execute+0xee/0x180
 [<ffffffff812e58ed>] scsi_execute_req+0xbd/0x130
 [<ffffffff812f07a8>] sd_sync_cache+0x98/0x120
 [<ffffffff812f0a40>] sd_shutdown+0xd0/0x150
 [<ffffffff812f0b3c>] sd_remove+0x7c/0xc0
 [<ffffffff812c3e6c>] __device_release_driver+0x7c/0xf0
 [<ffffffff812c3f0e>] device_release_driver+0x2e/0x40
 [<ffffffff812c380f>] bus_remove_device+0xff/0x170
 [<ffffffff812c099d>] device_del+0x12d/0x1c0
 [<ffffffff812eae1d>] __scsi_remove_device+0x10d/0x120
 [<ffffffff812e97ef>] scsi_forget_host+0x6f/0x80
 [<ffffffff812deb8a>] scsi_remove_host+0x7a/0x130
 [<ffffffffa0287bea>] scst_local_driver_remove+0x5a/0x120 [scst_local]
 [<ffffffff812c3e6c>] __device_release_driver+0x7c/0xf0
 [<ffffffff812c3f0e>] device_release_driver+0x2e/0x40
 [<ffffffff812c380f>] bus_remove_device+0xff/0x170
 [<ffffffff812c099d>] device_del+0x12d/0x1c0
 [<ffffffffa028ae21>] ? scst_local_exit+0x6b/0x24a [scst_local]
 [<ffffffff812c0a52>] device_unregister+0x22/0x60
 [<ffffffffa0287649>] scst_local_remove_adapter+0x59/0xd0 [scst_local]
 [<ffffffffa02880ab>] __scst_local_remove_target+0x7b/0x130 [scst_local]
 [<ffffffffa028ae3a>] scst_local_exit+0x84/0x24a [scst_local]
 [<ffffffff810a2d26>] sys_delete_module+0x1a6/0x2b0
 [<ffffffff814ac855>] ? retint_swapgs+0x13/0x1b
 [<ffffffff8120ebfe>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff814b4b29>] system_call_fastpath+0x16/0x1b

Signed-off-by: Bart Van Assche <bvanassche@acm.org>




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4566 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-10-23 01:08:47 +00:00
Bart Van Assche
b2567396f8 nightly build: Add kernel 3.6 support patches
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4539 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-10-02 08:17:58 +00:00
Vladislav Bolkhovitin
d2d0c488aa scst_local_add_target(): Also set *out_tgt upon failure
Although the callers of scst_local_add_target() do not use the
value of *out_tgt if scst_local_add_target() reports that it failed,
set *out_tgt in that case to avoid that sparse reports the following
(false positive) warning:

scst_local/scst_local.c:1807: warning: 'tgt' may be used uninitialized in this function

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4534 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-09-29 22:33:20 +00:00
Vladislav Bolkhovitin
8ce28aaba2 Avoid that enabling a target too quickly triggers a crash
The sysfs attributes of a target can be accessed before scst_tgt.tgt_priv
has been set. Avoid that such an access triggers a crash.

Symptom:
BUG: unable to handle kernel NULL pointer dereference at 000000000000004c
IP: [<ffffffffa1345848>] iscsi_is_target_enabled+0x8/0x20 [iscsi_scst]
PGD 150a4c067 PUD 13cacb067 PMD 0
Oops: 0000 [#1] SMP
CPU 1
Modules linked in: zfs(P) iscsi_scst(O) scst_vdisk(O) scst(O) zcommon(P) znvpair(P) zavl(P) zunicode(P) spl(O) [last unloaded: zfs]
Pid: 3974, comm: scst_uid1864 Tainted: P           O 3.2.23-zfsiscsi-std-ipv6-64 #3 Supermicro X6DVA/X6DVA
RIP: 0010:[<ffffffffa1345848>]  [<ffffffffa1345848>] iscsi_is_target_enabled+0x8/0x20 [iscsi_scst]
RSP: 0018:ffff88015071ddc0  EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff880181fdaa00 RCX: ffff88012d41f380
RDX: ffff88015071c010 RSI: 0000000000000000 RDI: ffff880181fdaa00
RBP: ffff88015071ddc0 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: ffffffffa134a608
R13: 0000000000000000 R14: 0000000000000129 R15: ffffffffa134a4c0
FS:  0000000000000000(0000) GS:ffff88019fc80000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 000000000000004c CR3: 0000000151927000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process scst_uid1864 (pid: 3974, threadinfo ffff88015071c000, task ffff880194d57500)
Stack:
 ffff88015071de10 ffffffffa12ee89a 00000000fffffffc 01ff88015071de98
 ffff88015071de80 ffff8801932a48d8 00000000fffffffc ffff88015071de98
 ffff88015071de80 ffff880194d57500 ffff88015071de30 ffffffffa12f582e
Call Trace:
 [<ffffffffa12ee89a>] __scst_is_relative_target_port_id_unique+0x6a/0xc0 [scst]
 [<ffffffffa12f582e>] gen_relative_target_port_id+0x6e/0xd0 [scst]
 [<ffffffffa12fdb8a>] scst_tgt_enable_store_work_fn+0x3a/0xe0 [scst]
 [<ffffffffa12f9397>] sysfs_work_thread_fn+0xc7/0x2e0 [scst]
 [<ffffffffa12f92d0>] ? scst_tgtt_release+0x20/0x20 [scst]
 [<ffffffffa12f92d0>] ? scst_tgtt_release+0x20/0x20 [scst]
 [<ffffffff810b44f6>] kthread+0x96/0xa0
 [<ffffffff81b8ed74>] kernel_thread_helper+0x4/0x10
 [<ffffffff810b4460>] ? kthread_worker_fn+0x180/0x180
 [<ffffffff81b8ed70>] ? gs_change+0xb/0xb
Code: 42 c8 74 0f 39 78 48 75 ea c9 c3 0f 1f 84 00 00 00 00 00 31 c0 c9 c3 66 66 66 2e 0f 1f 84 00 00 00 00 00 48 8b 47 48 55 48 89 e5 <0f> b6 40 4c c9 83 e0 01 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00
RIP  [<ffffffffa1345848>] iscsi_is_target_enabled+0x8/0x20 [iscsi_scst]
 RSP <ffff88015071ddc0>
CR2: 000000000000004c
---[ end trace 6311d4069703be07 ]---

Reported-by: Etienne Dechamps <e-t172@akegroup.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org> with some modifications



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4515 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-09-12 22:13:43 +00:00
Vladislav Bolkhovitin
89296abc5e Fix incorrect errors handling. Detected by smatch.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4493 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-27 22:14:47 +00:00
Vladislav Bolkhovitin
0ab789c476 scst_local: Remove a superfluous if-test
It is not necessary to test whether a pointer is not NULL before invoking
kfree(). Detected by smatch.

From: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4485 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-27 21:45:35 +00:00
Vladislav Bolkhovitin
1b68210cce Fix possible commands hangs with lockless queuecommand() in scst_local
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4463 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-10 01:48:35 +00:00
Bart Van Assche
e0f7025708 nightly build: Add kernel 3.5 build infrastructure
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4460 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-08-09 08:07:26 +00:00
Vladislav Bolkhovitin
fabf9fceda Avoid that removing the scst_local kernel module triggers a deadlock
when one of its LUNs is a CD-ROM device. sr_block_release() invokes
scst_local_release_adapter() indirectly with sr_mutex held. So if 
scst_local_release_adapter() blocks until the scst_local session has
been freed a deadlock may be triggered if another CD-ROM device has
to be closed in order to free that session. Fix this by changing
scst_local_release_adapter() such that it does not wait until the
session unregistration has finished.

Call stacks obtained with echo w > /proc/sysrq-trigger:

SysRq : Show Blocked State
  task                        PC stack   pid father
scst_mgmtd      D ffffffff812f979d     0  5552      2 0x00000000
 ffff88003c335b30 0000000000000046 ffffffff812f979d 0000000000000002
 ffff8800171d47a0 ffff88003c335fd8 ffff88003c335fd8 ffff88003c335fd8
 ffff88003d1b0000 ffff8800171d47a0 ffff88003c335b60 ffff88003c334000
Call Trace:
 [<ffffffff812f979d>] ? sr_block_release+0x2d/0x60
 [<ffffffff812f979d>] ? sr_block_release+0x2d/0x60
 [<ffffffff814a9b19>] schedule+0x29/0x70
 [<ffffffff814a9e57>] schedule_preempt_disabled+0x27/0x40
 [<ffffffff814a79b7>] mutex_lock_nested+0x187/0x390
 [<ffffffff812f979d>] ? sr_block_release+0x2d/0x60
 [<ffffffff812f979d>] sr_block_release+0x2d/0x60
 [<ffffffff8118a1ec>] __blkdev_put+0x19c/0x1d0
 [<ffffffff8118a27d>] blkdev_put+0x5d/0x180
 [<ffffffff8118a3c8>] blkdev_close+0x28/0x30
 [<ffffffff81153633>] fput+0x103/0x280
 [<ffffffff8114fad9>] filp_close+0x69/0x90
 [<ffffffffa022ec24>] vdisk_detach_tgt+0x134/0x150 [scst_vdisk]
 [<ffffffffa02d8f2f>] scst_free_tgt_dev+0xdf/0x220 [scst]
 [<ffffffffa02d949f>] ? scst_free_session_callback+0x7f/0x170 [scst]
 [<ffffffffa02d90eb>] scst_sess_free_tgt_devs+0x7b/0x110 [scst]
 [<ffffffffa02d91de>] scst_free_session+0x5e/0x2a0 [scst]
 [<ffffffffa02d94be>] scst_free_session_callback+0x9e/0x170 [scst]
 [<ffffffffa02c6a05>] scst_global_mgmt_thread+0x2e5/0x580 [scst]
 [<ffffffff8105e850>] ? __init_waitqueue_head+0x60/0x60
 [<ffffffffa02c6720>] ? scst_register_session_non_gpl+0x20/0x20 [scst]
 [<ffffffff8105dd77>] kthread+0xb7/0xc0
 [<ffffffff814b50b4>] kernel_thread_helper+0x4/0x10
 [<ffffffff814abb30>] ? retint_restore_args+0x13/0x13
 [<ffffffff8105dcc0>] ? __init_kthread_worker+0x70/0x70
 [<ffffffff814b50b0>] ? gs_change+0x13/0x13
iscsi-scstd     D ffffffffa02b1b1f     0  5567      1 0x00000004
 ffff88003c2f59a8 0000000000000046 ffffffffa02b1b1f 0000000000000002
 ffff8800173b23d0 ffff88003c2f5fd8 ffff88003c2f5fd8 ffff88003c2f5fd8
 ffff88003d198000 ffff8800173b23d0 ffff88003c2f59d8 ffff88003c2f4000
Call Trace:
 [<ffffffffa02b1b1f>] ? scst_unregister_target+0x8f/0x450 [scst]
 [<ffffffffa02b1b1f>] ? scst_unregister_target+0x8f/0x450 [scst]
 [<ffffffff814a9b19>] schedule+0x29/0x70
 [<ffffffff814a9e57>] schedule_preempt_disabled+0x27/0x40
 [<ffffffff814a79b7>] mutex_lock_nested+0x187/0x390
 [<ffffffffa02b1b1f>] ? scst_unregister_target+0x8f/0x450 [scst]
 [<ffffffffa025c7ba>] ? __iscsi_del_attr+0xea/0x190 [iscsi_scst]
 [<ffffffffa02b1b1f>] scst_unregister_target+0x8f/0x450 [scst]
 [<ffffffffa025c7ba>] ? __iscsi_del_attr+0xea/0x190 [iscsi_scst]
 [<ffffffffa026249f>] target_destroy+0x5f/0xc0 [iscsi_scst]
 [<ffffffffa02631f2>] target_del_all+0xf2/0x2d0 [iscsi_scst]
 [<ffffffffa025c8aa>] release+0x4a/0xe0 [iscsi_scst]
 [<ffffffff81153633>] fput+0x103/0x280
 [<ffffffff8114fad9>] filp_close+0x69/0x90
 [<ffffffff8103e533>] put_files_struct+0x103/0x1c0
 [<ffffffff8103e478>] ? put_files_struct+0x48/0x1c0
 [<ffffffff8103e6b2>] exit_files+0x52/0x60
 [<ffffffff8103eb80>] do_exit+0x180/0x8e0
 [<ffffffff8104ef87>] ? get_signal_to_deliver+0xe7/0x6e0
 [<ffffffff8103f631>] do_group_exit+0x51/0xc0
 [<ffffffff8104f0bf>] get_signal_to_deliver+0x21f/0x6e0
 [<ffffffff8100223c>] do_signal+0x3c/0x580
 [<ffffffff81002805>] do_notify_resume+0x65/0xa0
 [<ffffffff812149de>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff814b4122>] int_signal+0x12/0x17
rmmod           D ffffffffa02b1b70     0  5714   5681 0x00000000
 ffff88000b497d48 0000000000000046 ffffffffa02b1b70 0000000000000002
 ffff88003920a3d0 ffff88000b497fd8 ffff88000b497fd8 ffff88000b497fd8
 ffff88003d17a3d0 ffff88003920a3d0 ffff88000b497d78 ffff88000b496000
Call Trace:
 [<ffffffffa02b1b70>] ? scst_unregister_target+0xe0/0x450 [scst]
 [<ffffffffa02b1b70>] ? scst_unregister_target+0xe0/0x450 [scst]
 [<ffffffff814a9b19>] schedule+0x29/0x70
 [<ffffffff814a9e57>] schedule_preempt_disabled+0x27/0x40
 [<ffffffff814a79b7>] mutex_lock_nested+0x187/0x390
 [<ffffffffa02b1b70>] ? scst_unregister_target+0xe0/0x450 [scst]
 [<ffffffffa02b1b70>] scst_unregister_target+0xe0/0x450 [scst]
 [<ffffffffa0287e51>] ? scst_local_exit+0x6b/0x21a [scst_local]
 [<ffffffff812c2d37>] ? put_device+0x17/0x20
 [<ffffffff812c3efa>] ? device_unregister+0x2a/0x60
 [<ffffffffa0285108>] __scst_local_remove_target+0xa8/0x130 [scst_local]
 [<ffffffffa0287e6a>] scst_local_exit+0x84/0x21a [scst_local]
 [<ffffffff810a40c6>] sys_delete_module+0x1a6/0x2b0
 [<ffffffff812149de>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff814b3de9>] system_call_fastpath+0x16/0x1b
ata_id          D ffff88003920c7a0     0  5715   5195 0x00000000
 ffff880015e97818 0000000000000046 0000000000000000 0000000000000046
 ffff88003920c7a0 ffff880015e97fd8 ffff880015e97fd8 ffff880015e97fd8
 ffff880021788000 ffff88003920c7a0 ffff880015e977f8 7fffffffffffffff
Call Trace:
 [<ffffffff814a9b19>] schedule+0x29/0x70
 [<ffffffff814a7355>] schedule_timeout+0x315/0x390
 [<ffffffff814a98e3>] ? wait_for_common+0x43/0x170
 [<ffffffff814a98e3>] ? wait_for_common+0x43/0x170
 [<ffffffff814a99c2>] wait_for_common+0x122/0x170
 [<ffffffff810705b0>] ? try_to_wake_up+0x2f0/0x2f0
 [<ffffffff814a9aed>] wait_for_completion+0x1d/0x20
 [<ffffffffa02bfad3>] scst_unregister_session+0x1a3/0x320 [scst]
 [<ffffffffa0284990>] scst_local_release_adapter+0xa0/0x140 [scst_local]
 [<ffffffff812c2f87>] device_release+0x27/0xa0
 [<ffffffff81209abb>] kobject_release+0x8b/0x1d0
 [<ffffffff8120993c>] kobject_put+0x2c/0x60
 [<ffffffff812c2d37>] put_device+0x17/0x20
 [<ffffffff812e1850>] scsi_host_dev_release+0xc0/0xe0
 [<ffffffff812c2f87>] device_release+0x27/0xa0
 [<ffffffff81209abb>] kobject_release+0x8b/0x1d0
 [<ffffffff8120993c>] kobject_put+0x2c/0x60
 [<ffffffff812c2d37>] put_device+0x17/0x20
 [<ffffffff812ea0c2>] scsi_target_dev_release+0x22/0x30
 [<ffffffff812c2f87>] device_release+0x27/0xa0
 [<ffffffff81209abb>] kobject_release+0x8b/0x1d0
 [<ffffffff8120993c>] kobject_put+0x2c/0x60
 [<ffffffff812c2d37>] put_device+0x17/0x20
 [<ffffffff812ed818>] scsi_device_dev_release_usercontext+0x118/0x130
 [<ffffffff812ed700>] ? scsi_device_cls_release+0x20/0x20
 [<ffffffff81056576>] execute_in_process_context+0x86/0xa0
 [<ffffffff812ed6dc>] scsi_device_dev_release+0x1c/0x20
 [<ffffffff812c2f87>] device_release+0x27/0xa0
 [<ffffffff81209abb>] kobject_release+0x8b/0x1d0
 [<ffffffff8120993c>] kobject_put+0x2c/0x60
 [<ffffffff812c2d37>] put_device+0x17/0x20
 [<ffffffff812df594>] scsi_device_put+0x44/0x60
 [<ffffffff812f974d>] scsi_cd_put+0x4d/0x70
 [<ffffffff812f97b1>] sr_block_release+0x41/0x60
 [<ffffffff8118a1ec>] __blkdev_put+0x19c/0x1d0
 [<ffffffff8118a27d>] blkdev_put+0x5d/0x180
 [<ffffffff8118a3c8>] blkdev_close+0x28/0x30
 [<ffffffff81153633>] fput+0x103/0x280
 [<ffffffff814a93b3>] ? __schedule+0x3c3/0x820
 [<ffffffff8114fad9>] filp_close+0x69/0x90
 [<ffffffff8114fba0>] sys_close+0xa0/0x100
 [<ffffffff814b3de9>] system_call_fastpath+0x16/0x1b

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Richard Sharpe <realrichardsharpe@gmail.com>




git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4425 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-27 01:14:55 +00:00
Vladislav Bolkhovitin
955113f493 Sense handling improvements
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4408 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-07-18 21:28:57 +00:00
Bart Van Assche
1b159eec24 nightly build: Add kernel 3.4 build infrastructure
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4321 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-05-24 19:52:39 +00:00
Vladislav Bolkhovitin
eb95049061 Copyrights updated + cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4216 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-04-18 02:26:39 +00:00
Vladislav Bolkhovitin
90670b1c83 scst_rx_mgmt_fn_lun(): Change 3rd arg from u8 * into void *
This change allows to remove several casts and hence improves
source code readability.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4169 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-03-27 01:40:45 +00:00
Bart Van Assche
968d3b17fe nightly build: Add 3.3 support patches
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4167 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-03-24 07:12:56 +00:00
Vladislav Bolkhovitin
50120c37b3 scst_cmd_aborted() is a bad and ambiguous name. Rename it to scst_cmd_aborted_on_xmit() and create a new version, which truly reflects its semantic.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4143 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-02-24 02:24:06 +00:00
Vladislav Bolkhovitin
f2387d7956 Convert strict_strtoul() and simple_strtoul() into kstrtoul() or sscanf()
Recent versions of the checkpatch script complain about strict_strtoul()
and simple_strtoul(), so convert calls to these functions into a call to
kstrtoul() or sscanf(). Convert loops that scan for the
next-(non-)whitespace character into a call to scst_get_next_lexem().
Make __scst_process_luns_mgmt_store() a little more strict by checking
for extraneous parameters past the last argument. Fix the value "res"
returned for the SCST_TRACE_ACTION_VALUE processing code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4137 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-02-18 03:01:43 +00:00
Bart Van Assche
10bcf70cc6 Add files necessary for 3.2 nightly build
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4078 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-01-19 07:58:37 +00:00
Vladislav Bolkhovitin
7872837b6b Replace list_entry((a)->next, b, c) by list_first_entry(a, b, c).
BSD-signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3965 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-12-10 03:50:24 +00:00
Bart Van Assche
baf5c259bc regtests: Add files necessary for Linux kernel 3.1
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3929 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-11-17 09:24:12 +00:00
Vladislav Bolkhovitin
137fbb6779 Remove dead target
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3906 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-11-04 02:24:35 +00:00
Vladislav Bolkhovitin
43d576aa48 Changelogs updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3842 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-09-01 20:15:42 +00:00
Bart Van Assche
08a80a59bc documentation, spelling: Change phisical into physical
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3825 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-08-20 14:04:52 +00:00
Bart Van Assche
eb24966570 scst_local: Fix a recently introduced compiler warning.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3804 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-08-14 15:51:17 +00:00
Bart Van Assche
705c3754a2 Remove superfluous double quotes from around #warning messages because checkpatch 3.0 complains about these.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3789 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-07-29 12:58:13 +00:00
Bart Van Assche
dbc55781d7 Add remaining Linux kernel 3.0 patches and port nightly build scripts to 3.0 too.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3783 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-07-27 14:05:47 +00:00
Vladislav Bolkhovitin
7096e492ba Improve changing debug/release/etc states by making them not depending
from the previous state. Hence, the corresponding labels were renamed to
2debug, 2release and 2perf.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3736 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-07-22 23:10:08 +00:00
Vladislav Bolkhovitin
6012710767 - Let's always do extraclean on Makefiles modifications, because they can affect data layout in header files, which could not be detected by all target drivers/dev handlers makes
- Cleanups


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3504 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-06-01 16:58:06 +00:00
Bart Van Assche
6f8d4b7288 scst_local: get rid of a checkpatch complaint for the procfs build.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3499 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-06-01 08:04:56 +00:00