Re: [Nbd] [w@...112...: Re: nbd-client started at boot (for root device) is not persistent]
- To: Victor <vixtor@...17...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] [w@...112...: Re: nbd-client started at boot (for root device) is not persistent]
- From: Wouter Verhelst <w@...112...>
- Date: Sun, 27 Nov 2016 17:23:24 +0100
- Message-id: <20161127162324.55mnsegroesep5td@...3...>
- In-reply-to: <CAMOh2pLvgGXJ2YV4_W1bUo6VR3Mtemh8m-WYzNhhmQBt8QW3tw@...18...>
- References: <20161125080636.f6dsb6227ksazolh@...3...> <CAMOh2pLvgGXJ2YV4_W1bUo6VR3Mtemh8m-WYzNhhmQBt8QW3tw@...18...>
Hi Victor,
On Fri, Nov 25, 2016 at 01:23:04PM +0200, Victor wrote:
> I have found an idea that seems to work fine - at least for me: if the process
> cannot find /dev and /sys anymore, it means it was started from initramfs. So i
> recreate /sys and /dev and mount sysfs and devtmpfs again. The VFS tree of
> nbd-client will get a duplicate mount of /dev and /sys but i don't think
> there's any harm in that.
I think there is; it can interfere with proper shutdown, depending on
the init system in use.
A better way is to:
- Check if /sys exists; if not, wait a second rather than checking for a
pid file (perhaps best to ensure we don't fork() until the connection
has been made then, though)
- Check if /dev exists; if not, run mknod(2) on a name in /tmp (or some
such) with the correct attributes, open it, and unlink the file again
This doesn't leave any traces around anymore, and should allow
nbd-client to do what it needs to do.
I'll look into making the necessary changes when next I have time to
work on NBD.
--
< ron> I mean, the main *practical* problem with C++, is there's like a dozen
people in the world who think they really understand all of its rules,
and pretty much all of them are just lying to themselves too.
-- #debian-devel, OFTC, 2016-02-12
Reply to: