open-iscsi / target-isns

Target-isns is an iSNS client for the Linux LIO iSCSI target
GNU General Public License v2.0
16 stars 19 forks source link

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

Closed wncboy closed 6 years ago

wncboy commented 6 years ago

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 commented 6 years ago

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.

wncboy commented 6 years ago

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

wncboy commented 6 years ago

@cvubrugier Have you fixed this issue?

cvubrugier commented 6 years ago

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 commented 6 years ago

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 ed1b924296fd4c3854e4d32a60034b760642d6fa "Do not register a portal if it is already registered" which fixed a bug with the Microsoft iSNS server.

cvubrugier commented 6 years ago

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 commented 6 years ago

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

cvubrugier commented 6 years ago

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

wncboy commented 6 years ago

@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.