Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any new target will not be registered after removing all registered targets. #38

Closed
wncboy opened this issue Apr 4, 2018 · 9 comments
Closed
Assignees
Labels

Comments

@wncboy
Copy link

wncboy commented Apr 4, 2018

I found an issue, if I remove all registered targets, after that, any new target will not be registered successfully, and target-isns return "error in response (status = 3)".
iSNS server is Open-iSNS server, and the version is 0.97.
target-isns version 0.6.4.
The kernel version of the device is 4.4.118.x86/Linux

@cvubrugier
Copy link
Collaborator

Thank you for reporting the issue.
I managed to reproduce it with the following scenario:

  1. Start isnsd and target-isns in foreground.
  2. Create target A with targetcli. It is registered.
  3. Create target B. It is registered
  4. Delete target B. It is deregistered
  5. Delete target A. It is deregistered.
  6. Create target C. It is not registered. The status returned by isnsd is invalid registration.

I don't know what the root cause is and will try to devote some time to investigate it during the next week.

@cvubrugier cvubrugier self-assigned this Apr 5, 2018
@cvubrugier cvubrugier added the bug label Apr 5, 2018
@wncboy
Copy link
Author

wncboy commented Apr 8, 2018

Thank you for your reply, and I await to hear your good news about this bug.

@wncboy
Copy link
Author

wncboy commented Apr 16, 2018

@cvubrugier Have you fixed this issue?

@cvubrugier
Copy link
Collaborator

Have you fixed this issue?

Sorry, no. I spent some time investigating bug I still don't understand why the registration is declared invalid.

@cvubrugier
Copy link
Collaborator

The registration is invalid because the registration PDU includes information about a TPG that refers to a network portal which is no longer known by the iSNS server. In this case, the registration PDU should include information about the network portal as well.

After all targets are deregistered, the iSNS server removes information about the network portals. See section 5.6.5.4 in RFC 4171:

Upon receiving the DevDereg, the iSNS server removes all objects identified by the Operating Attribute(s), and all subordinate objects that are solely dependent on those identified objects.

This bug is a side effect of commit ed1b924 "Do not register a portal if it is already registered" which fixed a bug with the Microsoft iSNS server.

cvubrugier added a commit that referenced this issue Apr 29, 2018
According to RFC 4171 (iSNS)

  5.6.5.4. Device Deregister Request (DevDereg)

  Upon receiving the DevDereg, the iSNS server removes all objects
  identified by the Operating Attribute(s), and all subordinate
  objects that are solely dependent on those identified objects.

The iSNS server removes a portal when no target depends on it. Thus,
we have to mark a portal as no longer registered when its reference
counter reaches zero so that when a new target is later registered,
the portal is registered too.

This patch fixes issue #38.

Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
@cvubrugier
Copy link
Collaborator

Hi @wncboy,

I committed a fix and merged it in the master branch. I would appreciate if you could test again and confirm that the issue is fixed. Thanks!

@wncboy
Copy link
Author

wncboy commented May 3, 2018

Thank you for your support, I will test master branch today, and tell you the test results.

@cvubrugier
Copy link
Collaborator

I committed other changes to fix issue #40. Updating a target after its portals are changed should work better now.

@wncboy
Copy link
Author

wncboy commented May 4, 2018

@cvubrugier I have tested this patch on my device, it is work fine, but I will continue to test it, if it has any bug, I will report to you immediately.

@wncboy wncboy closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants