broken error handling for broken xattr FS implementation
Backing up a FUSE based ObjectiveFS filesystem results in the following error:
Traceback (most recent call last):
File "borg/archiver.py", line 2052, in main
File "borg/archiver.py", line 1997, in run
File "borg/archiver.py", line 90, in wrapper
File "borg/archiver.py", line 305, in do_create
File "borg/archiver.py", line 278, in create_inner
File "borg/archiver.py", line 348, in _process
File "borg/archive.py", line 605, in process_dir
File "borg/archive.py", line 594, in stat_attrs
File "borg/xattr.py", line 43, in get_all
File "borg/xattr.py", line 220, in getxattr
File "borg/xattr.py", line 164, in _getxattr_inner
File "borg/helpers.py", line 735, in get
File "borg/helpers.py", line 725, in resize
ValueError: Requested buffer size 33554432 is above the limit of 16777216.
Platform: Linux ip-172-31-12-165 3.13.0-101-lowlatency #148-Ubuntu SMP PREEMPT Thu Oct 20 22:48:47 UTC 2016 x86_64 x86_64
Linux: debian jessie/sid
Borg: 1.0.9 Python: CPython 3.5.2
PID: 2542 CWD: /tmp
sys.argv: ['./borg-linux64', 'create', '--stats', '--debug', '/mnt/borg_backup::OFS-Backup-now', '/ofs/']
SSH_ORIGINAL_COMMAND: None
This is the relevant strace:
[pid 2542] 04:52:48 lstat("/ofs", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=0, ...}) = 0
[pid 2542] 04:52:48 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 5
[pid 2542] 04:52:48 open("/etc/group", O_RDONLY|O_CLOEXEC) = 5
[pid 2542] 04:52:48 llistxattr("/ofs", "\0\0\0\0\0\0\0\0", 4096) = 8
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x1e9fc80, 4096) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x1f1d5b0, 8192) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x1f1f5c0, 16384) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x1f235d0, 32768) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x1f2b5e0, 65536) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x1f3b5f0, 131072) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f2922027010, 262144) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f2921fa6010, 524288) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f2921ea5010, 1048576) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f2921ca4010, 2097152) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f29218a3010, 4194304) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f29210a2010, 8388608) = -1 ERANGE (Numerical result out of range)
[pid 2542] 04:52:48 lgetxattr("/ofs", "", 0x7f29200a1010, 16777216) = -1 ERANGE (Numerical result out of range)
From my understanding it looks like the array of null-terminated character strings \0\0\0\0\0\0\0\0 is causing the issue?
Not sure if this is a bug in Borg or ObjectiveFS, as the linux attr command works as expected:
strace -f -t -e trace=file attr -l /ofs
06:04:31 execve("/usr/bin/attr", ["attr", "-l", "/ofs"], [/* 23 vars */]) = 0
06:04:31 llistxattr("/ofs", "\0\0\0\0\0\0\0\0", 65536) = 8
06:04:31 +++ exited with 0 +++
strace -f -t -e trace=file attr -l /ofs/all_dbs.sql.gz
05:57:04 execve("/usr/bin/attr", ["attr", "-l", "/ofs/all_dbs.sql.gz"], [/* 23 vars */]) = 0
05:57:04 llistxattr("/ofs/all_dbs.sql.gz", "user.user.name\0", 65536) = 15
05:57:04 lgetxattr("/ofs/all_dbs.sql.gz", "user.user.name", 0x0, 0) = 4
Attribute "user.name" has a 4 byte value for /ofs/all_dbs.sql.gz
05:57:04 +++ exited with 0 +++
Backing up a file with an extended attribute set results in a successful backup:
attr -s user.name -V test /ofs/all_dbs.sql.gz
./borg-linux64 create --stats --debug /mnt/borg_backup::OFS-Backup-now /ofs/all_dbs.sql.gz
using builtin fallback logging configuration
Enter passphrase for key /mnt/borg_backup:
TAM-verified manifest
Reading files cache ...
Processing files ...
------------------------------------------------------------------------------
Archive name: OFS-Backup-now
Archive fingerprint: 565567fefdd19bbe577b88d49ec7f7c2d2fb138d71e99709751573cf0c2edb78
Time (start): Tue, 2017-01-03 05:30:45
Time (end): Tue, 2017-01-03 05:30:52
Duration: 6.98 seconds
Number of files: 1
------------------------------------------------------------------------------
Original size Compressed size Deduplicated size
This archive: 76.94 MB 76.94 MB 76.94 MB
All archives: 76.94 MB 76.94 MB 76.94 MB
Unique chunks Total chunks
Chunk index: 29 29
------------------------------------------------------------------------------
Thank you very much in advance for your help and if you need any further data please let me know.
From my understanding it looks like the array of null-terminated character strings \0\0\0\0\0\0\0\0 is causing the issue?
Yes, it looks like four issues working together:
-
The FS doesn't have any xattrs on the object, but does not return an empty list from llistxattr; instead a list of 7 empty strings is returned (FS bug)
-
Borg does not ignore empty attribute names (but it probably should, Borg bug)
-
When asked to retrieve the empty attributes the FS earlier said existed it always fails with ERANGE, indicating that the supplied buffer is too small, instead of ENOATTR (FS bug)
-
Running out of buffer space in xattr retrieval should probably be contained to the file in question and not abort the backup. (Borg bug)
From your testing it looks like this special FS behaviour only happens on the mountpoint /ofs, and not on files in the FS? If so, /ofs/* might work for you as a workaround.
Unfortunately it happens for files as well, removed the xattr from the file in the working example above and it returns the same error:
[pid 2416] 12:25:29 llistxattr("/ofs/all_dbs.sql.gz", "\0\0\0\0\0\0\0\0", 4096) = 8
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x1f2d5c0, 4096) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x212c950, 8192) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x212e960, 16384) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x2132970, 32768) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x213a980, 65536) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x214a990, 131072) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x216a9a0, 262144) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x21aa9b0, 524288) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x222a9c0, 1048576) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x232a9d0, 2097152) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x7fc61c2e3010, 4194304) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x7fc61bae2010, 8388608) = -1 ERANGE (Numerical result out of range)
[pid 2416] 12:25:29 lgetxattr("/ofs/all_dbs.sql.gz", "", 0x7fc61aae1010, 16777216) = -1 ERANGE (Numerical result out of range)
@MarkusMuellerAU maybe file a bug at ObjectiveFS also.
@ThomasWaldmann: Did file a bug with them a couple of minutes ago.
Merged #1993 which should fix this.
Thanks for the detailed report! :)
#1993 + fixup in #1995