Issuing the "btrfs send" command from sys-fs/btrfs-progs-3.12 fails and exits with a an error. It works perfectly with sys-fs/btrfs-progs-0.20_rc1_p358 though. Reproducible: Always Steps to Reproduce: 1.install sys-fs/btrfs-progs-3.12 on a btrfs enabled system 2.execute e.g. "btrfs send <subvolume> > /dev/null" on a btrfs read-only subvolume (snapshot) 3. Actual Results: ERROR: open <subvolume> failed. No such file or directory Expected Results: send btrfs subvolume stream to stdout btrfs send/receive is used for doing fast full and incremental backups between btrfs filesystems. emerge --info: Portage 2.2.7 (default/linux/amd64/13.0/desktop/gnome, gcc-4.7.3, glibc-2.17, 3.12.0-tom_4 x86_64) ================================================================= System uname: Linux-3.12.0-tom_4-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.2 KiB Mem: 6107304 total, 943092 free KiB Swap: 6399996 total, 6399996 free Timestamp of tree: Wed, 27 Nov 2013 11:15:01 +0000 ld GNU ld (GNU Binutils) 2.23.2 distcc 3.1 x86_64-pc-linux-gnu [disabled] ccache version 3.1.9 [disabled] app-shells/bash: 4.2_p45 dev-java/java-config: 2.2.0::java-overlay dev-lang/python: 2.7.5-r4, 3.2.5-r3, 3.3.3 dev-util/ccache: 3.1.9-r3 dev-util/cmake: 2.8.12.1-r1 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.12.4 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.4_p6-r1, 1.9.6-r3, 1.10.3, 1.11.6, 1.12.6, 1.13.2, 1.14 sys-devel/binutils: 2.23.2 sys-devel/gcc: 4.6.4, 4.7.3-r1, 4.8.2 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 4.0 sys-kernel/linux-headers: 3.12 (virtual/os-headers) sys-libs/glibc: 2.17 Repositories: gentoo local zugaina science ramereth kde-sunset eva eyolfson bitcoin ladi bangert java-overlay proaudio tmacedo amielke-overlay retroshare-overlay sunrise foo-overlay maggu2810-overlay gentoo-zh roslin gentoo-haskell Krontage armagetron ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=native -msse4.1 -pipe -ggdb" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.0/conf /usr/share/maven-bin-3.1/conf /usr/share/polkit-1/actions /var/bind /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -march=native -msse4.1 -pipe -ggdb" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--jobs --load-average=8 --with-bdeps y" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="ftp://gentoo.inode.at/source http://gentoo.inode.at ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j8" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/zugaina /var/lib/layman/science /var/lib/layman/ramereth /var/lib/layman/kde-sunset /var/lib/layman/eva /var/lib/layman/eyolfson /var/lib/layman/bitcoin /var/lib/layman/ladi /var/lib/layman/bangert /var/lib/layman/java-overlay /var/lib/layman/pro-audio /var/lib/layman/tmacedo /var/lib/layman/amielke-overlay /var/lib/layman/retroshare-overlay /var/lib/layman/sunrise /var/lib/layman/foo-overlay /var/lib/layman/maggu2810-overlay /var/lib/layman/gentoo-zh /var/lib/layman/roslin /var/lib/layman/haskell /var/lib/layman/krontage /var/lib/layman/armagetron" SYNC="rsync://rsync1.at.gentoo.org/gentoo-portage" USE="X a52 aac aalib acl acpi alsa amd64 amr apache2 avahi avi bash-completion berkdb bitmap-fonts bluetooth branding bzip2 cairo caps cdda cdr cli clutter colord cpdflib cracklib crypt css cuda cups curl curlwrappers cxx dba dbus dga dio divx4linux dri dts dv dvd dvdr dvdread eds emboss encode evo exif fam ffmpeg fftw firefox flac flash foomaticdb fortran ftp fuse gconf gd gdbm gif glitz gmp gnome gnome-keyring gnome-online-accounts gphoto2 gpm gstreamer gtk gtk2 gtk3 gtkhtml iconv icu ieee1394 imagemagick imap imlib introspection ipv6 jack java java6 javascript jpeg kipi ladspa lcms ldap libcaca libnotify libsecret libvisual logrotate lzo mad matroska mbrola mime ming mmx mng modules mono mp3 mp4 mpeg mudflap multilib mysql nas nautilus ncurses networkmanager nls nptl nptlonly nvidia odbc ogg opengl openmp osc pam pango pcmcia pcre pdf pdflib php plotutils png pnp policykit ppds pulseaudio qt3support qt4 quicktime readline samba scanner sdl session sharedmem shotwell smartcard smp socialweb sockets sox speex spell sse sse2 ssl ssse3 startup-notification svg systemd tcpd theora threads tiff tracker truetype type1 udev udisks unicode upower usb userlocales utf8 v4l v4l2 vcd vdpau vhosts vorbis wifi win32codecs wxwidgets wxwindows x264 xattr xcb xinerama xml xml2 xrandr xulrunner xv xvid xvmc zeitgeist zlib zvbi" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="unixd actions authn_core authz_core alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so socache_shmcb speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="event" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="pdfimport" LINGUAS="en de" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi sub" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2 python3_3" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby19 ruby18" SANE_BACKENDS="pixma net" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" USE_PYTHON="2.7 3.2 3.3" Unset: CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Works fine for me. I'm on Linux 3.11.7. floppym@naomi ~ % btrfs --version Btrfs v3.12 floppym@naomi ~ % sudo btrfs subvol show /mnt/data1/boot-backup /mnt/data1/boot-backup Name: boot-backup uuid: 32235765-1819-fb47-8bc4-053db99446b6 Parent uuid: 5085203c-aa12-674e-8d37-c294def3a3c4 Creation time: 2013-11-28 13:53:23 Object ID: 994 Generation (Gen): 1679478 Gen at creation: 1679478 Parent: 5 Top Level: 5 Flags: readonly Snapshot(s): floppym@naomi ~ % sudo btrfs send /mnt/data1/boot-backup > /dev/null At subvol /mnt/data1/boot-backup
Could you please possibly try it on 3.12? I'm on 3.12 where it's not working.
Same result with Linux 3.12.1.
I found it! The reason why it doesn't work for me is that I'm using "btrfs send" in a filesystem which is not mounted from the root subvolume of the btrfs but from a subvolume created below the root subvolume, e.g.: mount -t btrfs -o subvol=foo /dev/sda1 /mnt It is obviously a bug in the btrfs-progs git that was introduced a few weeks ago (when sys-fs/btrfs-progs-9999 stopped working for me). This bug also exists in the commit where sys-fs/btrfs-progs-3.12 was taken from. The bug was not in sys-fs/btrfs-progs-0.20_rc1_p358 though which is still working for me.
I have reported this issue upstream to the btrfs mailing list.
The bug has been confirmed upstream and a patch is in the works. http://thread.gmane.org/gmane.comp.file-systems.btrfs/30482
Solution: Wait for upstream fix, in the meantime use sys-fs/btrfs-progs-0.20_rc1_p358 if you need "btrfs send" in the described, problematic case.
Created attachment 364246 [details, diff] [PATCH v2] Btrfs-progs: avoid using btrfs internal subvolume path to send.patch I've added epatch_user call to latest ebuilds: > 30 Nov 2013; Sergei Trofimovich <slyfox@gentoo.org> btrfs-progs-3.12.ebuild, > btrfs-progs-9999.ebuild: > Added 'epatch_user' to ease testing of fixes (bug #492776). Thus you can put attached file to /etc/portage/patches/sys-fs/btrfs-progs and rebuild btrfs-progs to see if it halps for your case. The patch picked from: http://www.spinics.net/lists/linux-btrfs/msg29570.html Thanks for the report!
The patch works for me. Thank you!
(In reply to Thomas Scheiblauer from comment #9) > The patch works for me. > Thank you! Sweet! Pushed that patch as a 3.12-r1: >*btrfs-progs-3.12-r1 (30 Nov 2013) > > 30 Nov 2013; Sergei Trofimovich <slyfox@gentoo.org> > +btrfs-progs-3.12-r1.ebuild, > +files/btrfs-progs-3.12-fix-send-subvol-492776.patch, btrfs-progs-9999.ebuild: > Fix 'btrfs send' on funky subvol paths (bug #492776 by Thomas Scheiblauer). As Chris and Josef are busy moving to facebook patches will likely get upstream a bit late. Thanks for for doing the hardest part, guys!
(In reply to Sergei Trofimovich from comment #10) > As Chris and Josef are busy moving to facebook > patches will likely get upstream a bit late. Regardless, I generally prefer not to apply backported patches in live ebuilds; it guarantees that the ebuild will break when the fix is committed upstream.
(In reply to Mike Gilbert from comment #11) > (In reply to Sergei Trofimovich from comment #10) > > As Chris and Josef are busy moving to facebook > > patches will likely get upstream a bit late. > > Regardless, I generally prefer not to apply backported patches in live > ebuilds; it guarantees that the ebuild will break when the fix is committed > upstream. I usually try not to touch them as well, but btrfs-progs repo gets updates very sporadically. Patches can be available for months and people keep rediscovering the same bug. I can remove it from live ebuild if you would still like to.
It's fine; just wanted to throw my 2 cents in.