Skip to contentSkip to conversation

Hibernate and qemu-nbd

Qemu-devel Mark Trumpold 2 participants 5 messages Sep 26, 2013 – Oct 15, 2013

lore
Share & tools
lore
#0 lore raw
Quoted 14 lines

-----Original Message-----
From: Wouter Verhelst [mailto:[email protected]]
Sent: Thursday, September 26, 2013 12:46 PM
To: 'Mark Trumpold'
Cc: [email protected], 'Stefan Hajnoczi', [email protected], 'Paul Clements', [email protected]
Subject: Re: [Nbd] [Qemu-devel] Hibernate and qemu-nbd

Quoted 4 lines · Mark Trumpold

Hello Wouter,

Thank you for your input.

Quoted 17 lines
Quoted 4 lines

I replayed the test as follows:

-> qemu-nbd -p 2000 -persist /root/qemu/q1.img & -> nbd-client localhost 2000 /dev/nbd0

No.

nbd-client -persist localhost 2000 /dev/nbd0

Signature · 6 lines
This end should point toward the ground if you want to go to space.

If it starts pointing toward space you are having a bad problem and you
will not go to space today.

 -- http://xkcd.com/1133/

Sorry guys, I did the email by memory (bad idea).

Actually, what I did:

  849  qemu-nbd -p 2000 /root/qemu/q1.img &
  850  nbd-client -persist localhost 2000 /dev/nbd0
  851  ps aux | grep nbd
  852  echo reboot >/sys/power/disk
  853  echo disk >/sys/power/state

At the prompt after the hibernate (test mode: 'reboot') I see the following:

/build/buildd-qemu_0.12.5+dfsg-3squeeze3-amd64-9wXBnc/qemu-0.12.5+dfsg/nbd.c:nbd_receive_request():L465: read failed
[1]+ Done qemu-nbd -p 2000 /root/qemu/q1.img

================
Looks like 'qemu-nbd' exited on some signal. No other indicators. I see no other relevant messages in syslog.
In dmesg I see the message (as expected):

Sep 26 13:27:13 debian-test kernel: [606754.367766] Freezing user space processes ...
Sep 26 13:27:13 debian-test kernel: [606754.367840] nbd (pid 8432: nbd-client) got signal 0
Sep 26 13:27:13 debian-test kernel: [606754.367844] block nbd0: shutting down socket
Sep 26 13:27:13 debian-test kernel: [606754.367872] block nbd0: Receive control failed (result -4)
Sep 26 13:27:13 debian-test kernel: [606754.367890] block nbd0: queue cleared

================

Thank you,
Mark T.

#1 lore raw
Quoted 29 lines · Mark Trumpold
Quoted 29 lines

-----Original Message-----
From: Wouter Verhelst [mailto:[email protected]]
Sent: Thursday, September 26, 2013 12:46 PM
To: 'Mark Trumpold'
Cc: [email protected], 'Stefan Hajnoczi', [email protected], 'Paul Clements', [email protected]
Subject: Re: [Nbd] [Qemu-devel] Hibernate and qemu-nbd

Quoted 8 lines · Mark Trumpold

Hello Wouter,

Thank you for your input.

I replayed the test as follows:

-> qemu-nbd -p 2000 -persist /root/qemu/q1.img & -> nbd-client localhost 2000 /dev/nbd0

No.

nbd-client -persist localhost 2000 /dev/nbd0

--
This end should point toward the ground if you want to go to space.

If it starts pointing toward space you are having a bad problem and you will not go to space today.

Quoted 7 lines
Quoted 2 lines

-- http://xkcd.com/1133/

Sorry guys, I did the email by memory (bad idea).

Actually, what I did:
849 qemu-nbd -p 2000 /root/qemu/q1.img &

Try the qemu-nbd --persistent option. That should prevent it from shutting down when nbd-client is disconnected.

Stefan

#2 lore raw
Quoted 6 lines · Stefan Hajnoczi

Try the qemu-nbd --persistent option. That should prevent it from shutting down when nbd-client is disconnected.

Stefan

Hi Stefan,

Sorry for the delay..
I tried the following per your suggestion:

  920  qemu-nbd --persistent -p 2000 /root/qemu/q1.img &
  921  nbd-client -persist localhost 2000 /dev/nbd0
  922  fsck /dev/nbd0
  923  mount /dev/nbd0 /mnt
  924  ls /mnt
  925  umount /dev/nbd0

::

  927  echo reboot >/sys/power/disk
  928  echo disk >/sys/power/state
  929  mount /dev/nbd0 /mnt

This seems to work; that is both sides (client and server) persist after the hibernate cycle.

However, if I don't 'umount' '/dev/nbd0' before the hibernate cycle, and try to 'ls /mnt' after, the 'ls' hangs indefinitely.

For my real use case we have the root filesystem mounted, so unmounting is not an option (at least I don't think so).

I also tried remounting readonly, and also 'blockdev --flushbufs ..' before the hibernate cycle -- either or both did not help.

I had thought about trying a 'chroot' and then a 'umount', but have not yet tried this.

This one was so close..

Thank you for all your attention on this.

Best Regards,
Mark T.

#3 lore raw
Quoted 38 lines · Mark Trumpold
Quoted 6 lines · Stefan Hajnoczi

Try the qemu-nbd --persistent option. That should prevent it from shutting down when nbd-client is disconnected.

Stefan

Hi Stefan,

Sorry for the delay..
I tried the following per your suggestion:

  920  qemu-nbd --persistent -p 2000 /root/qemu/q1.img &
  921  nbd-client -persist localhost 2000 /dev/nbd0
  922  fsck /dev/nbd0
  923  mount /dev/nbd0 /mnt
  924  ls /mnt
  925  umount /dev/nbd0

::

  927  echo reboot >/sys/power/disk
  928  echo disk >/sys/power/state
  929  mount /dev/nbd0 /mnt

This seems to work; that is both sides (client and server) persist after the hibernate cycle.

However, if I don't 'umount' '/dev/nbd0' before the hibernate cycle, and try to 'ls /mnt' after, the 'ls' hangs indefinitely.

For my real use case we have the root filesystem mounted, so unmounting is not an option (at least I don't think so).

Quoted 7 lines

I also tried remounting readonly, and also 'blockdev --flushbufs ..' before the hibernate cycle -- either or both did not help.

I had thought about trying a 'chroot' and then a 'umount', but have not yet tried this.

This one was so close..

Too bad. I'm sure it's solvable but would require more debugging and writing qemu-nbd.c and kernel nbd.c fixes. Unfortunately I don't have time to look into it myself.

Stefan

#4 lore raw
Quoted 39 lines · Stefan Hajnoczi
Quoted 38 lines · Mark Trumpold
Quoted 6 lines · Stefan Hajnoczi

Try the qemu-nbd --persistent option. That should prevent it from shutting down when nbd-client is disconnected.

Stefan

Hi Stefan,

Sorry for the delay..
I tried the following per your suggestion:

  920  qemu-nbd --persistent -p 2000 /root/qemu/q1.img &
  921  nbd-client -persist localhost 2000 /dev/nbd0
  922  fsck /dev/nbd0
  923  mount /dev/nbd0 /mnt
  924  ls /mnt
  925  umount /dev/nbd0

::

  927  echo reboot >/sys/power/disk
  928  echo disk >/sys/power/state
  929  mount /dev/nbd0 /mnt

This seems to work; that is both sides (client and server) persist after the hibernate cycle.

However, if I don't 'umount' '/dev/nbd0' before the hibernate cycle, and try to 'ls /mnt' after, the 'ls' hangs indefinitely.

For my real use case we have the root filesystem mounted, so unmounting is not an option (at least I don't think so).

Quoted 7 lines
Quoted 7 lines

I also tried remounting readonly, and also 'blockdev --flushbufs ..' before the hibernate cycle -- either or both did not help.

I had thought about trying a 'chroot' and then a 'umount', but have not yet tried this.

This one was so close..

Could you try drop the umount/mount and capture the following straces:
strace -p $(pgrep nbd-client) -o /var/tmp/nbd-client.strace strace -p $(pgrep qemu-nbd) -o /var/tmp/qemu-nbd.strace

In particular, let's find out what happens when you run ls /mnt after resuming the machine. The nbd-client should reconnect to qemu-nbd and I/O requests would flow to qemu-nbd again. But something is stuck; the problem might be clear from the strace output.

Stefan