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
Created attachment 149051 [details] /proc/self/mounts
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.
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
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
There's currently a patch out for this: https://patchwork.kernel.org/patch/4842201/