qemu-nbd -c /dev/nbd0 fails to map partitions

Bug #1743026 reported by Chris J Arges
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Triaged
High
Unassigned
Xenial
Triaged
High
Unassigned

Bug Description

[impact]
4.4.0-101+ (also 4.4.0-109) Ubuntu kernels no longer can use qemu-nbd to mount virtual disks onto a local filesystem (see test case for reproducer). 4.4.0-98 works without issue.

I was able to bisect the issue down to 907196aba0d891c6d580abe69c36d3b4fd512dcc (a cherry-pick from 37091fdd831f28a6509008542174ed324dd645bc). Reverting this from 4.4 fixes the issue.

Installing the mainline kernel shows mainline is _not_ affected by this bug.

In addition this is also reported in debian here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829532

[test case]
# given a vmdk disk with multiple partitions
sudo modprobe nbd
sudo qemu-nbd -d /dev/nbd0
sudo qemu-nbd -r -c /dev/nbd0 disk.vmdk
ls /dev/nbd0*
# here you won't see multiple partition, nor be able to mount a partition locally

Chris J Arges (arges)
description: updated
description: updated
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1743026

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu Xenial):
status: New → Incomplete
Revision history for this message
Chris J Arges (arges) wrote :

This patch seems to fix the issue:
```
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5f807a6..b761971 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -98,11 +98,6 @@ static inline struct device *nbd_to_dev(struct nbd_device *nbd)
        return disk_to_dev(nbd->disk);
 }

-static bool nbd_is_connected(struct nbd_device *nbd)
-{
- return !!nbd->task_recv;
-}
-
 static const char *nbdcmd_to_ascii(int cmd)
 {
        switch (cmd) {
@@ -126,9 +121,6 @@ static int nbd_size_clear(struct nbd_device *nbd, struct block_device *bdev)

 static void nbd_size_update(struct nbd_device *nbd, struct block_device *bdev)
 {
- if (!nbd_is_connected(nbd))
- return;
-
        bdev->bd_inode->i_size = nbd->bytesize;
        set_capacity(nbd->disk, nbd->bytesize >> 9);
        kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
```

Changed in linux (Ubuntu):
importance: Undecided → High
Changed in linux (Ubuntu Xenial):
importance: Undecided → High
status: Incomplete → Triaged
Changed in linux (Ubuntu):
status: Incomplete → Triaged
tags: added: kernel-da-key
Revision history for this message
Chris J Arges (arges) wrote :

Just a note the patch in #2 is most likely not correct, just a way for me to narrow down the problem. Perhaps we missed a patch (or there is a fix) that makes nbd_is_connected to the correct thing.

Revision history for this message
heavendang (heavendang) wrote :

there is a way to workaround it, use partprobe

it is the original solution:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824553

Brad Figg (brad-figg)
tags: added: cscc
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.