diff options
author | Andy Grover <agrover@redhat.com> | 2014-01-24 16:18:54 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-06 11:08:17 -0800 |
commit | 85c3c54bf969f0fd9ba59ee3f6e9849b53428412 (patch) | |
tree | aebb442573f42166a6948200d417e82d05182518 /block/blk-settings.c | |
parent | 26996fcd25dda2f6d34d1888d26585cd519f6af5 (diff) | |
download | linux-3.10-85c3c54bf969f0fd9ba59ee3f6e9849b53428412.tar.gz linux-3.10-85c3c54bf969f0fd9ba59ee3f6e9849b53428412.tar.bz2 linux-3.10-85c3c54bf969f0fd9ba59ee3f6e9849b53428412.zip |
target/iscsi: Fix network portal creation race
commit ee291e63293146db64668e8d65eb35c97e8324f4 upstream.
When creating network portals rapidly, such as when restoring a
configuration, LIO's code to reuse existing portals can return a false
negative if the thread hasn't run yet and set np_thread_state to
ISCSI_NP_THREAD_ACTIVE. This causes an error in the network stack
when attempting to bind to the same address/port.
This patch sets NP_THREAD_ACTIVE before the np is placed on g_np_list,
so even if the thread hasn't run yet, iscsit_get_np will return the
existing np.
Also, convert np_lock -> np_mutex + hold across adding new net portal
to g_np_list to prevent a race where two threads may attempt to create
the same network portal, resulting in one of them failing.
(nab: Add missing mutex_unlocks in iscsit_add_np failure paths)
(DanC: Fix incorrect spin_unlock -> spin_unlock_bh)
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block/blk-settings.c')
0 files changed, 0 insertions, 0 deletions