[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] NBD wishlist items?



Wouter Verhelst wrote:
[Paul: This is in response to a mail I sent, asking for wishlist items.
Should probably have Cc'ed you on the original mail, but you may want to
check this and give your opinion]

On Tue, Jun 19, 2007 at 07:22:59PM -0400, Mike Snitzer wrote:
Wouter,

I've got one I'd like to run by you: have the nbd-client detect that
the kernel's nbd connection to the nbd-server is unresponsive.

There is a window of time where a potentially long TCP timeout
prevents the nbd (in kernel) from erroring out back to userspace
(nbd-client).  But if the nbd-client could feel that the nbd isn't
behaving the nbd-client could send a SIGKILL down to the kernel (nbd
driver already aborts TCP transmit if a SIGKILL is received).

Any ideas on how we might pull this off?

I'm thinking it would be good to extend the protocol with two packets,
one PING and one PONG (or so) that could be sent by either the client or
the server, and that could allow either of them to check whether the
other is still there. It should include a timeout of (say) 60 seconds
(this could probably be negotiated during the handshake) during which
the other side has to reply with the appropriate packet; if it doesn't,
it is assumed dead and the connection will be killed.

Yeah, that's the way to do it -- I actually hacked together something similar a long time back, but I've solved it well enough in user-space (by pinging the server address) so I never got the patch into the kernel.

Implementing this backwards-compatibly is going to be the hardest part,
I guess. Perhaps opening one of the NBD devices to call a specific ioctl
to verify whether it supports this interface, and then setting a bit in
the field of 'reserved' bits in the handshake could work, but I'm not
sure how this would be best done.

There'd probably be an ioctl to enable this ping packet, so you could just call the ioctl and ignore failure (for older kernels). Then there'd be a new packet flag for this ping packet (or maybe just use a zero-length read or write, assuming the nbd-server just ignores those and returns a response). That way it would almost completely backward compatible.

--
Paul







Reply to: