Page MenuHomeFreeBSD

ctld: Use freebsd::fd_up to manage the lifecycle of accepted sockets
ClosedPublic

Authored by jhb on Mon, Aug 4, 7:58 PM.
Tags
None
Referenced Files
F127571802: D51729.id159725.diff
Tue, Sep 2, 11:19 AM
F127566279: D51729.id159894.diff
Tue, Sep 2, 10:17 AM
Unknown Object (File)
Sat, Aug 30, 2:18 PM
Unknown Object (File)
Sat, Aug 30, 11:29 AM
Unknown Object (File)
Tue, Aug 26, 3:27 PM
Unknown Object (File)
Tue, Aug 26, 10:19 AM
Unknown Object (File)
Tue, Aug 26, 10:06 AM
Unknown Object (File)
Tue, Aug 26, 5:15 AM
Subscribers

Details

Summary

Explicitly hand off ownership of accepted sockets to the
portal::handle_connection method.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 65956
Build 62839: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Mon, Aug 4, 7:58 PM
asomers added inline comments.
usr.sbin/ctld/iscsi.cc
419

The existence of lines like this one almost defeats the purpose of the patch. But I suppose the patch still represents incremental progress, and this part could be improved in the future.

This revision is now accepted and ready to land.Tue, Aug 5, 2:38 PM
usr.sbin/ctld/iscsi.cc
419

The conn structure is something from libiscsiutil that is shared with iscsid and iscsictl for the initiator side. conn_fd still retains "ownership" of the fd and auto-closes on destruction at least. If the other consumers switch to C++ in some form (or at least libiscsiutil uses a C++ class for its connection object), then the fd could be moved into this, yes. And probably conn_fd would not even be needed in that case.

This pattern is realized a bit better on the NVMe side, though even there it is somewhat imperfect as libnvmf still works with C structures.