51 Commits

Author SHA1 Message Date
Chesnokov Gleb
0a05b57009 fcst: Remove support for kernel versions before 3.10
The SCST has dropped support for kernels older than 3.10.0 (RHEL 7 / Centos 7) since SCST v3.6.
2022-01-13 17:26:37 +03:00
Bart Van Assche
3d527cb0b5 fcst: Use BUILD_BUG_ON() instead of static_assert()
BUILD_BUG_ON() works with older gcc versions but static_assert() not.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9577 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-09-15 03:10:32 +00:00
Bart Van Assche
0f817a40ef fcst: Remove one occurrence of __attribute__((packed))
Remove this occurrence because it is not necessary and because checkpatch
complains about it.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9573 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-09-07 15:51:56 +00:00
Bart Van Assche
d8988e34c0 fcst: Fix a kernel-doc header
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9374 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-04-13 03:14:05 +00:00
Bart Van Assche
7b764b1499 fcst: Suppress sparse warnings
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8888 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-10 18:36:21 +00:00
Bart Van Assche
3f7216ce2a fcst: Fix multiple checkpatch warnings
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8049 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-11 03:50:11 +00:00
Bart Van Assche
cb070d9a7f scst/include/backport.h: Add a backport of rcu_dereference_protected()
This patch does not change any functionality.


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


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7178 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-14 03:06:54 +00:00
Vladislav Bolkhovitin
69feb6696e fcst: Linux kernel v4.11 build fix
Linux kernel v4.11 build fix.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7173 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-11 04:00:29 +00:00
Bart Van Assche
5bbc7433dc scst: Move kref_get_unless_zero() definition to <scst/backport.h>
This patch is a slightly modified version of a patch supplied by
Israel Rukshin <israelr@mellanox.com>.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6875 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-04-26 04:13:42 +00:00
Vladislav Bolkhovitin
4ac6d7a26d [PATCH] scst: Drop detect() method
There is no need for a detect() method - code that is present in such
a method can be moved to module_init(). Hence declare this method
obsolete. Leave the detect pointer member in the target template for
now for out-of-tree SCST drivers.

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

with some improvements



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6113 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-02-21 04:32:36 +00:00
Bart Van Assche
548ea345b5 Build fixes for RHEL 6.6 kernel 2.6.32-504
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5886 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-11-26 13:38:52 +00:00
Bart Van Assche
b32ef39546 fcst: Remove an unused variable
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5605 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-06-14 17:10:58 +00:00
Bart Van Assche
a57c9d0cee fcst: Fix a potential deadlock
This patch fixes the following lockdep warning:

======================================================
[ INFO: possible circular locking dependency detected ]
3.13.0-rc6-debug+ #5 Tainted: G        W  O
-------------------------------------------------------
rmmod/8653 is trying to acquire lock:
 (scst_tgt_kref){+.+.+.}, at: [<ffffffffa033de6f>] scst_tgt_sysfs_put+0x10f/0x190 [scst]

but task is already holding lock:
 (ft_lport_lock){+.+.+.}, at: [<ffffffffa029d3db>] ft_lport_del+0x1b/0x40 [fcst]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (ft_lport_lock){+.+.+.}:
       [<ffffffff8109b4b4>] lock_acquire+0xa4/0x1e0
       [<ffffffff81559837>] mutex_lock_nested+0x77/0x430
       [<ffffffffa029d5a0>] ft_tgt_enable+0x20/0xd0 [fcst]
       [<ffffffffa0335c99>] scst_process_tgt_enable_store+0xe9/0x230 [scst]
       [<ffffffffa0335dfc>] scst_tgt_enable_store_work_fn+0x1c/0x20 [scst]
       [<ffffffffa0338ebc>] scst_process_sysfs_works+0xfc/0x1f0 [scst]
       [<ffffffffa033d180>] sysfs_work_thread_fn+0x120/0x2b0 [scst]
       [<ffffffff81074850>] kthread+0xf0/0x110
       [<ffffffff815663fc>] ret_from_fork+0x7c/0xb0

-> #0 (scst_tgt_kref){+.+.+.}:
       [<ffffffff8109a95b>] __lock_acquire+0x17ab/0x1b10
       [<ffffffff8109b4b4>] lock_acquire+0xa4/0x1e0
       [<ffffffffa03375b9>] scst_kobject_put_and_wait+0x99/0x260 [scst]
       [<ffffffffa033de6f>] scst_tgt_sysfs_put+0x10f/0x190 [scst]
       [<ffffffffa03053dc>] scst_unregister_target+0x15c/0x3c0 [scst]
       [<ffffffffa029c69c>] ft_tport_delete+0x2c/0xa0 [fcst]
       [<ffffffffa029d3ec>] ft_lport_del+0x2c/0x40 [fcst]
       [<ffffffffa023e249>] fc_lport_iterate+0x49/0x80 [libfc]
       [<ffffffffa029d804>] ft_module_exit+0x36/0x832 [fcst]
       [<ffffffff810cd3f2>] SyS_delete_module+0x152/0x1f0
       [<ffffffff815664a9>] system_call_fastpath+0x16/0x1b

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(ft_lport_lock);
                               lock(scst_tgt_kref);
                               lock(ft_lport_lock);
  lock(scst_tgt_kref);

 *** DEADLOCK ***

2 locks held by rmmod/8653:
 #0:  (fc_prov_mutex){+.+.+.}, at: [<ffffffffa023e222>] fc_lport_iterate+0x22/0x80 [libfc]
 #1:  (ft_lport_lock){+.+.+.}, at: [<ffffffffa029d3db>] ft_lport_del+0x1b/0x40 [fcst]

stack backtrace:
CPU: 0 PID: 8653 Comm: rmmod Tainted: G        W  O 3.13.0-rc6-debug+ #5
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 ffffffff8222ce70 ffff88002efdbb70 ffffffff8155551c ffffffff8222ce70
 ffff88002efdbbb0 ffffffff81552248 ffff88002efdbc00 ffff88002ed0ed88
 ffff88002ed0e6d0 0000000000000002 0000000000000002 ffff88002ed0ed88
Call Trace:
 [<ffffffff8155551c>] dump_stack+0x4e/0x7a
 [<ffffffff81552248>] print_circular_bug+0x200/0x20f
 [<ffffffff8109a95b>] __lock_acquire+0x17ab/0x1b10
 [<ffffffff8109b4b4>] lock_acquire+0xa4/0x1e0
 [<ffffffffa03375b9>] scst_kobject_put_and_wait+0x99/0x260 [scst]
 [<ffffffffa033de6f>] scst_tgt_sysfs_put+0x10f/0x190 [scst]
 [<ffffffffa03053dc>] scst_unregister_target+0x15c/0x3c0 [scst]
 [<ffffffffa029c69c>] ft_tport_delete+0x2c/0xa0 [fcst]
 [<ffffffffa029d3ec>] ft_lport_del+0x2c/0x40 [fcst]
 [<ffffffffa023e249>] fc_lport_iterate+0x49/0x80 [libfc]
 [<ffffffffa029d804>] ft_module_exit+0x36/0x832 [fcst]
 [<ffffffff810cd3f2>] SyS_delete_module+0x152/0x1f0
 [<ffffffff815664a9>] system_call_fastpath+0x16/0x1b


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5196 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-16 15:23:45 +00:00
Bart Van Assche
6d7fb6343d fcst: Avoid that "rmmod fcst" hangs
Make sure that SCST sessions get unregistered when scst_unregister_target()
is invoked. This change is necessary because of r5083 ("Disable automatic
sessions unregistration").


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5195 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-16 15:22:00 +00:00
Bart Van Assche
9690e0f1c3 fcst: SLES 11 SP3 build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5188 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-01-10 07:50:10 +00:00
Bart Van Assche
2381497291 fcst: Suppress a lockdep complaint
===============================
 [ INFO: suspicious RCU usage. ]
 3.10.0-rc1-debug+ #1 Tainted: G           O
 -------------------------------
fcst/ft_sess.c:194 suspicious rcu_dereference_protected() usage!
    
other info that might help us debug this:
    
rcu_scheduler_active = 1, debug_locks = 0
1 lock held by fcoethread/2/7942:
 #0:  (rcu_read_lock){.+.+..}, at: [<ffffffffa035ee30>] rcu_lock_acquire.constprop.14+0x0/0x30 [fcst]

stack backtrace:
CPU: 2 PID: 7942 Comm: fcoethread/2 Tainted: G           O 3.10.0-rc1-debug+ #1
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
 0000000000000001 ffff88003b191c28 ffffffff81525a11 ffff88003b191c58
 ffffffff810a20ad ffff880039b7d1e8 ffff88003690c400 000000000000067a
 ffff880039b7cb88 ffff88003b191c80 ffffffffa035f67b ffff880039b7cb88
Call Trace:
 [<ffffffff81525a11>] dump_stack+0x19/0x1b
 [<ffffffff810a20ad>] lockdep_rcu_suspicious+0xfd/0x130
 [<ffffffffa035f67b>] ft_sess_get.isra.7+0x12b/0x150 [fcst]
 [<ffffffffa035f6e2>] ft_recv+0x42/0x100 [fcst]
 [<ffffffffa026edb2>] fc_lport_recv_req+0x272/0x2f0 [libfc]
 [<ffffffffa0268c3b>] fc_exch_recv+0x61b/0xdc0 [libfc]
 [<ffffffffa025f306>] fcoe_percpu_receive_thread+0x386/0x5f0 [fcoe]
 [<ffffffff8106d34b>] kthread+0xdb/0xe0
 [<ffffffff815357ac>] ret_from_fork+0x7c/0xb0



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4962 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:39:14 +00:00
Bart Van Assche
e506bd990d fcst: Fix a race condition
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4961 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:37:45 +00:00
Bart Van Assche
e41c3bf328 fcst: Fix a lockdep warning
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4960 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:37:23 +00:00
Bart Van Assche
cf8d18cba8 fcst: Remove ft_prlo() function header and a comment
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4959 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:37:00 +00:00
Bart Van Assche
049aab6dce fcst: Update a debug statement in ft_prli()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4958 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:36:32 +00:00
Bart Van Assche
62059912bf fcst: Remove two comments from ft_prli_locked()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4957 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:36:08 +00:00
Bart Van Assche
50c4c8ded9 fcst: Remove superfluous initialization from ft_sess_get()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4956 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:35:45 +00:00
Bart Van Assche
a578373d4e fcst: Add more debugging code in ft_sess_put()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4950 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-13 18:32:41 +00:00
Bart Van Assche
08afc26627 fcst: Do not define kref_get_unless_zero() if backported through stable tree
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4934 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-03 18:06:32 +00:00
Bart Van Assche
1b94eecde7 fcst: Revert r4889 because it was wrong
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4931 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-08-03 15:14:19 +00:00
Bart Van Assche
067a3231f9 fcst: Fix a checkpatch complaint about whitespace
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4893 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-06-04 11:46:22 +00:00
Bart Van Assche
fda521f287 fcst: Follow-up for r4873
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4889 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-06-04 09:41:58 +00:00
Bart Van Assche
095813cc56 fcst: RHEL 6 build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4886 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-06-03 15:41:09 +00:00
Bart Van Assche
33c0e52b93 fcst: Fix two sparse warnings
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4870 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-20 06:39:24 +00:00
Bart Van Assche
8c3fc40784 fcst: Fix build on pre-2.6.36 kernels
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4869 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-20 06:37:55 +00:00
Bart Van Assche
aec51e803c fcst: Kernel 3.9 build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4866 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-19 16:58:52 +00:00
Bart Van Assche
1ed1f3fda7 fcst: Eliminate ft_sess_lookup_delete()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4865 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-19 16:57:57 +00:00
Bart Van Assche
c4b720647c fcst: Move the ft_prov data structure
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4864 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-19 16:56:42 +00:00
Bart Van Assche
06141fe25d fcst: Minimize comment diffs with upstream
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4863 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-19 16:54:34 +00:00
Bart Van Assche
f5fd68200e fcst: Introduce function ft_sess_hash()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4862 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2013-05-19 16:53:24 +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
Bart Van Assche
26a74cebe8 fcst: Build fix
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4381 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-06-28 06:28:37 +00:00
Bart Van Assche
a4c70b8126 Use rcu_dereference_protected to tell rcu that the ft_lport_lock
is held during ft_lport_create. This resolved "suspicious RCU usage"
warnings when debugging options are turned on.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4378 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-06-27 05:11:20 +00:00
Bart Van Assche
62dd759208 fcst: Transform r4107 into something that makes sense
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4108 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-02-03 09:13:00 +00:00
Bart Van Assche
1d17e6386c fcst: Follow-up for r4106 - make fcst build again on kernel 3.0 and before
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4107 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-02-02 19:24:05 +00:00
Bart Van Assche
b6e5aa684c Source: http://marc.info/?l=linux-scsi&m=132812597504750
From: "Paul E. McKenney" <paul.mckenney@linaro.org>

The call_rcu() in ft_tport_delete() invokes ft_tport_rcu_free(),
which just does a kfree().  So convert the call_rcu() to kfree_rcu(),
allowing ft_tport_rcu_free() to be eliminated.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: linux-scsi@vger.kernel.org
Cc: target-devel@vger.kernel.org
---
 drivers/target/tcm_fc/tfc_sess.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 4c0507c..eff512b 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -86,16 +86,6 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
 }
 
 /*
- * Free tport via RCU.
- */
-static void ft_tport_rcu_free(struct rcu_head *rcu)
-{
-	struct ft_tport *tport = container_of(rcu, struct ft_tport, rcu);
-
-	kfree(tport);
-}
-
-/*
  * Delete a target local port.
  * Caller holds ft_lport_lock.
  */
@@ -114,7 +104,7 @@ static void ft_tport_delete(struct ft_tport *tport)
 		tpg->tport = NULL;
 		tport->tpg = NULL;
 	}
-	call_rcu(&tport->rcu, ft_tport_rcu_free);
+	kfree_rcu(tport, rcu);
 }
 
 /*
-- 
1.7.8


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4106 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2012-02-02 19:11:33 +00:00
Bart Van Assche
59da9cd84b fcst: RHEL 6 build fixes
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4031 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-12-27 10:38:01 +00:00
Bart Van Assche
2125cb8400 fcst: Complain when refusing login
Log an error message when refusing login because a target port has not yet been enabled
such that fcst users have a way to find out what happened.

Also, make sure that ft_prli() returns a value in the range of the enumeration type
fc_els_spp_resp. Note: since the return value of ft_prli() is only compared against
FC_SPP_RESP_ACK in the current libfc implementation, this change doesn't affect the
behavior of fcst.

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


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4027 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-12-21 09:32:18 +00:00
Bart Van Assche
19a0804026 fcst: Avoid that login triggers a crash
Fix the following crash triggered by FCoE initiator login:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000002
IP: [<ffffffffa04b282b>] ft_prli+0x4b/0x350 [fcst]
PGD 1a7ba4067 PUD 1a7ba3067 PMD 0
Oops: 0000 [#1] SMP
CPU 0
Modules linked in: netconsole configfs ib_srpt fcst scst_vdisk scst
crc32c libcrc32c fcoe libfcoe libfc scsi_transport_fc snd_pcm_oss
snd_mixer_oss snd_seq snd_seq_device af_packet rdma_ucm rdma_cm iw_cm
ib_addr ib_ipoib ib_cm ib_sa ib_uverbs ib_umad mlx4_ib ib_mad ib_core
microcode cpufreq_conservative cpufreq_userspace cpufreq_powersave
acpi_cpufreq mperf dm_mod snd_hda_codec_hdmi snd_hda_codec_analog
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_timer snd intel_agp
mlx4_core sr_mod sg intel_gtt cdrom soundcore i2c_i801 agpgart
snd_page_alloc i2c_core pcspkr button uhci_hcd sd_mod crc_t10dif
ehci_hcd usbcore edd ext3 mbcache jbd fan ata_generic ata_piix
pata_marvell ahci libahci libata scsi_mod thermal processor
thermal_sys hwmon [last unloaded: scst]

Pid: 3562, comm: fcoethread/0 Not tainted 3.1.5-debug+ #1 System
manufacturer P5Q DELUXE/P5Q DELUXE
RIP: 0010:[<ffffffffa04b282b>]  [<ffffffffa04b282b>] ft_prli+0x4b/0x350 [fcst]
RSP: 0018:ffff8801a6273b70  EFLAGS: 00010282
RAX: ffff8801a6273fd8 RBX: 0000000000000000 RCX: 0000000000000006
RDX: 0000000000000001 RSI: 2222222222222222 RDI: 2222222222222222
RBP: ffff8801a6273be0 R08: 2222222222222222 R09: 2222222222222222
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000004
R13: ffff8801a6291c7c R14: ffff8801a6290800 R15: ffff8801a6290848
FS:  0000000000000000(0000) GS:ffff8801bfc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000002 CR3: 00000001a7ba1000 CR4: 00000000000406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process fcoethread/0 (pid: 3562, threadinfo ffff8801a6272000, task
ffff8801b13ecce0)
Stack:
 ffff8801a6273bc0 ffffffff812f7593 00000000000000c0 ffff8801b9002a00
 0000000000000100 000000000000002c 0000000000000000 ffff8801ae1a4a18
 ffff8801b1a1d600 ffff8801a6290800 ffff8801b1a1ce00 ffff8801ae1a4a18
Call Trace:
 [<ffffffff812f7593>] ? __alloc_skb+0x83/0x170
 [<ffffffffa03b95ec>] fc_rport_enter_prli+0xec/0x220 [libfc]
 [<ffffffffa03ba531>] fc_rport_recv_req+0x541/0x1280 [libfc]
 [<ffffffff81082e8d>] ? trace_hardirqs_on_caller+0x11d/0x1b0
 [<ffffffff813d44ad>] ? mutex_lock_nested+0x26d/0x330
 [<ffffffffa03b6c00>] ? fc_lport_recv_els_req+0x30/0x140 [libfc]
 [<ffffffffa03b6c1f>] fc_lport_recv_els_req+0x4f/0x140 [libfc]
 [<ffffffffa03b5f14>] fc_lport_recv_req+0x174/0x230 [libfc]
 [<ffffffffa03b5dd1>] ? fc_lport_recv_req+0x31/0x230 [libfc]
 [<ffffffff81082f2d>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffffa03b2f6c>] fc_exch_recv+0x63c/0xe50 [libfc]
 [<ffffffffa03ce3b8>] fcoe_recv_frame+0x1d8/0x410 [fcoe]
 [<ffffffff81082e8d>] ? trace_hardirqs_on_caller+0x11d/0x1b0
 [<ffffffffa03ceaf8>] ? fcoe_percpu_receive_thread+0x68/0xf0 [fcoe]
 [<ffffffff8104caf7>] ? local_bh_enable_ip+0x87/0xf0
 [<ffffffffa03ceb00>] fcoe_percpu_receive_thread+0x70/0xf0 [fcoe]
 [<ffffffffa03cea90>] ? fcoe_rcv+0x450/0x450 [fcoe]
 [<ffffffff81069656>] kthread+0x96/0xa0
 [<ffffffff813e0b74>] kernel_thread_helper+0x4/0x10
 [<ffffffff813d6d9d>] ? retint_restore_args+0xe/0xe
 [<ffffffff810695c0>] ? __init_kthread_worker+0x70/0x70
 [<ffffffff813e0b70>] ? gs_change+0xb/0xb
Code: 90 f6 05 e8 2c 00 00 02 49 89 fe 48 89 d3 49 89 cd 0f 85 8e 02
00 00 31 f6 48 c7 c7 00 50 4b a0 41 bc 04 00 00 00 e8 15 1a f2 e0 <0f>
b6 43 02 a8 c0 75 65 8b 4b 0c 41 b4 08 0f c9 f6 c1 30 74 58
RIP  [<ffffffffa04b282b>] ft_prli+0x4b/0x350 [fcst]
 RSP <ffff8801a6273b70>
CR2: 0000000000000002
---[ end trace c06e7c64e9c18831 ]---

BSD-signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Yi Zou <yi.zou@intel.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4025 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-12-21 09:28:50 +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
Joe Eykholt
649fef691e Changes to make fcst work on Linux 2.6.36.
The biggest difference is that libfc no longer allocates a sequence
and exchange for incoming requests, and that eliminates a parameter
on the receive function.  This was done to help performance and
might help on short reads sometime in the future.

This also fixes an error in ft_send_read_data() that exceeds the
skb's SG list length limit on long reads when the NIC
supports large send offload.

I also made other minor changes like adding debugging.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2823 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-11-25 01:16:18 +00:00
Joe Eykholt
546647be44 Support for persistent reservations.
Add a method for template get_initiator_port_transport_id()
to allow persistent reservations to work. 

Initialize struct ft_sess more fully before scst_register_session()
so that ft_get_transport_id() can use it.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1759 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-06-10 21:47:17 +00:00
Vladislav Bolkhovitin
b53e4cb4c1 Merge of the pr branch with additional fixes for problems found during extra testing
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1714 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-05-26 17:46:46 +00:00
Vladislav Bolkhovitin
17db798a36 Make enable_target() interface more clear
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1539 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2010-03-10 11:56:15 +00:00