qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] Disconecting /dev/nbdX leaves stale partitions and devi


From: Nir Soffer
Subject: Re: [Qemu-block] Disconecting /dev/nbdX leaves stale partitions and device
Date: Thu, 5 Jul 2018 02:27:55 +0300

On Thu, Jul 5, 2018 at 2:10 AM Nir Soffer <address@hidden> wrote:
I'm trying to access a qcow2 image via /dev/nbdX device.

I'm connecting a fedora 27 image (created using virt-builder) on a block
device:

qemu-nbd -c /dev/nbd0 -f qcow2 -n --detect-zeroes=on --aio=native /dev/27837a03-64f9-4f2b-abb0-daa2195b01ae/acb196da-31fc-454d-856b-c31ab24715b3

It works, and I can read and write to the image via /dev/nbd0.

Disconnecting the device "works":

# qemu-nbd -d /dev/nbd0
/dev/nbd0 disconnected

But when trying to connect the image again, I get this error:

# qemu-nbd -c /dev/nbd1 -f qcow2 -n --detect-zeroes=on --aio=native /dev/27837a03-64f9-4f2b-abb0-daa2195b01ae/acb196da-31fc-454d-856b-c31ab24715b3
Failed to set NBD socket
Disconnect client, due to: Unexpected end-of-file before all bytes were read

Turns out each time nbd devices is disconnected, it leaves the device
and all the partitions on it "connected":

# lsblk
...
nbd0                                                                                   43:0    0    6G  0 disk  
├─nbd0p1                                                                               43:1    0    1M  0 part  
├─nbd0p2                                                                               43:2    0    1G  0 part  
├─nbd0p3                                                                               43:3    0  615M  0 part  
└─nbd0p4                                                                               43:4    0  4.4G  0 part  
nbd1                                                                                   43:32   0    6G  0 disk  
├─nbd1p1                                                                               43:33   0    1M  0 part  
├─nbd1p2                                                                               43:34   0    1G  0 part  
├─nbd1p3                                                                               43:35   0  615M  0 part  
└─nbd1p4                                                                               43:36   0  4.4G  0 part  

I tried also to do:

kpartx -d /dev/nbd1
qemu-nbd -d /dev/nbd1

But I get the same results.

Testing on Fedora 28:
kernel-4.17.2-200.fc28.x86_64
qemu-img-2.12.0-0.5.rc1.fc28.x86_64

I forgot to add interesting output from dmesg for this time frame:

[ 3732.125053]  nbd0: p1 p2 p3 p4
[ 4166.089975] block nbd0: NBD_DISCONNECT
[ 4166.090015] block nbd0: shutting down sockets
[ 4246.782630] block nbd0: Device being setup by another task
[ 4281.686230] block nbd0: Device being setup by another task
[ 4313.050593] block nbd0: NBD_DISCONNECT
[ 4313.050599] block nbd0: Send disconnect failed -32
[ 5368.124758] block nbd0: NBD_DISCONNECT
[ 5368.126286] block nbd0: Send disconnect failed -32
[ 5401.208544] block nbd0: Device being setup by another task
[ 5419.492084]  nbd1: p1 p2 p3 p4
[ 5509.058340] block nbd1: NBD_DISCONNECT
[ 5509.058911] block nbd1: shutting down sockets
[ 5606.481571] block nbd1: Device being setup by another task
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]