g_udev_client_query_by_device_number fails on btrfs disks

Bug #1197796 reported by Jussi Pakkanen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd
Invalid
Medium
systemd (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

g_udev_client_query_by_device_number works on files that are on regular filesystems but fails on btrfs volumes.

To replicate, download the attached source file.

Compile it: gcc -Wall -o idnum idnum.c `pkg-config --cflags --libs glib-2.0 gio-2.0 gudev-1.0`

This happens on ext4:

./idnum
Device id is 2065.

This happens on btrfs:

./idnum
Device id is 25.
Could not get device from num.

The file layout is the default as provided by the ubuntu installer. That is, the volume has two subvolumes called @ and @home.

Filed against systemd package, because that's where ubuntu-bug forwarded me.

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: libgudev-1.0-0 1:198-0ubuntu11.1
ProcVersionSignature: Ubuntu 3.8.0-26.38-generic 3.8.13.2
Uname: Linux 3.8.0-26-generic x86_64
ApportVersion: 2.9.2-0ubuntu8.2
Architecture: amd64
Date: Thu Jul 4 15:34:20 2013
InstallationDate: Installed on 2013-05-20 (45 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
MarkForUpload: True
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

This same thing happens on encrypted home directories. Maybe an issue with subvolumes?

Revision history for this message
In , Jussi Pakkanen (jpakkane) wrote :

Created attachment 82191
Source code to demonstrate the issue

Sorry if this bug is filed in the wrong place. Information on GUdev is sparse and as far as I can tell, systemd is the upstream.

Anyway, the g_udev_client_query_by_device_number function fails on directories that are in subvolumes. An example is a btrfs file system with two subvolumes, @ (mounted as root) and @home (mounted as /home). This also happens when using encrypted home directories.

Having a subvolume might not be the real reason it fails, but that is what seems to be triggering the issue.

To replicate, download the attached source code. Compile it with "gcc -Wall -o idnum idnum.c `pkg-config --cflags --libs glib-2.0 gio-2.0 gudev-1.0`".

When run on a plain ext4 volume, the output is this:

./idnum
Device id is 2065.

Whereas on btrfs the output is this:

./idnum
Device id is 25.
Could not get device from num.

Originally filed here: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1197796

Revision history for this message
In , Kay Sievers (kaysievers) wrote :

Btrfs volumes are like NFS or tmpfs, a superblock without any associated
device. The behavior is expected and intentional.

Btrfs volumes might be constructed of many volumes, there cannot be the
concept of *that* device, like the "dumb" filesystems use.

There is no way for the udev API to find out which device is behind
a btrfs volume. Btrfs specific command need to be used to determine that,
no generic interface exists for that task.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Upstream closed this as not a bug:

https://bugs.freedesktop.org/show_bug.cgi?id=66702

Revision history for this message
In , Jussi Pakkanen (jpakkane) wrote :

Would it be possible for you to add a comment to the reference documentation about this so other people don't have to spend time with this issue? The page on GUdevClient does not mention subvolumes.

Changed in systemd:
importance: Unknown → Medium
status: Unknown → Invalid
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
status: New → Won't Fix
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.