Re: Closing enbd devices
"Peter T. Breuer" <[email protected]>
| Newsgroups | gmane.linux.enbd.general |
|---|---|
| Message-ID | <[email protected]> |
"Also sprach Dag Sverre Seljebotn:"
> Is there a way to fully close enbd devices? Stopping enbd-client only
> seems to stop the device from working,
Sounds closed to me. What do you mean by closed ...
> it stays open and can't be reused
> with a different signature (the symptoms leading me to that conclusion:
Oh, I see. That's what you mean! It's not really intended to be used
with a different remote resource. That would be like changing your hard
disk without telling the IDE subsystem.
> Yes, I've read the gotcha on the webpage, but my use case is different:
Well, nowadays the server always generates the same (pseudo random)
signature for the same resource. So you shouldn't notice anything if
you don't give the signature and then reconnect, provided nothing
changed.
> Using enbd with LTSP to connect remote devices on clients. I have a
> daemon script on the clients checking for devices, and a service running
> on the server which can register or unregister devices, thus device
> assignment is automatic.
>
> While I could hardcode a signature, I had the understanding that more
> than one connection to the same client with the same signature is not a
> good idea? (It doesn't run the stat services though, so if you say it is
Yes, same sig and same server can confuse the reconnect mechanism, in
theory. All in all, you're right, I wouldn't really recommend it. I
wouldn't even try it, myself. It's asking for trouble. But it may work!
> safe then fine). Dynamically assigning signatures that are hard-coded
> per device adds unnecesarry complexity to my device registering
> protocol.
>
> If I could just close the devices I would be happy (any messages I can
> send to /proc/nbdinfo perhaps?). Running 2.4.32pre (thanks a lot for the
> -m switch!).
I don't really understand why you need different sigs (or same sigs).
If you want to wipe the existing sig on a device I guess that would be
easy enough to add - it needs an ioctl. A quick glance through the code
at all references to ->signature and ENBD_SIGNED shows me nothing at
present that unsets it.
What I do see is that the soft_reset function USED to clear the
signature:
//lo->flags &= ~ENBD_SIGNED; /* PTB unsign the device */
but it's commented. You might want to uncomment it and tell me what
happens. It will make the signature disappear on a soft reset (or hard
reset, since that calls soft_reset too).
A soft reset is effected by an ENBD_RESET ioctl on the device, or by
writing a 0 to /proc/nbdinfo (but that does it on every device).
Oh - it looks as though if show_errors is set (and it is not, by
default) soft reset's also done by a clr_sock call, which will happen on
the last client to die every time all the client daemons on the device
die. Or the master client will call that explicitly if it can.
There is an opportunity to do it also from /proc/nbdinfo in the "reset" or
"zero" commands. That would entail adding the line that wipes the
SIGNED flag to the enbd_reset or enbd_sero_counters functions
respectively. Or you could add a command/function to precisely set or
wipe the signature using the model of any of the functions listed in the
procfns[] array.
What do you think?
Peter