Bug 83741 - Regression: "btrfs send" does not work if the subvol is part of /
Summary: Regression: "btrfs send" does not work if the subvol is part of /
Status: RESOLVED PATCH_ALREADY_AVAILABLE
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-02 09:20 UTC by Jan Steffens
Modified: 2014-09-29 20:57 UTC (History)
4 users (show)

See Also:
Kernel Version: 3.16.1
Subsystem:
Regression: No
Bisected commit-id:


Attachments
/proc/self/mounts (2.51 KB, text/plain)
2014-09-02 09:22 UTC, Jan Steffens
Details

Description Jan Steffens 2014-09-02 09:20:49 UTC
Sienc btrfs-progs commit de22c28ef31d9721606ba05965a093a8044be0de (part of v3.16), "btrfs send /foo >/dev/null" is broken and complains:

ERROR: /foo doesn't belong to btrfs mount point

/foo is a subvolume on a btrfs mounted at /. Send works with a btrfs mounted somewhere else.

I assume this happens because the code that inspects /proc/self/mounts uses the "rootfs" entry instead of the "btrfs" entry that follows.

Arch Linux x86_64, kernel 3.16.1
Comment 1 Jan Steffens 2014-09-02 09:22:15 UTC
Created attachment 149051 [details]
/proc/self/mounts
Comment 2 Jan Steffens 2014-09-02 09:42:55 UTC
Maybe /proc/self/mounts needs to be checked in reverse, taking the first prefix that matches?

If I have a btrfs at /mnt/data, then mount a tmpfs at /mnt and create the directory /mnt/data, "btrfs send /mnt/data" will attempt to send that path and make an inappropriate ioctl.
Comment 3 Larkin Lowrey 2014-09-10 23:39:30 UTC
I have encountered this in a slightly different way. I have create a snapshot of the root for backup purpose. I am getting the following:

# btrfs sub sh /snapshot
ERROR: /snapshot doesn't belong to btrfs mount point

Snapshots for other btrfs filesystems on the same machine work just fine so it's only root snapshots that are affected.

Here's an excerpt of my /proc/self/mounts:

# grep -E '\W/\W|Root' /proc/self/mounts
rootfs / rootfs rw 0 0
/dev/mapper/Cached-Root / btrfs rw,relatime,ssd,space_cache 0 0
/dev/mapper/Cached-Root /root/backup/mnt btrfs rw,relatime,ssd,space_cache 0 0


I'm running:
btrfs-progs-3.16-1.fc20.x86_64
kernel-3.15.10-201.fc20.x86_64
Comment 4 Timo Derstappen 2014-09-13 16:43:44 UTC
I have nearly the same situation with a root btrfs and docker.

$ grep dm-0 /proc/self/mounts
/dev/dm-0 / btrfs rw,noatime,ssd,discard,space_cache 0 0
/dev/dm-0 /var/lib/docker/btrfs btrfs rw,noatime,ssd,discard,space_cache 0 0

The subvolumes below the docker tree work fine, but within root I get the same error. 

$ btrfs subvolume show /
ERROR: / doesn't belong to btrfs mount point

$ uname -r
3.16.2-1-ARCH

$ btrfs --version
Btrfs v3.16
Comment 5 Omar Sandoval 2014-09-14 07:52:12 UTC
There's currently a patch out for this: https://patchwork.kernel.org/patch/4842201/

Note You need to log in before you can comment on or make changes to this bug.