Description
System information
| Type | Version/Name |
|---|---|
| Distribution Name | Ubuntu |
| Distribution Version | 17.04 |
| Linux Kernel | 4.10.0-22-generic |
| Architecture | x86_64 |
| ZFS Version | 0.6.5.9 |
| SPL Version | 0.6.5.9 |
Describe the problem you're observing
I have found a data corruption issue in zfs send. In pools using 1M recordsize, incremental sends without the -L flag sometimes silently zero out some files. The results are repeatable. Scrub does not find any errors.
Tested on Ubuntu Xenial with 0.6.5.6 and Zesty with 0.6.5.9 on the same systems.
Describe how to reproduce the problem
Source pool:
root@oddity:~# modinfo zfs
filename: /lib/modules/4.10.0-22-generic/kernel/zfs/zfs/zfs.ko
version: 0.6.5.9-2
license: CDDL
author: OpenZFS on Linux
description: ZFS
srcversion: 42C4AB70887EA26A9970936
depends: spl,znvpair,zcommon,zunicode,zavl
vermagic: 4.10.0-22-generic SMP mod_unload
...
root@oddity:~# zpool status
pool: tank
state: ONLINE
scan: scrub canceled on Sun Jun 11 09:52:38 2017
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-2AH166_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
ata-ST4000VN000-1H4168_XXXXXXXX ONLINE 0 0 0
errors: No known data errors
root@oddity:~# zpool get all tank
NAME PROPERTY VALUE SOURCE
tank size 29T -
tank capacity 57% -
tank altroot - default
tank health ONLINE -
tank guid 18319514605431597227 default
tank version - default
tank bootfs - default
tank delegation on default
tank autoreplace off default
tank cachefile - default
tank failmode wait default
tank listsnapshots off default
tank autoexpand off default
tank dedupditto 0 default
tank dedupratio 1.00x -
tank free 12.3T -
tank allocated 16.7T -
tank readonly off -
tank ashift 12 local
tank comment - default
tank expandsize - -
tank freeing 0 default
tank fragmentation 5% -
tank leaked 0 default
tank feature@async_destroy enabled local
tank feature@empty_bpobj active local
tank feature@lz4_compress active local
tank feature@spacemap_histogram active local
tank feature@enabled_txg active local
tank feature@hole_birth active local
tank feature@extensible_dataset active local
tank feature@embedded_data active local
tank feature@bookmarks enabled local
tank feature@filesystem_limits enabled local
tank feature@large_blocks active local
root@oddity:~# zfs get all tank
NAME PROPERTY VALUE SOURCE
tank type filesystem -
tank creation Fri May 13 19:22 2016 -
tank used 11.8T -
tank available 8.13T -
tank referenced 222K -
tank compressratio 1.03x -
tank mounted yes -
tank quota none default
tank reservation none default
tank recordsize 1M local
tank mountpoint /tank default
tank sharenfs off default
tank checksum on default
tank compression lz4 local
tank atime off local
tank devices on default
tank exec on default
tank setuid on default
tank readonly off default
tank zoned off default
tank snapdir hidden default
tank aclinherit passthrough local
tank canmount on default
tank xattr sa local
tank copies 1 default
tank version 5 -
tank utf8only off -
tank normalization none -
tank casesensitivity mixed -
tank vscan off default
tank nbmand off default
tank sharesmb off default
tank refquota none default
tank refreservation none default
tank primarycache all default
tank secondarycache all default
tank usedbysnapshots 154K -
tank usedbydataset 222K -
tank usedbychildren 11.8T -
tank usedbyrefreservation 0 -
tank logbias latency default
tank dedup off default
tank mlslabel none default
tank sync standard default
tank refcompressratio 1.00x -
tank written 0 -
tank logicalused 12.8T -
tank logicalreferenced 41K -
tank filesystem_limit none default
tank snapshot_limit none default
tank filesystem_count none default
tank snapshot_count none default
tank snapdev hidden default
tank acltype posixacl local
tank context none default
tank fscontext none default
tank defcontext none default
tank rootcontext none default
tank relatime off default
tank redundant_metadata all default
tank overlay off default
The target pool:
root@ubackup:~# modinfo zfs
filename: /lib/modules/4.10.0-22-generic/kernel/zfs/zfs/zfs.ko
version: 0.6.5.9-2
license: CDDL
author: OpenZFS on Linux
description: ZFS
srcversion: 42C4AB70887EA26A9970936
depends: spl,znvpair,zcommon,zunicode,zavl
vermagic: 4.10.0-22-generic SMP mod_unload
...
root@ubackup:~# zpool status
pool: btank
state: ONLINE
scan: scrub repaired 0 in 3h36m with 0 errors on Tue Jun 13 13:34:08 2017
config:
NAME STATE READ WRITE CKSUM
btank ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
ata-WDC_WD30EZRX-00MMMB0_WD-XXXXXXXXXXXX ONLINE 0 0 0
errors: No known data errors
root@ubackup:~# zpool get all btank
NAME PROPERTY VALUE SOURCE
btank size 24.5T -
btank capacity 23% -
btank altroot - default
btank health ONLINE -
btank guid 14601555808903550874 default
btank version - default
btank bootfs - default
btank delegation on default
btank autoreplace off default
btank cachefile - default
btank failmode wait default
btank listsnapshots off default
btank autoexpand off default
btank dedupditto 0 default
btank dedupratio 1.00x -
btank free 18.9T -
btank allocated 5.64T -
btank readonly off -
btank ashift 12 local
btank comment - default
btank expandsize - -
btank freeing 0 default
btank fragmentation 9% -
btank leaked 0 default
btank feature@async_destroy enabled local
btank feature@empty_bpobj active local
btank feature@lz4_compress active local
btank feature@spacemap_histogram active local
btank feature@enabled_txg active local
btank feature@hole_birth active local
btank feature@extensible_dataset active local
btank feature@embedded_data active local
btank feature@bookmarks enabled local
btank feature@filesystem_limits enabled local
btank feature@large_blocks active local
root@ubackup:~# zfs get all btank
NAME PROPERTY VALUE SOURCE
btank type filesystem -
btank creation Mon Jun 12 18:41 2017 -
btank used 5.01T -
btank available 16.1T -
btank referenced 171K -
btank compressratio 1.03x -
btank mounted yes -
btank quota none default
btank reservation none default
btank recordsize 1M local
btank mountpoint /btank default
btank sharenfs off default
btank checksum on default
btank compression lz4 local
btank atime off local
btank devices on default
btank exec on default
btank setuid on default
btank readonly off default
btank zoned off default
btank snapdir hidden default
btank aclinherit passthrough local
btank canmount on default
btank xattr sa local
btank copies 1 default
btank version 5 -
btank utf8only on -
btank normalization formD -
btank casesensitivity mixed -
btank vscan off default
btank nbmand off default
btank sharesmb off default
btank refquota none default
btank refreservation none default
btank primarycache all default
btank secondarycache all default
btank usedbysnapshots 0 -
btank usedbydataset 171K -
btank usedbychildren 5.01T -
btank usedbyrefreservation 0 -
btank logbias latency default
btank dedup off default
btank mlslabel none default
btank sync disabled local
btank refcompressratio 1.00x -
btank written 171K -
btank logicalused 5.18T -
btank logicalreferenced 40K -
btank filesystem_limit none default
btank snapshot_limit none default
btank filesystem_count none default
btank snapshot_count none default
btank snapdev hidden default
btank acltype posixacl local
btank context none default
btank fscontext none default
btank defcontext none default
btank rootcontext none default
btank relatime off default
btank redundant_metadata all default
btank overlay off default
While the issue was observed with multiple datasets, I'll focus on a smaller one. First, the source (some uneventful snapshots omitted):
root@oddity:~# zfs list -o space -r tank/dataz/Backup
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
tank/dataz/Backup 8.13T 126G 461K 126G 0 0
root@oddity:~# zfs list -t snapshot -r tank/dataz/Backup
NAME USED AVAIL REFER MOUNTPOINT
tank/dataz/Backup@zfs-auto-snap_monthly-2017-06-01-0100 0 - 125G -
tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-1900 0 - 125G -
tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-2000 205K - 125G -
tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-2100 0 - 126G -
tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-13-0900 0 - 126G -
The initial send to ubackup has been performed with the -L and -e flags (not sure if this is relevant). Then performing an incremental send with the -L flag produces the expected result (size differences are due to different pool geometry):
root@oddity:~# zfs send -L -e -I tank/dataz/Backup@zfs-auto-snap_monthly-2017-06-01-0100 tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-13-0900 | ssh ubackup "zfs receive btank/oddity/tank/dataz/Backup"
root@ubackup:~# zfs list -o space -r btank/oddity/tank/dataz/Backup
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
btank/oddity/tank/dataz/Backup 16.0T 133G 754K 133G 0 0
root@ubackup:~# zfs list -t snapshot -r btank/oddity/tank/dataz/Backup
NAME USED AVAIL REFER MOUNTPOINT
btank/oddity/tank/dataz/Backup@zfs-auto-snap_monthly-2017-06-01-0100 14.2K - 131G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-1900 14.2K - 131G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-2000 156K - 131G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-2100 14.2K - 133G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-13-0900 0 - 133G -
But repeating the same send without the -L flag results in corruption:
root@ubackup:~# zfs rollback -r btank/oddity/tank/dataz/Backup@zfs-auto-snap_monthly-2017-06-01-0100
root@oddity:~# zfs send -e -I tank/dataz/Backup@zfs-auto-snap_monthly-2017-06-01-0100 tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-13-0900 | ssh ubackup "zfs receive btank/oddity/tank/dataz/Backup"
root@ubackup:~# zfs list -o space -r btank/oddity/tank/dataz/Backup
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
btank/oddity/tank/dataz/Backup 16.0T 133G 19.0G 114G 0 0
root@ubackup:~# zfs list -t snapshot -r btank/oddity/tank/dataz/Backup
NAME USED AVAIL REFER MOUNTPOINT
btank/oddity/tank/dataz/Backup@zfs-auto-snap_monthly-2017-06-01-0100 14.2K - 131G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-1900 14.2K - 131G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-2000 156K - 112G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-12-2100 14.2K - 114G -
btank/oddity/tank/dataz/Backup@zfs-auto-snap_hourly-2017-06-13-0900 0 - 114G -
Notice how the REFER size drops and the USEDSNAP increase between the two runs. I looked around to find where the data had gone missing and found several random files whose reported sizes on disk were reduced to 512 bytes. Reading these files seems to return the full original size but with content all zeros.
I repeated the whole process multiple times, also recreating the target pool, with the same result. The affected files are always the same, but I haven't found a common characteristic among them. Scrubbing both pools finds no errors. Syslog shows nothing uncommon. I have never noted something similar before. The only notable change I made recently was that I started using sa based xattrs in May, but that might be unrelated.
I am happy to provide more info as far as I'm able.