|
@@ -28,6 +28,7 @@
|
|
#include <target/target_core_base.h>
|
|
#include <target/target_core_base.h>
|
|
#include <target/target_core_fabric.h>
|
|
#include <target/target_core_fabric.h>
|
|
#include <target/iscsi/iscsi_transport.h>
|
|
#include <target/iscsi/iscsi_transport.h>
|
|
|
|
+#include <linux/semaphore.h>
|
|
|
|
|
|
#include "isert_proto.h"
|
|
#include "isert_proto.h"
|
|
#include "ib_isert.h"
|
|
#include "ib_isert.h"
|
|
@@ -666,8 +667,8 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
|
|
list_add_tail(&isert_conn->conn_accept_node, &isert_np->np_accept_list);
|
|
list_add_tail(&isert_conn->conn_accept_node, &isert_np->np_accept_list);
|
|
mutex_unlock(&isert_np->np_accept_mutex);
|
|
mutex_unlock(&isert_np->np_accept_mutex);
|
|
|
|
|
|
- pr_debug("isert_connect_request() waking up np_accept_wq: %p\n", np);
|
|
|
|
- wake_up(&isert_np->np_accept_wq);
|
|
|
|
|
|
+ pr_debug("isert_connect_request() up np_sem np: %p\n", np);
|
|
|
|
+ up(&isert_np->np_sem);
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
out_conn_dev:
|
|
out_conn_dev:
|
|
@@ -2999,7 +3000,7 @@ isert_setup_np(struct iscsi_np *np,
|
|
pr_err("Unable to allocate struct isert_np\n");
|
|
pr_err("Unable to allocate struct isert_np\n");
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
- init_waitqueue_head(&isert_np->np_accept_wq);
|
|
|
|
|
|
+ sema_init(&isert_np->np_sem, 0);
|
|
mutex_init(&isert_np->np_accept_mutex);
|
|
mutex_init(&isert_np->np_accept_mutex);
|
|
INIT_LIST_HEAD(&isert_np->np_accept_list);
|
|
INIT_LIST_HEAD(&isert_np->np_accept_list);
|
|
init_completion(&isert_np->np_login_comp);
|
|
init_completion(&isert_np->np_login_comp);
|
|
@@ -3047,18 +3048,6 @@ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int
|
|
|
|
-isert_check_accept_queue(struct isert_np *isert_np)
|
|
|
|
-{
|
|
|
|
- int empty;
|
|
|
|
-
|
|
|
|
- mutex_lock(&isert_np->np_accept_mutex);
|
|
|
|
- empty = list_empty(&isert_np->np_accept_list);
|
|
|
|
- mutex_unlock(&isert_np->np_accept_mutex);
|
|
|
|
-
|
|
|
|
- return empty;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int
|
|
static int
|
|
isert_rdma_accept(struct isert_conn *isert_conn)
|
|
isert_rdma_accept(struct isert_conn *isert_conn)
|
|
{
|
|
{
|
|
@@ -3151,16 +3140,14 @@ isert_accept_np(struct iscsi_np *np, struct iscsi_conn *conn)
|
|
int max_accept = 0, ret;
|
|
int max_accept = 0, ret;
|
|
|
|
|
|
accept_wait:
|
|
accept_wait:
|
|
- ret = wait_event_interruptible(isert_np->np_accept_wq,
|
|
|
|
- !isert_check_accept_queue(isert_np) ||
|
|
|
|
- np->np_thread_state == ISCSI_NP_THREAD_RESET);
|
|
|
|
|
|
+ ret = down_interruptible(&isert_np->np_sem);
|
|
if (max_accept > 5)
|
|
if (max_accept > 5)
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
spin_lock_bh(&np->np_thread_lock);
|
|
spin_lock_bh(&np->np_thread_lock);
|
|
if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
|
|
if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
|
|
spin_unlock_bh(&np->np_thread_lock);
|
|
spin_unlock_bh(&np->np_thread_lock);
|
|
- pr_err("ISCSI_NP_THREAD_RESET for isert_accept_np\n");
|
|
|
|
|
|
+ pr_debug("ISCSI_NP_THREAD_RESET for isert_accept_np\n");
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
}
|
|
}
|
|
spin_unlock_bh(&np->np_thread_lock);
|
|
spin_unlock_bh(&np->np_thread_lock);
|