lib/iscsi: Add portal_group_resume() and add pause parameter to portal_group_open()
Add an new function iscsi_portal_group_resume() and add an new parameter pause to iscsi_portal_group_open(). They will be used in the following patches to pause listening portals while target nodes are created at start-up because Windows hosts do not retry login. Pausing and resuming portal group is possible because we can unlisten temporarily by simply not calling accept(). Any inbound connection requests are queued to the backlog and once the backlog queue is full, further inbound connection requests are simply dropped. If we restart calling accept(), we will dequeue the backlog and be ready for more connecitons. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: If7403f91ebd729b47d98a23e589cba8b35569dc6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5088 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
602b134fa2
commit
8381b98ef4
@ -794,7 +794,7 @@ rpc_iscsi_create_portal_group(struct spdk_jsonrpc_request *request,
|
||||
iscsi_portal_grp_add_portal(pg, portal);
|
||||
}
|
||||
|
||||
rc = iscsi_portal_grp_open(pg);
|
||||
rc = iscsi_portal_grp_open(pg, false);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("portal_grp_open failed\n");
|
||||
goto out;
|
||||
|
@ -212,6 +212,22 @@ iscsi_portal_close(struct spdk_iscsi_portal *p)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_portal_pause(struct spdk_iscsi_portal *p)
|
||||
{
|
||||
assert(p->acceptor_poller != NULL);
|
||||
|
||||
spdk_poller_pause(p->acceptor_poller);
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_portal_resume(struct spdk_iscsi_portal *p)
|
||||
{
|
||||
assert(p->acceptor_poller != NULL);
|
||||
|
||||
spdk_poller_resume(p->acceptor_poller);
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_parse_redirect_addr(struct sockaddr_storage *sa,
|
||||
const char *host, const char *port)
|
||||
@ -382,7 +398,7 @@ iscsi_portal_grps_destroy(void)
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg)
|
||||
iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg, bool pause)
|
||||
{
|
||||
struct spdk_iscsi_portal *p;
|
||||
int rc;
|
||||
@ -392,6 +408,10 @@ iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg)
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (pause) {
|
||||
iscsi_portal_pause(p);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -406,6 +426,16 @@ iscsi_portal_grp_close(struct spdk_iscsi_portal_grp *pg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
iscsi_portal_grp_resume(struct spdk_iscsi_portal_grp *pg)
|
||||
{
|
||||
struct spdk_iscsi_portal *p;
|
||||
|
||||
TAILQ_FOREACH(p, &pg->head, per_pg_tailq) {
|
||||
iscsi_portal_resume(p);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
iscsi_portal_grp_close_all(void)
|
||||
{
|
||||
|
@ -90,7 +90,8 @@ void iscsi_portal_grps_destroy(void);
|
||||
int iscsi_portal_grp_register(struct spdk_iscsi_portal_grp *pg);
|
||||
struct spdk_iscsi_portal_grp *iscsi_portal_grp_unregister(int tag);
|
||||
struct spdk_iscsi_portal_grp *iscsi_portal_grp_find_by_tag(int tag);
|
||||
int iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg);
|
||||
int iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg, bool pause);
|
||||
void iscsi_portal_grp_resume(struct spdk_iscsi_portal_grp *pg);
|
||||
int iscsi_portal_grp_set_chap_params(struct spdk_iscsi_portal_grp *pg,
|
||||
bool disable_chap, bool require_chap,
|
||||
bool mutual_chap, int32_t chap_group);
|
||||
|
@ -229,7 +229,7 @@ portal_grp_add_delete_case(void)
|
||||
iscsi_portal_grp_add_portal(pg1, p);
|
||||
|
||||
MOCK_SET(spdk_sock_listen, &sock);
|
||||
rc = iscsi_portal_grp_open(pg1);
|
||||
rc = iscsi_portal_grp_open(pg1, false);
|
||||
CU_ASSERT(rc == 0);
|
||||
MOCK_CLEAR_P(spdk_sock_listen);
|
||||
|
||||
@ -275,7 +275,7 @@ portal_grp_add_delete_twice_case(void)
|
||||
iscsi_portal_grp_add_portal(pg1, p);
|
||||
|
||||
MOCK_SET(spdk_sock_listen, &sock);
|
||||
rc = iscsi_portal_grp_open(pg1);
|
||||
rc = iscsi_portal_grp_open(pg1, false);
|
||||
CU_ASSERT(rc == 0);
|
||||
|
||||
rc = iscsi_portal_grp_register(pg1);
|
||||
@ -290,7 +290,7 @@ portal_grp_add_delete_twice_case(void)
|
||||
|
||||
iscsi_portal_grp_add_portal(pg2, p);
|
||||
|
||||
rc = iscsi_portal_grp_open(pg2);
|
||||
rc = iscsi_portal_grp_open(pg2, false);
|
||||
CU_ASSERT(rc == 0);
|
||||
|
||||
rc = iscsi_portal_grp_register(pg2);
|
||||
|
Loading…
Reference in New Issue
Block a user