Seems with these last patches open-isns behaves properly again. When I switch isns off in tgtd, open-isns deregisters but doesn't go into a spin anymore. Albert On 08/16/2010 11:13 PM, Chandra Seetharaman wrote: > iSNS spec(RFC 4141) Section 5.6.5.4: > > 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. For example, removal of a Network Entity > also results in removal of all associated Portal, Portal Group,Storage Node, > and FC Device objects associated with that Network Entity. > > This patch takes advantage of the above mentioned feature to deregister > all defined targets at once when isns is turned Off by the user by deregistering > the entity. > > Signed-Off-By: Chandra Seetharaman<sekharan at us.ibm.com> > --- > usr/iscsi/isns.c | 44 +++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 41 insertions(+), 3 deletions(-) > > Index: tgt-469b574/usr/iscsi/isns.c > =================================================================== > --- tgt-469b574.orig/usr/iscsi/isns.c > +++ tgt-469b574/usr/iscsi/isns.c > @@ -999,6 +999,39 @@ int isns_init(void) > return 0; > } > > +int isns_eid_deregister(void) > +{ > + char buf[4096]; > + uint16_t flags, length = 0; > + struct isns_hdr *hdr = (struct isns_hdr *) buf; > + struct isns_tlv *tlv; > + struct iscsi_target *target; > + int err; > + > + if (!isns_fd) > + if (isns_connect()< 0) > + return 0; > + > + memset(buf, 0, sizeof(buf)); > + tlv = (struct isns_tlv *) hdr->pdu; > + > + target = list_first_entry(&iscsi_targets_list, > + struct iscsi_target, tlist); > + length += isns_tlv_set_string(&tlv, ISNS_ATTR_ISCSI_NAME, > + tgt_targetname(target->tid)); > + length += isns_tlv_set(&tlv, 0, 0, 0); > + length += isns_tlv_set_string(&tlv, ISNS_ATTR_ENTITY_IDENTIFIER, > + eid); > + flags = ISNS_FLAG_CLIENT | ISNS_FLAG_LAST_PDU | ISNS_FLAG_FIRST_PDU; > + isns_hdr_init(hdr, ISNS_FUNC_DEV_DEREG, length, flags, > + ++transaction, 0); > + > + err = write(isns_fd, buf, length + sizeof(struct isns_hdr)); > + if (err< 0) > + eprintf("%d %m\n", length); > + > + return 0; > +} > void isns_exit(void) > { > struct iscsi_target *target; > @@ -1006,8 +1039,13 @@ void isns_exit(void) > if (!use_isns) > return; > > - list_for_each_entry(target,&iscsi_targets_list, tlist) > - isns_target_deregister(tgt_targetname(target->tid)); > + if (num_targets) { > + del_work(&timeout_work); > + list_for_each_entry(target,&iscsi_targets_list, tlist) > + free_all_acl(target); > + > + isns_eid_deregister(); > + } > > if (isns_fd) { > tgt_event_del(isns_fd); > @@ -1022,7 +1060,7 @@ void isns_exit(void) > close(scn_fd); > } > > - use_isns = isns_fd = scn_listen_fd = scn_fd = 0; > + num_targets = use_isns = isns_fd = scn_listen_fd = scn_fd = 0; > free(rxbuf); > } > > > > -- > To unsubscribe from this list: send the line "unsubscribe stgt" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html |