Commit Graph

149 Commits

Author SHA1 Message Date
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
Bart Van Assche
cf131e0d20 scst_local: Rearranged a preprocessor directive such that generate-kernel-patch can expand it.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3493 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-06-01 06:39:49 +00:00
Bart Van Assche
d47e60953c scst_local/procfs bug fix: don't include <scst_const.h> before <scst.h> or
SCST_VERSION_STRING will be incorrect because it gets defined before
CONFIG_SCST_PROC is defined.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3490 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-28 11:00:35 +00:00
Bart Van Assche
4c4beaa0cd scst_local/procfs bug fix: don't include <scst_const.h> before <scst.h> or
SCST_VERSION_STRING will be incorrect because it gets defined before
CONFIG_SCST_PROC is defined.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3489 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-28 10:59:27 +00:00
Bart Van Assche
85bcb19a36 Added remaining files necessary for supporting 2.6.39 (these are copies of the 2.6.38 equivalents).
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3465 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-20 16:38:57 +00:00
Bart Van Assche
019489a774 Made it possible for generate-kernel-patch to evaluate all LINUX_VERSION_CODE statements.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3464 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-20 11:13:07 +00:00
Vladislav Bolkhovitin
b5a41deb28 Update for 2.6.39
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3462 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-20 00:52:34 +00:00
Vladislav Bolkhovitin
0f11a6139f Let's make build state changes errors more clear
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3445 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-05-11 01:56:38 +00:00
Vladislav Bolkhovitin
4539005d7c Patch from Alexey Obitotskiy <alexeyo1@open-e.com> making get_initiator_port_transport_id() more flexible
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3322 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-03-29 14:30:01 +00:00
Bart Van Assche
d00afd73f4 Added remaining files necessary for 2.6.38 nightly build support.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3304 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-03-24 11:55:23 +00:00
Vladislav Bolkhovitin
f518cd150c Let's remove *.orig and *.rej files on extraclean
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3277 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-03-10 20:07:23 +00:00
Vladislav Bolkhovitin
d38930733e Cleanup of unused out_sess.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3243 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-01-31 23:17:23 +00:00
Vladislav Bolkhovitin
f15f2cdd5f - Making scst_local be safe with BLOCKIO and pass-through.
- Docs update



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3205 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-01-11 13:39:27 +00:00
Vladislav Bolkhovitin
411fb4f623 - Update for 2.6.37
- Docs updated
 - Returning of DIRECT contexts by scst_estimate_context() disabled (see comment in the patch why)



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3203 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-01-10 18:34:29 +00:00
Vladislav Bolkhovitin
f3238333dd Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3200 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-01-06 20:02:04 +00:00
Bart Van Assche
2dce167153 scst_local: Ported to kernel 2.6.37.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3194 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-01-05 13:58:18 +00:00
Bart Van Assche
94b01ca7a3 Added 2.6.37-related files (svn merge -c3129 https://scst.svn.sourceforge.net/svnroot/scst/branches/sysfs-tree-changes).
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-12-20 14:12:44 +00:00
Vladislav Bolkhovitin
14930d39a9 Making creation of default target and session by default
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3131 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-12-18 15:53:59 +00:00
Vladislav Bolkhovitin
e1066553c8 The return value of scst_tgt_get_tgt_priv() in sysfs methods must be checked because at least in
theory it is possible that scst_tgt_get_tgt_priv() is invoked before
scst_register_target() returns. The patch below implements such a check and
also removes some superfluous casts.

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



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2691 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-11-13 17:27:02 +00:00