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

Re: [Nbd] nbd-server only active if an interface is active in Linux

Hello Wouter

I tested the workaround with the 3.8 version. I can tell if the 3.8 is actually running on the system by typing:

./nbd-server -help

I created a config file whenever the USB drive has to be shared via NBD:

cat /tmp/nbd.conf
oldstyle = true
exportname = /dev/sdb1
port = 9000
readonly = true

The nbd-server throws this warnings when it's run...

./nbd-server -C /tmp/nbd.conf

** (process:353): WARNING **: A port was specified, but oldstyle exports were not requested. This may not do what you expect.

** (process:353): WARNING **: Please read 'man 5 nbd-server' and search for oldstyle for more info

After that, nothing happens. The netstat command shows nothing on the 9000 port.

The same issue is present on the 2.9.23 version.

Only after setting an interface up is when the config file is actually serviced.

You mentioned on your last email you had an idea on how to fix that issue (you were working on tap0 all the time). Could you please share a hint on how to solve it so that I can work on that?

At the moment I made a workaround that whenever an interface is up, I relaunch the nbd-server and it stays alive. However, it's a dirty patch which I would like to solve with the nbd-server binary itself.

Thanks for reading!


El Sábado, 19 de julio, 2014 10:04:15, Santiago Villafuerte <san.link@...1649...> escribió:

Hello Wouter

Yeap, I noticed you were using your personal email to answer my mails, but I thought you were doing so because of all the spam in the list. It was the first time I used a list, so please forgive me if I should have moved the conversation back there =)

Thanks for providing a workaround. The reason we have to use console arguments is that we trigger the nbd-server whenever a USB drive is plugged in. We use mdev and then mdev triggers a script to do so. We can improve that, if it suits the behavior of the nbd-server in a better way.

Thanks again for your advice, I know you are a very busy programmer.

Cheers from Mexico.

Santiago Villafuerte

El Sábado, 19 de julio, 2014 1:25:55, Wouter Verhelst <w@...112...> escribió:

Op woensdag 16 juli 2014 12:01:54 schreef Santiago Villafuerte:
> Hello
> I am running Linux 2.6.31 on an iMX25 from Freescale. We have the nbd-server
> binary (2.9.23 apparently) and we run this command:
> /usr/local/bin/nbd-server 9000 /dev/sda1
> If an ethernet interface is active in Linux (eth0 or usb0), the nbd-server
> stays alive and netstat shows the LISTENING status of the 9000 port:
> Active Internet connections (servers and established)
> Proto Recv-Q Send-Q Local Address          Foreign Address        State
> tcp        0      0  *              LISTEN
> However, when there is no available interface up in the system (only
> localhost -loopback), and the nbd-server is started, it won't stay active
> at all. The netstat -al command does not show the 9000 port as active.

So, it looks like that's a bug which only triggers when you want to do
oldstyle negotiation. The "tests on the train" that I talked about were
invalid, because I forgot that I have a tap0 interface active at all
time for communication with virtual machines.

Of course that shouldn't happen; I can't look at it in detail right now,
but I have a fairly good idea where the problem most likely is. However,
the workaround is fairly simple: Don't use oldstyle negotiation, use
newstyle negotiation. That's a good idea for more reasons than just
making your problem go away:
- It's easier to use on the client side (you need to remember an export
  name rather than a port number)
- It will continue working (oldstyle has been deprecated for a fair
  while now, and I'm seriously considering dropping support for it some
  time soon)

To be able to use newstyle, all you need to do is create a config file
and start nbd-server without arguments. There's a few examples in the
README file that show you how to do it.


It is easy to love a country that is famous for chocolate and beer

  -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26

Reply to: