{"action":"created","comment":{"url":"https://api.github.com/repos/openebs/istgt/pulls/comments/207510601","pull_request_review_id":143138345,"id":207510601,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzUxMDYwMQ==","diff_hunk":"@@ -500,6 +499,59 @@ trigger_rebuild(spec_t *spec)\n \t}\n }\n \n+static bool\n+is_replica_familiar(spec_t *spec, replica_t *new_replica)\n+{\n+\tknown_replica_t *kr = NULL;\n+\tint familiar_replicas = 0;\n+\tbool ret = false, found = false;\n+\treplica_t *old_replica = NULL;\n+\n+\tASSERT(MTX_LOCKED(&spec->rq_mtx));\n+\n+\tTAILQ_FOREACH(kr, &spec->identified_replica, next) {\n+\t\tfamiliar_replicas++;\n+\t\tif (kr->zvol_guid == new_replica->zvol_guid) {\n+\t\t\tfound = true;\n+\t\t\tif (!kr->is_connected) {\n+\t\t\t\tret = true;\n+\t\t\t\tkr->is_connected = true;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (!found && familiar_replicas < spec->replication_factor) {\n+\t\tkr = malloc(sizeof (known_replica_t));\n+\t\tkr->zvol_guid = new_replica->zvol_guid;\n+\t\tkr->is_connected = true;\n+\t\tret = true;\n+\t\tTAILQ_INSERT_TAIL(&spec->identified_replica, kr, next);\n+\t}\n+\n+\t/*\n+\t * If the target has already an active session with this replica\n+\t * then the target will disconnect from the previous session and\n+\t * allow a new session\n+\t */\n+\tif (found && !ret) {\n+\t\tTAILQ_FOREACH(old_replica, &spec->rq, r_next) {\n+\t\t\tif (old_replica->zvol_guid == new_replica->zvol_guid) {\n+\t\t\t\tMTX_UNLOCK(&spec->rq_mtx);\n+\t\t\t\tREPLICA_LOG(\"Disconnecting replica(%lu)'s old \"\n+\t\t\t\t    \"session\\n\", old_replica->zvol_guid);\n+\t\t\t\thandle_mgmt_conn_error(old_replica, 0, NULL, 0);","path":"src/replication.c","position":53,"original_position":53,"commit_id":"57d19436557af4ffea2d07e7291a7a0a1385de68","original_commit_id":"03b24b1724895fa415144b80782232f0b989551c","user":{"login":"mynktl","id":33252549,"node_id":"MDQ6VXNlcjMzMjUyNTQ5","avatar_url":"https://avatars2.githubusercontent.com/u/33252549?v=4","gravatar_id":"","url":"https://api.github.com/users/mynktl","html_url":"https://github.com/mynktl","followers_url":"https://api.github.com/users/mynktl/followers","following_url":"https://api.github.com/users/mynktl/following{/other_user}","gists_url":"https://api.github.com/users/mynktl/gists{/gist_id}","starred_url":"https://api.github.com/users/mynktl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mynktl/subscriptions","organizations_url":"https://api.github.com/users/mynktl/orgs","repos_url":"https://api.github.com/users/mynktl/repos","events_url":"https://api.github.com/users/mynktl/events{/privacy}","received_events_url":"https://api.github.com/users/mynktl/received_events","type":"User","site_admin":false},"body":"Good find!\r\nWe will not allow a new connection due to complexity. At this point, we won't be able to know any pending events on old replica session.","created_at":"2018-08-03T10:57:06Z","updated_at":"2018-08-03T10:57:06Z","html_url":"https://github.com/openebs/istgt/pull/52#discussion_r207510601","pull_request_url":"https://api.github.com/repos/openebs/istgt/pulls/52","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/openebs/istgt/pulls/comments/207510601"},"html":{"href":"https://github.com/openebs/istgt/pull/52#discussion_r207510601"},"pull_request":{"href":"https://api.github.com/repos/openebs/istgt/pulls/52"}},"in_reply_to_id":207227896},"pull_request":{"url":"https://api.github.com/repos/openebs/istgt/pulls/52","id":199930798,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5OTMwNzk4","html_url":"https://github.com/openebs/istgt/pull/52","diff_url":"https://github.com/openebs/istgt/pull/52.diff","patch_url":"https://github.com/openebs/istgt/pull/52.patch","issue_url":"https://api.github.com/repos/openebs/istgt/issues/52","number":52,"state":"open","locked":false,"title":"[TA1290]  Identifying the replicas that can connect to target","user":{"login":"mynktl","id":33252549,"node_id":"MDQ6VXNlcjMzMjUyNTQ5","avatar_url":"https://avatars2.githubusercontent.com/u/33252549?v=4","gravatar_id":"","url":"https://api.github.com/users/mynktl","html_url":"https://github.com/mynktl","followers_url":"https://api.github.com/users/mynktl/followers","following_url":"https://api.github.com/users/mynktl/following{/other_user}","gists_url":"https://api.github.com/users/mynktl/gists{/gist_id}","starred_url":"https://api.github.com/users/mynktl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mynktl/subscriptions","organizations_url":"https://api.github.com/users/mynktl/orgs","repos_url":"https://api.github.com/users/mynktl/repos","events_url":"https://api.github.com/users/mynktl/events{/privacy}","received_events_url":"https://api.github.com/users/mynktl/received_events","type":"User","site_admin":false},"body":"Changes : \r\nAdded support for identifying replicas connecting to the target.\r\nWith this change,\r\n1. The target will allow session from any replica until the number of connected(active or closed session) replicas reaches to replication factor limit. Once the replication factor limit reaches, Target will not allow any new replica to connect.\r\n2. If the target has already an active session with a replica(`zvol_guid` is `12`) and same replica(with `zvol_guid` `12`) tries to make a new session with the target then the target will disconnect from the previous session and allow the new replica to connect.\r\n\r\nBug fix for replica cleanup path in data connection (in `handle_data_conn_error`).\r\n\r\nSigned-off-by: mayank <mayank.patel@cloudbyte.com>","created_at":"2018-07-08T08:10:09Z","updated_at":"2018-08-03T10:57:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e70faadfea01a66f8922209d331194d7b71991d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/openebs/istgt/pulls/52/commits","review_comments_url":"https://api.github.com/repos/openebs/istgt/pulls/52/comments","review_comment_url":"https://api.github.com/repos/openebs/istgt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openebs/istgt/issues/52/comments","statuses_url":"https://api.github.com/repos/openebs/istgt/statuses/57d19436557af4ffea2d07e7291a7a0a1385de68","head":{"label":"mynktl:TA1290","ref":"TA1290","sha":"57d19436557af4ffea2d07e7291a7a0a1385de68","user":{"login":"mynktl","id":33252549,"node_id":"MDQ6VXNlcjMzMjUyNTQ5","avatar_url":"https://avatars2.githubusercontent.com/u/33252549?v=4","gravatar_id":"","url":"https://api.github.com/users/mynktl","html_url":"https://github.com/mynktl","followers_url":"https://api.github.com/users/mynktl/followers","following_url":"https://api.github.com/users/mynktl/following{/other_user}","gists_url":"https://api.github.com/users/mynktl/gists{/gist_id}","starred_url":"https://api.github.com/users/mynktl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mynktl/subscriptions","organizations_url":"https://api.github.com/users/mynktl/orgs","repos_url":"https://api.github.com/users/mynktl/repos","events_url":"https://api.github.com/users/mynktl/events{/privacy}","received_events_url":"https://api.github.com/users/mynktl/received_events","type":"User","site_admin":false},"repo":{"id":127879765,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc4Nzk3NjU=","name":"istgt","full_name":"mynktl/istgt","owner":{"login":"mynktl","id":33252549,"node_id":"MDQ6VXNlcjMzMjUyNTQ5","avatar_url":"https://avatars2.githubusercontent.com/u/33252549?v=4","gravatar_id":"","url":"https://api.github.com/users/mynktl","html_url":"https://github.com/mynktl","followers_url":"https://api.github.com/users/mynktl/followers","following_url":"https://api.github.com/users/mynktl/following{/other_user}","gists_url":"https://api.github.com/users/mynktl/gists{/gist_id}","starred_url":"https://api.github.com/users/mynktl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mynktl/subscriptions","organizations_url":"https://api.github.com/users/mynktl/orgs","repos_url":"https://api.github.com/users/mynktl/repos","events_url":"https://api.github.com/users/mynktl/events{/privacy}","received_events_url":"https://api.github.com/users/mynktl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mynktl/istgt","description":null,"fork":true,"url":"https://api.github.com/repos/mynktl/istgt","forks_url":"https://api.github.com/repos/mynktl/istgt/forks","keys_url":"https://api.github.com/repos/mynktl/istgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mynktl/istgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mynktl/istgt/teams","hooks_url":"https://api.github.com/repos/mynktl/istgt/hooks","issue_events_url":"https://api.github.com/repos/mynktl/istgt/issues/events{/number}","events_url":"https://api.github.com/repos/mynktl/istgt/events","assignees_url":"https://api.github.com/repos/mynktl/istgt/assignees{/user}","branches_url":"https://api.github.com/repos/mynktl/istgt/branches{/branch}","tags_url":"https://api.github.com/repos/mynktl/istgt/tags","blobs_url":"https://api.github.com/repos/mynktl/istgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mynktl/istgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mynktl/istgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/mynktl/istgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mynktl/istgt/statuses/{sha}","languages_url":"https://api.github.com/repos/mynktl/istgt/languages","stargazers_url":"https://api.github.com/repos/mynktl/istgt/stargazers","contributors_url":"https://api.github.com/repos/mynktl/istgt/contributors","subscribers_url":"https://api.github.com/repos/mynktl/istgt/subscribers","subscription_url":"https://api.github.com/repos/mynktl/istgt/subscription","commits_url":"https://api.github.com/repos/mynktl/istgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/mynktl/istgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/mynktl/istgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/mynktl/istgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/mynktl/istgt/contents/{+path}","compare_url":"https://api.github.com/repos/mynktl/istgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mynktl/istgt/merges","archive_url":"https://api.github.com/repos/mynktl/istgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mynktl/istgt/downloads","issues_url":"https://api.github.com/repos/mynktl/istgt/issues{/number}","pulls_url":"https://api.github.com/repos/mynktl/istgt/pulls{/number}","milestones_url":"https://api.github.com/repos/mynktl/istgt/milestones{/number}","notifications_url":"https://api.github.com/repos/mynktl/istgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mynktl/istgt/labels{/name}","releases_url":"https://api.github.com/repos/mynktl/istgt/releases{/id}","deployments_url":"https://api.github.com/repos/mynktl/istgt/deployments","created_at":"2018-04-03T08:56:06Z","updated_at":"2018-04-03T08:56:08Z","pushed_at":"2018-08-03T07:53:56Z","git_url":"git://github.com/mynktl/istgt.git","ssh_url":"git@github.com:mynktl/istgt.git","clone_url":"https://github.com/mynktl/istgt.git","svn_url":"https://github.com/mynktl/istgt","homepage":null,"size":1013,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openebs:replication","ref":"replication","sha":"1be05f60d7407c6b588b77ba226aef496bf61c12","user":{"login":"openebs","id":20769039,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNzY5MDM5","avatar_url":"https://avatars0.githubusercontent.com/u/20769039?v=4","gravatar_id":"","url":"https://api.github.com/users/openebs","html_url":"https://github.com/openebs","followers_url":"https://api.github.com/users/openebs/followers","following_url":"https://api.github.com/users/openebs/following{/other_user}","gists_url":"https://api.github.com/users/openebs/gists{/gist_id}","starred_url":"https://api.github.com/users/openebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openebs/subscriptions","organizations_url":"https://api.github.com/users/openebs/orgs","repos_url":"https://api.github.com/users/openebs/repos","events_url":"https://api.github.com/users/openebs/events{/privacy}","received_events_url":"https://api.github.com/users/openebs/received_events","type":"Organization","site_admin":false},"repo":{"id":123117757,"node_id":"MDEwOlJlcG9zaXRvcnkxMjMxMTc3NTc=","name":"istgt","full_name":"openebs/istgt","owner":{"login":"openebs","id":20769039,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNzY5MDM5","avatar_url":"https://avatars0.githubusercontent.com/u/20769039?v=4","gravatar_id":"","url":"https://api.github.com/users/openebs","html_url":"https://github.com/openebs","followers_url":"https://api.github.com/users/openebs/followers","following_url":"https://api.github.com/users/openebs/following{/other_user}","gists_url":"https://api.github.com/users/openebs/gists{/gist_id}","starred_url":"https://api.github.com/users/openebs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openebs/subscriptions","organizations_url":"https://api.github.com/users/openebs/orgs","repos_url":"https://api.github.com/users/openebs/repos","events_url":"https://api.github.com/users/openebs/events{/privacy}","received_events_url":"https://api.github.com/users/openebs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openebs/istgt","description":null,"fork":false,"url":"https://api.github.com/repos/openebs/istgt","forks_url":"https://api.github.com/repos/openebs/istgt/forks","keys_url":"https://api.github.com/repos/openebs/istgt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openebs/istgt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openebs/istgt/teams","hooks_url":"https://api.github.com/repos/openebs/istgt/hooks","issue_events_url":"https://api.github.com/repos/openebs/istgt/issues/events{/number}","events_url":"https://api.github.com/repos/openebs/istgt/events","assignees_url":"https://api.github.com/repos/openebs/istgt/assignees{/user}","branches_url":"https://api.github.com/repos/openebs/istgt/branches{/branch}","tags_url":"https://api.github.com/repos/openebs/istgt/tags","blobs_url":"https://api.github.com/repos/openebs/istgt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openebs/istgt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openebs/istgt/git/refs{/sha}","trees_url":"https://api.github.com/repos/openebs/istgt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openebs/istgt/statuses/{sha}","languages_url":"https://api.github.com/repos/openebs/istgt/languages","stargazers_url":"https://api.github.com/repos/openebs/istgt/stargazers","contributors_url":"https://api.github.com/repos/openebs/istgt/contributors","subscribers_url":"https://api.github.com/repos/openebs/istgt/subscribers","subscription_url":"https://api.github.com/repos/openebs/istgt/subscription","commits_url":"https://api.github.com/repos/openebs/istgt/commits{/sha}","git_commits_url":"https://api.github.com/repos/openebs/istgt/git/commits{/sha}","comments_url":"https://api.github.com/repos/openebs/istgt/comments{/number}","issue_comment_url":"https://api.github.com/repos/openebs/istgt/issues/comments{/number}","contents_url":"https://api.github.com/repos/openebs/istgt/contents/{+path}","compare_url":"https://api.github.com/repos/openebs/istgt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openebs/istgt/merges","archive_url":"https://api.github.com/repos/openebs/istgt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openebs/istgt/downloads","issues_url":"https://api.github.com/repos/openebs/istgt/issues{/number}","pulls_url":"https://api.github.com/repos/openebs/istgt/pulls{/number}","milestones_url":"https://api.github.com/repos/openebs/istgt/milestones{/number}","notifications_url":"https://api.github.com/repos/openebs/istgt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openebs/istgt/labels{/name}","releases_url":"https://api.github.com/repos/openebs/istgt/releases{/id}","deployments_url":"https://api.github.com/repos/openebs/istgt/deployments","created_at":"2018-02-27T11:10:49Z","updated_at":"2018-07-28T21:47:50Z","pushed_at":"2018-08-03T07:53:57Z","git_url":"git://github.com/openebs/istgt.git","ssh_url":"git@github.com:openebs/istgt.git","clone_url":"https://github.com/openebs/istgt.git","svn_url":"https://github.com/openebs/istgt","homepage":null,"size":776,"stargazers_count":6,"watchers_count":6,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":9,"open_issues":6,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openebs/istgt/pulls/52"},"html":{"href":"https://github.com/openebs/istgt/pull/52"},"issue":{"href":"https://api.github.com/repos/openebs/istgt/issues/52"},"comments":{"href":"https://api.github.com/repos/openebs/istgt/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/openebs/istgt/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/openebs/istgt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openebs/istgt/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/openebs/istgt/statuses/57d19436557af4ffea2d07e7291a7a0a1385de68"}},"author_association":"NONE"}}
{"actor":{"display_login":"mynktl"}}