Re: [Nbd] [RFC]Some questions about NBD
- To: harryxiyou <harryxiyou@...17...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] [RFC]Some questions about NBD
- From: Wouter Verhelst <w@...112...>
- Date: Sat, 11 Feb 2012 17:24:44 +0100
- Message-id: <20120211162444.GA4143@...3...>
- In-reply-to: <CAD+1EGMEGOVnauvP3MRz_=YPJgVGuoosJWNL-20VDbn-jJayrQ@...18...>
- References: <CAD+1EGMEGOVnauvP3MRz_=YPJgVGuoosJWNL-20VDbn-jJayrQ@...18...>
[Paul and I both read the list; no need to add Cc]
On Sat, Feb 11, 2012 at 12:50:19AM +0800, harryxiyou wrote:
> Hi Wouter,
>
> I have some questions to ask you, which are like following.
>
> 1, Pavel said "Unlike NFS, it is possible to put any file system on it. But
> (also unlike NFS), if someone has mounted NBD read/write, you must
> assure that no one else will have it mounted. " on his own page. The
> URL is http://atrey.karlin.mff.cuni.cz/~pavel/nbd/nbd.html . But i can not
> understand '' if someone has mounted NBD read/write, you must
> assure that no one else will have it mounted.". What is exact meaning of
> this sentence.
> One of my thoughts looks like this. We have two users, a1
> and a2 , who
> have logined into a Linux OS. If a1 mounted NBD read/write, a2 must not
> mount it currently, right?
Yeah, pretty much.
> 2, I have seen the main function of nbd-server.c, which version is nbd-2.9.15.
> Some stuffs confuse me like following.
> 1> 1882 line: memset(pidftemplate, '\0', 256);
> I just see pidftemplate is used in the daemon function.
> But i am not
> sure what the pid file is used for.
So we can easily kill the server afterwards, if needs be.
> And also i don't know the meaning of this daemon function in nbd-server.c.
detach from stdin and stdout, and start serving as a background daemon.
> 2> 1873: SERVER *server;
> If we have (server != NULL && (0 == server->port)) we will
> execute inetd
> mode. I have searched the characters of inetd but i am not sure what the
> meanings of inetd in our nbd-server.c do. And in what
> situations, we will do
> the inetd mode, which should do what jobs?
inetd is an "internet superdaemon", used to run services without having
to have a separate process running for each and every service (at least,
as long as no client is using the service).
> 3> 1928: dousers();
> I just tracked this function. It looks like it will set the
> running group and user informations.
Correct.
> Why should we do this?
Because some people think it's a bad idea to run a service as root.
> Is it related to what
> pavel said
> "if someone has mounted NBD read/write, you must assure that no one else
> will have it mounted". Right ?
No.
--
The volume of a pizza of thickness a and radius z can be described by
the following formula:
pi zz a
Reply to: