Skip to content
Commit 82c6265f authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Update parsing of btrfs filesystem show for the UUID (#733601)

Issue 1/2 - GParted shows warnings for mounted btrfs file systems

'btrfs filesystem show /dev/PTN' command is used to query details of a
btrfs file system.  When the file system is mounted the command reports
failed exit status 1, but only when using btrfs-progs v3.14 and v3.14.1.
This causes GParted to: (1) report warnings from the failed commands for
a mounted btrfs file system, (2) fail to determine file system usage
figures and (3) fail to display the mount point and busy indicator for
non-mounting devices in multi-device btrfs file systems.  The label is
also read using the secondary blkid method via the FS_Info cache.

Failed exit status 1 when the btrfs file system is mounted:

    # fgrep sdb1 /proc/mounts
    /dev/sdb1 /mnt/1 btrfs rw,seclabel,relatime,space_cache 0 0
    # btrfs filesystem show /dev/sdb1
    Label: 'test1-btrfs'  uuid: 033e6b07-ee6a-4620-a585-8580a2b83275
            Total devices 1 FS bytes used 192.00KiB
            devid    1 size 2.00GiB used 240.75MiB path /dev/sdb1

    Btrfs v3.14.1
    # echo $?
    1

Successful exit status 0 when the btrfs file system is unmounted:

    # umount /dev/sdb1
    # btrfs filesystem show /dev/sdb1
    Label: 'test1-btrfs'  uuid: 033e6b07-ee6a-4620-a585-8580a2b83275
            Total devices 1 FS bytes used 192.00KiB
            devid    1 size 2.00GiB used 240.75MiB path /dev/sdb1

    Btrfs v3.14.1
    # echo $?
    0

Fix by ignoring the exit status of the 'btrfs filesystem show' command
and rely on parsing the required information to determine success or
failure.  The output from the older 'btrfs-show' command is almost
identical so the same code will parse it in all cases.

Patch 1/4 - btrfs::read_uuid()

This patch changes the secondary method used to read the btrfs UUID to
resolve issue 1/2 as described above.

Bug #733601 - Btrfs: Warnings and missing label with btrfs-progs 3.12
              and 3.14
parent 3bea0675
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment