cloudbase / wnbd

Windows Ceph RBD NBD driver
GNU Lesser General Public License v2.1
60 stars 26 forks source link

[RFE] Consider allowing wnbd-client to setup nbd connection via AF_UNIX unix sockets #116

Open hgkamath opened 1 year ago

hgkamath commented 1 year ago

Description:

Consider the possibility of also allowing AF_UNIX unix-socket connections to a nbd-server also (maybe also rbd-client, if the rbd-protocol also has the same ability)

Since Windows-10 1803 Windows allows for usable AF_UNIX unix-sockets.
AF_UNIX sockets can be used when the processes (storport-wnbd-client and nbd-server) are local.
An emulated socketpair() is also said to be do-able. (but some advanced things like abstract unix-sockets are not do-able) Advantages include:

References

Misc

petrutlucian94 commented 1 year ago

Hi,

Thanks for sending this feature request.

The NBD client functionality is currently implemented at the WNBD driver level. However, the AF_UNIX compatibility layer (built around named pipes as far as I remember) can't easily be used by Windows drivers.

If/when we move the nbd client to userspace (e.g. as part of libwnbd or a separate lib), then we can easily support AF_UNIX. I can't provide an ETA though.

As for RBD, it's no longer using NBD as an IO channel. We went with a different mechanism a while ago, using DeviceIOControl to retrieve IO requests and submit IO replies. It's much more efficient, doesn't require tcp sockets and it allows us to support SCSI features that are not covered by the NBD protocol (e.g. persistent reservations, read FUA, etc).

hgkamath commented 1 year ago

Just FYI, my understanding is that there used to be a userspace compatibility layer based on named pipes. But this AF_UNIX feature goes more native than that. This AF_UNIX feature is implemented by Microsoft as a windows kernel driver. Its a partial implementation that gets unix-sockets, but not socketpair or abstract-unix-sockets. But, if compatibility layers are still required, such as wanting socketpair, then as you say one might need to goto userspace, So I'm hoping compatibility layers would not be required.
The downside is the feature won't work on older Win10 versions, so one would need to check win10 version and turn-off feature if the version is older than 1803. Ref: misc mentions in other projects, some in favor, some not

Like spice-opengl, storport-wnbd-nbd is a use-case where every bit of throughput gained matters.