Hello community, here is the log from the commit of package btrfsprogs for openSUSE:Factory checked in at 2019-09-30 15:51:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/btrfsprogs (Old) and /work/SRC/openSUSE:Factory/.btrfsprogs.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "btrfsprogs" Mon Sep 30 15:51:01 2019 rev:105 rq:732872 version:5.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/btrfsprogs/btrfsprogs.changes 2019-08-07 13:53:42.044857962 +0200 +++ /work/SRC/openSUSE:Factory/.btrfsprogs.new.2352/btrfsprogs.changes 2019-09-30 15:51:02.554550942 +0200 @@ -1,0 +2,15 @@ +Tue Sep 17 10:01:18 UTC 2019 - Frederic Crozat <fcro...@suse.com> + +- Update to 5.2.2: + * check: + * fix false report of wrong byte count for orphan inodes + * option -E was not handled correctly + * new check and repair for root item generation + * balance: check for full-balance before background fork + * mkfs: check that total device size does not overflow 16EiB + * dump-tree: print DEV_STATS key type + * other: + * new and updated tests + * doc fixups and updates + +------------------------------------------------------------------- Old: ---- btrfs-progs-v5.2.1.tar.gz New: ---- btrfs-progs-v5.2.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ btrfsprogs.spec ++++++ --- /var/tmp/diff_new_pack.J0U619/_old 2019-09-30 15:51:03.414548654 +0200 +++ /var/tmp/diff_new_pack.J0U619/_new 2019-09-30 15:51:03.434548600 +0200 @@ -33,7 +33,7 @@ %define _dracutmodulesdir %{_libexecdir}/dracut/modules.d Name: btrfsprogs -Version: 5.2.1 +Version: 5.2.2 Release: 0 Summary: Utilities for the Btrfs filesystem License: GPL-2.0-only ++++++ btrfs-progs-v5.2.1.tar.gz -> btrfs-progs-v5.2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/CHANGES new/btrfs-progs-v5.2.2/CHANGES --- old/btrfs-progs-v5.2.1/CHANGES 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/CHANGES 2019-09-05 15:34:37.000000000 +0200 @@ -1,3 +1,15 @@ +btrfs-progs-5.2.2 (2019-09-05) + * check: + * fix false report of wrong byte count for orphan inodes + * option -E was not handled correctly + * new check and repair for root item generation + * balance: check for full-balance before background fork + * mkfs: check that total device size does not overflow 16EiB + * dump-tree: print DEV_STATS key type + * other: + * new and updated tests + * doc fixups and updates + btrfs-progs-5.2.1 (2019-07-26) * scrub status: fix ETA calculation after resume * check: fix crash when using -Q diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-balance.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-balance.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-balance.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-balance.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-balance .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-BALANCE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-BALANCE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-check.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-check.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-check.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-check.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-check .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-CHECK" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-CHECK" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-convert.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-convert.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-convert.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-convert.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-convert .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-CONVERT" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-CONVERT" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-device.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-device.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-device.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-device.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-device .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-DEVICE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-DEVICE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-filesystem.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-filesystem.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-filesystem.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-filesystem.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-filesystem .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-FILESYSTEM" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-FILESYSTEM" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-find-root.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-find-root.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-find-root.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-find-root.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-find-root .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-FIND\-ROOT" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-FIND\-ROOT" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-image.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-image.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-image.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-image.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-image .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-IMAGE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-IMAGE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-inspect-internal.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-inspect-internal.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-inspect-internal.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-inspect-internal.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-inspect-internal .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-INSPECT\-INTE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-INSPECT\-INTE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-man5.asciidoc new/btrfs-progs-v5.2.2/Documentation/btrfs-man5.asciidoc --- old/btrfs-progs-v5.2.1/Documentation/btrfs-man5.asciidoc 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-man5.asciidoc 2019-09-05 15:34:37.000000000 +0200 @@ -217,14 +217,14 @@ asynchronous queued TRIM, then this operation can severely degrade performance, because a synchronous TRIM operation will be attempted instead. Queued TRIM requires newer than SATA revision 3.1 chipsets and devices. - ++ If it is not necessary to immediately discard freed blocks, then the `fstrim` tool can be used to discard all free blocks in a batch. Scheduling a TRIM during a period of low system activity will prevent latent interference with the performance of other operations. Also, a device may ignore the TRIM command if the range is too small, so running a batch discard has a greater probability of actually discarding the blocks. - ++ If discarding is not necessary to be done at the block freeing time, there's `fstrim`(8) tool that lets the filesystem discard all free blocks in a batch, possibly not much interfering with other operations. Also, the device may @@ -639,31 +639,32 @@ The swapfile is supported since kernel 5.0. Use `swapon`(8) to activate the swapfile. There are some limitations of the implementation in btrfs and linux swap subystem: -+ + * filesystem - must be only single device * swapfile - the containing subvolume cannot be snapshotted * swapfile - must be preallocated * swapfile - must be nodatacow (ie. also nodatasum) * swapfile - must not be compressed -+ + The limitations come namely from the COW-based design and mapping layer of blocks that allows the advanced features like relocation and multi-device filesystems. However, the swap subsystem expects simpler mapping and no background changes of the file blocks once they've been attached to swap. -+ + With active swapfiles, the following whole-filesystem operations will skip swapfile extents or may fail: + * balance - block groups with swapfile extents are skipped and reported, the rest will be processed normally * resize grow - unaffected * resize shrink - works as long as the extents are outside of the shrunk range * device add - a new device does not interfere with existing swapfile and this operation will work, though no new swapfile can be activated afterwards * device delete - if the device has been added as above, it can be also deleted * device replace - dtto -+ + When there are no active swapfiles and a whole-filesystem exclusive operation is running (ie. balance, device delete, shrink), the swapfiles cannot be temporarily activated. The operation must finish first. -+ + -------------------- # truncate -s 0 swapfile # chattr +C swapfile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-map-logical.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-map-logical.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-map-logical.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-map-logical.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-map-logical .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-MAP\-LOGICAL" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-MAP\-LOGICAL" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-property.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-property.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-property.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-property.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-property .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-PROPERTY" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-PROPERTY" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -74,7 +74,7 @@ .PP label .RS 4 -label of device +label of the filesystem\&. For an unmounted filesystem, provide a path to a block device as object\&. For a mounted filesystem, specify a mount point\&. .RE .PP compression diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-property.asciidoc new/btrfs-progs-v5.2.2/Documentation/btrfs-property.asciidoc --- old/btrfs-progs-v5.2.1/Documentation/btrfs-property.asciidoc 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-property.asciidoc 2019-09-05 15:34:37.000000000 +0200 @@ -43,7 +43,8 @@ ro:::: read-only flag of subvolume: true or false label:::: -label of device +label of the filesystem. For an unmounted filesystem, provide a path to a block +device as object. For a mounted filesystem, specify a mount point. compression:::: compression algorithm set for an inode, possible values: 'lzo', 'zlib', 'zstd'. To disable compression use "" (empty string), 'no' or 'none'. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-qgroup.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-qgroup.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-qgroup.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-qgroup.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-qgroup .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-QGROUP" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-QGROUP" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-quota.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-quota.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-quota.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-quota.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-quota .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-QUOTA" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-QUOTA" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-receive.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-receive.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-receive.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-receive.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-receive .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-RECEIVE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-RECEIVE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-replace.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-replace.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-replace.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-replace.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-replace .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-REPLACE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-REPLACE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-rescue.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-rescue.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-rescue.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-rescue.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-rescue .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-RESCUE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-RESCUE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-restore.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-restore.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-restore.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-restore.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-restore .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-RESTORE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-RESTORE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-scrub.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-scrub.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-scrub.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-scrub.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-scrub .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-SCRUB" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-SCRUB" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-select-super.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-select-super.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-select-super.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-select-super.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-select-super .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-SELECT\-SUPER" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-SELECT\-SUPER" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-send.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-send.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-send.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-send.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-send .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-SEND" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-SEND" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs-subvolume.8 new/btrfs-progs-v5.2.2/Documentation/btrfs-subvolume.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs-subvolume.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs-subvolume.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-subvolume .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-SUBVOLUME" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-SUBVOLUME" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs.5 new/btrfs-progs-v5.2.2/Documentation/btrfs.5 --- old/btrfs-progs-v5.2.1/Documentation/btrfs.5 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs.5 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs-man5 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS\-MAN5" "5" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS\-MAN5" "5" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -361,11 +361,14 @@ (default: off) .sp Enable discarding of freed file blocks\&. This is useful for SSD devices, thinly provisioned LUNs, or virtual machine images; however, every storage layer must support discard for it to work\&. if the backing device does not support asynchronous queued TRIM, then this operation can severely degrade performance, because a synchronous TRIM operation will be attempted instead\&. Queued TRIM requires newer than SATA revision 3\&.1 chipsets and devices\&. -.RE .sp -If it is not necessary to immediately discard freed blocks, then the \fBfstrim\fR tool can be used to discard all free blocks in a batch\&. Scheduling a TRIM during a period of low system activity will prevent latent interference with the performance of other operations\&. Also, a device may ignore the TRIM command if the range is too small, so running a batch discard has a greater probability of actually discarding the blocks\&. +If it is not necessary to immediately discard freed blocks, then the +\fBfstrim\fR +tool can be used to discard all free blocks in a batch\&. Scheduling a TRIM during a period of low system activity will prevent latent interference with the performance of other operations\&. Also, a device may ignore the TRIM command if the range is too small, so running a batch discard has a greater probability of actually discarding the blocks\&. .sp -If discarding is not necessary to be done at the block freeing time, there\(cqs \fBfstrim\fR(8) tool that lets the filesystem discard all free blocks in a batch, possibly not much interfering with other operations\&. Also, the device may ignore the TRIM command if the range is too small, so running the batch discard can actually discard the blocks\&. +If discarding is not necessary to be done at the block freeing time, there\(cqs +\fBfstrim\fR(8) tool that lets the filesystem discard all free blocks in a batch, possibly not much interfering with other operations\&. Also, the device may ignore the TRIM command if the range is too small, so running the batch discard can actually discard the blocks\&. +.RE .PP \fBenospc_debug\fR, \fBnoenospc_debug\fR .RS 4 @@ -962,15 +965,132 @@ .sp The swapfile is supported since kernel 5\&.0\&. Use \fBswapon\fR(8) to activate the swapfile\&. There are some limitations of the implementation in btrfs and linux swap subystem: .sp -+ * filesystem \- must be only single device * swapfile \- the containing subvolume cannot be snapshotted * swapfile \- must be preallocated * swapfile \- must be nodatacow (ie\&. also nodatasum) * swapfile \- must not be compressed +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +filesystem \- must be only single device +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +swapfile \- the containing subvolume cannot be snapshotted +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +swapfile \- must be preallocated +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +swapfile \- must be nodatacow (ie\&. also nodatasum) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +swapfile \- must not be compressed +.RE +.sp +The limitations come namely from the COW\-based design and mapping layer of blocks that allows the advanced features like relocation and multi\-device filesystems\&. However, the swap subsystem expects simpler mapping and no background changes of the file blocks once they\(cqve been attached to swap\&. +.sp +With active swapfiles, the following whole\-filesystem operations will skip swapfile extents or may fail: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +balance \- block groups with swapfile extents are skipped and reported, the rest will be processed normally +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +resize grow \- unaffected +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +resize shrink \- works as long as the extents are outside of the shrunk range +.RE .sp -+ The limitations come namely from the COW\-based design and mapping layer of blocks that allows the advanced features like relocation and multi\-device filesystems\&. However, the swap subsystem expects simpler mapping and no background changes of the file blocks once they\(cqve been attached to swap\&. +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +device add \- a new device does not interfere with existing swapfile and this operation will work, though no new swapfile can be activated afterwards +.RE .sp -+ With active swapfiles, the following whole\-filesystem operations will skip swapfile extents or may fail: * balance \- block groups with swapfile extents are skipped and reported, the rest will be processed normally * resize grow \- unaffected * resize shrink \- works as long as the extents are outside of the shrunk range * device add \- a new device does not interfere with existing swapfile and this operation will work, though no new swapfile can be activated afterwards * device delete \- if the device has been added as above, it can be also deleted * device replace \- dtto +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +device delete \- if the device has been added as above, it can be also deleted +.RE .sp -+ When there are no active swapfiles and a whole\-filesystem exclusive operation is running (ie\&. balance, device delete, shrink), the swapfiles cannot be temporarily activated\&. The operation must finish first\&. +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +device replace \- dtto +.RE .sp -+ +When there are no active swapfiles and a whole\-filesystem exclusive operation is running (ie\&. balance, device delete, shrink), the swapfiles cannot be temporarily activated\&. The operation must finish first\&. .sp .if n \{\ .RS 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfs.8 new/btrfs-progs-v5.2.2/Documentation/btrfs.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfs.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfs.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfs .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFS" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFS" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/btrfstune.8 new/btrfs-progs-v5.2.2/Documentation/btrfstune.8 --- old/btrfs-progs-v5.2.1/Documentation/btrfstune.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/btrfstune.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: btrfstune .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "BTRFSTUNE" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "BTRFSTUNE" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/fsck.btrfs.8 new/btrfs-progs-v5.2.2/Documentation/fsck.btrfs.8 --- old/btrfs-progs-v5.2.1/Documentation/fsck.btrfs.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/fsck.btrfs.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: fsck.btrfs .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "FSCK\&.BTRFS" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "FSCK\&.BTRFS" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/Documentation/mkfs.btrfs.8 new/btrfs-progs-v5.2.2/Documentation/mkfs.btrfs.8 --- old/btrfs-progs-v5.2.1/Documentation/mkfs.btrfs.8 2019-07-26 17:56:07.000000000 +0200 +++ new/btrfs-progs-v5.2.2/Documentation/mkfs.btrfs.8 2019-09-05 15:35:47.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: mkfs.btrfs .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 07/26/2019 +.\" Date: 09/05/2019 .\" Manual: Btrfs Manual -.\" Source: Btrfs v5.2.1 +.\" Source: Btrfs v5.2.2 .\" Language: English .\" -.TH "MKFS\&.BTRFS" "8" "07/26/2019" "Btrfs v5\&.2\&.1" "Btrfs Manual" +.TH "MKFS\&.BTRFS" "8" "09/05/2019" "Btrfs v5\&.2\&.2" "Btrfs Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/VERSION new/btrfs-progs-v5.2.2/VERSION --- old/btrfs-progs-v5.2.1/VERSION 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/VERSION 2019-09-05 15:34:37.000000000 +0200 @@ -1 +1 @@ -v5.2.1 +v5.2.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/check/main.c new/btrfs-progs-v5.2.2/check/main.c --- old/btrfs-progs-v5.2.1/check/main.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/check/main.c 2019-09-05 15:34:37.000000000 +0200 @@ -806,7 +806,8 @@ } else if (S_ISREG(rec->imode) || S_ISLNK(rec->imode)) { if (rec->found_dir_item) rec->errors |= I_ERR_ODD_DIR_ITEM; - if (rec->found_size != rec->nbytes) + /* Orphan inodes don't have correct nbytes */ + if (rec->nlink > 0 && rec->found_size != rec->nbytes) rec->errors |= I_ERR_FILE_NBYTES_WRONG; if (rec->nlink > 0 && !no_holes && (rec->extent_end < rec->isize || @@ -3437,8 +3438,10 @@ { int ret = 0; int err = 0; + bool generation_err = false; int wret; int level; + u64 super_generation; struct btrfs_path path; struct shared_node root_node; struct root_record *rec; @@ -3449,6 +3452,23 @@ struct unaligned_extent_rec_t *urec; struct unaligned_extent_rec_t *tmp; + super_generation = btrfs_super_generation(root->fs_info->super_copy); + if (btrfs_root_generation(root_item) > super_generation + 1) { + error( + "invalid generation for root %llu, have %llu expect (0, %llu]", + root->root_key.objectid, btrfs_root_generation(root_item), + super_generation + 1); + generation_err = true; + if (repair) { + root->node->flags |= EXTENT_BAD_TRANSID; + ret = recow_extent_buffer(root, root->node); + if (!ret) { + printf("Reset generation for root %llu\n", + root->root_key.objectid); + generation_err = false; + } + } + } /* * Reuse the corrupt_block cache tree to record corrupted tree block * @@ -3597,6 +3617,8 @@ free_corrupt_blocks_tree(&corrupt_blocks); root->fs_info->corrupt_blocks = NULL; + if (!ret && generation_err) + ret = -1; return ret; } @@ -9024,42 +9046,6 @@ return ret; } -static int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb) -{ - struct btrfs_path path; - struct btrfs_trans_handle *trans; - struct btrfs_key key; - int ret; - - printf("Recowing metadata block %llu\n", eb->start); - key.objectid = btrfs_header_owner(eb); - key.type = BTRFS_ROOT_ITEM_KEY; - key.offset = (u64)-1; - - root = btrfs_read_fs_root(root->fs_info, &key); - if (IS_ERR(root)) { - fprintf(stderr, "Couldn't find owner root %llu\n", - key.objectid); - return PTR_ERR(root); - } - - trans = btrfs_start_transaction(root, 1); - if (IS_ERR(trans)) - return PTR_ERR(trans); - - btrfs_init_path(&path); - path.lowest_level = btrfs_header_level(eb); - if (path.lowest_level) - btrfs_node_key_to_cpu(eb, &key, 0); - else - btrfs_item_key_to_cpu(eb, &key, 0); - - ret = btrfs_search_slot(trans, root, &key, &path, 0, 1); - btrfs_commit_transaction(trans, root); - btrfs_release_path(&path); - return ret; -} - static int delete_bad_item(struct btrfs_root *root, struct bad_item *bad) { struct btrfs_path path; @@ -9867,7 +9853,7 @@ { NULL, 0, NULL, 0} }; - c = getopt_long(argc, argv, "as:br:pEQ", long_options, NULL); + c = getopt_long(argc, argv, "as:br:pE:Q", long_options, NULL); if (c < 0) break; switch(c) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/check/mode-common.c new/btrfs-progs-v5.2.2/check/mode-common.c --- old/btrfs-progs-v5.2.1/check/mode-common.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/check/mode-common.c 2019-09-05 15:34:37.000000000 +0200 @@ -924,3 +924,39 @@ } return ret; } + +int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb) +{ + struct btrfs_path path; + struct btrfs_trans_handle *trans; + struct btrfs_key key; + int ret; + + printf("Recowing metadata block %llu\n", eb->start); + key.objectid = btrfs_header_owner(eb); + key.type = BTRFS_ROOT_ITEM_KEY; + key.offset = (u64)-1; + + root = btrfs_read_fs_root(root->fs_info, &key); + if (IS_ERR(root)) { + fprintf(stderr, "Couldn't find owner root %llu\n", + key.objectid); + return PTR_ERR(root); + } + + trans = btrfs_start_transaction(root, 1); + if (IS_ERR(trans)) + return PTR_ERR(trans); + + btrfs_init_path(&path); + path.lowest_level = btrfs_header_level(eb); + if (path.lowest_level) + btrfs_node_key_to_cpu(eb, &key, 0); + else + btrfs_item_key_to_cpu(eb, &key, 0); + + ret = btrfs_search_slot(trans, root, &key, &path, 0, 1); + btrfs_commit_transaction(trans, root); + btrfs_release_path(&path); + return ret; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/check/mode-common.h new/btrfs-progs-v5.2.2/check/mode-common.h --- old/btrfs-progs-v5.2.1/check/mode-common.h 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/check/mode-common.h 2019-09-05 15:34:37.000000000 +0200 @@ -155,4 +155,5 @@ return true; } +int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/check/mode-lowmem.c new/btrfs-progs-v5.2.2/check/mode-lowmem.c --- old/btrfs-progs-v5.2.1/check/mode-lowmem.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/check/mode-lowmem.c 2019-09-05 15:34:37.000000000 +0200 @@ -2519,6 +2519,7 @@ return err; } + is_orphan = has_orphan_item(root, inode_id); ii = btrfs_item_ptr(node, slot, struct btrfs_inode_item); isize = btrfs_inode_size(node, ii); nbytes = btrfs_inode_nbytes(node, ii); @@ -2672,19 +2673,22 @@ "root %llu INODE[%llu] nlink(%llu) not equal to inode_refs(%llu)", root->objectid, inode_id, nlink, refs); } - } else if (!nlink) { - is_orphan = has_orphan_item(root, inode_id); - if (!is_orphan && repair) + } else if (!nlink && !is_orphan) { + if (repair) ret = repair_inode_orphan_item_lowmem(root, path, inode_id); - if (!is_orphan && (!repair || ret)) { + if (!repair || ret) { err |= ORPHAN_ITEM; error("root %llu INODE[%llu] is orphan item", root->objectid, inode_id); } } - if (nbytes != extent_size) { + /* + * For orhpan inode, updating nbytes/size is just a waste of + * time, so skip such repair and don't report them as error. + */ + if (nbytes != extent_size && !is_orphan) { if (repair) { ret = repair_inode_nbytes_lowmem(root, path, inode_id, extent_size); @@ -4957,6 +4961,7 @@ struct btrfs_path path; struct node_refs nrefs; struct btrfs_root_item *root_item = &root->root_item; + u64 super_generation = btrfs_super_generation(root->fs_info->super_copy); int ret; int level; int err = 0; @@ -4978,6 +4983,22 @@ level = btrfs_header_level(root->node); btrfs_init_path(&path); + if (btrfs_root_generation(root_item) > super_generation + 1) { + error( + "invalid root generation for root %llu, have %llu expect (0, %llu)", + root->root_key.objectid, btrfs_root_generation(root_item), + super_generation + 1); + err |= INVALID_GENERATION; + if (repair) { + root->node->flags |= EXTENT_BAD_TRANSID; + ret = recow_extent_buffer(root, root->node); + if (!ret) { + printf("Reset generation for root %llu\n", + root->root_key.objectid); + err &= ~INVALID_GENERATION; + } + } + } if (btrfs_root_refs(root_item) > 0 || btrfs_disk_key_objectid(&root_item->drop_progress) == 0) { path.nodes[level] = root->node; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/check/mode-lowmem.h new/btrfs-progs-v5.2.2/check/mode-lowmem.h --- old/btrfs-progs-v5.2.1/check/mode-lowmem.h 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/check/mode-lowmem.h 2019-09-05 15:34:37.000000000 +0200 @@ -47,6 +47,7 @@ #define INODE_FLAGS_ERROR (1<<23) /* Invalid inode flags */ #define DIR_ITEM_HASH_MISMATCH (1<<24) /* Dir item hash mismatch */ #define INODE_MODE_ERROR (1<<25) /* Bad inode mode */ +#define INVALID_GENERATION (1<<26) /* Generation is too new */ /* * Error bit for low memory mode check. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/cmds/balance.c new/btrfs-progs-v5.2.2/cmds/balance.c --- old/btrfs-progs-v5.2.1/cmds/balance.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/cmds/balance.c 2019-09-05 15:34:37.000000000 +0200 @@ -437,24 +437,6 @@ if (fd < 0) return 1; - if (!(flags & BALANCE_START_FILTERS) && !(flags & BALANCE_START_NOWARN)) { - int delay = 10; - - printf("WARNING:\n\n"); - printf("\tFull balance without filters requested. This operation is very\n"); - printf("\tintense and takes potentially very long. It is recommended to\n"); - printf("\tuse the balance filters to narrow down the scope of balance.\n"); - printf("\tUse 'btrfs balance start --full-balance' option to skip this\n"); - printf("\twarning. The operation will start in %d seconds.\n", delay); - printf("\tUse Ctrl-C to stop it.\n"); - while (delay) { - printf("%2d", delay--); - fflush(stdout); - sleep(1); - } - printf("\nStarting balance without any filters.\n"); - } - ret = ioctl(fd, BTRFS_IOC_BALANCE_V2, args); if (ret < 0) { /* @@ -634,6 +616,24 @@ } } + if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) { + int delay = 10; + + printf("WARNING:\n\n"); + printf("\tFull balance without filters requested. This operation is very\n"); + printf("\tintense and takes potentially very long. It is recommended to\n"); + printf("\tuse the balance filters to narrow down the scope of balance.\n"); + printf("\tUse 'btrfs balance start --full-balance' option to skip this\n"); + printf("\twarning. The operation will start in %d seconds.\n", delay); + printf("\tUse Ctrl-C to stop it.\n"); + while (delay) { + printf("%2d", delay--); + fflush(stdout); + sleep(1); + } + printf("\nStarting balance without any filters.\n"); + } + if (force) args.flags |= BTRFS_BALANCE_FORCE; if (verbose) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/common/device-scan.c new/btrfs-progs-v5.2.2/common/device-scan.c --- old/btrfs-progs-v5.2.1/common/device-scan.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/common/device-scan.c 2019-09-05 15:34:37.000000000 +0200 @@ -26,6 +26,7 @@ #include <linux/limits.h> #include <blkid/blkid.h> #include <uuid/uuid.h> +#include "kernel-lib/overflow.h" #include "common/path-utils.h" #include "common/device-scan.h" #include "common/messages.h" @@ -118,7 +119,8 @@ struct btrfs_device *device; struct btrfs_dev_item *dev_item; char *buf = NULL; - u64 fs_total_bytes; + const u64 old_size = btrfs_super_total_bytes(super); + u64 new_size; u64 num_devs; int ret; @@ -156,13 +158,20 @@ goto out; } + if (check_add_overflow(old_size, device_total_bytes, &new_size)) { + error( + "adding device of %llu (%s) bytes would exceed max file system size", + device->total_bytes, pretty_size(device->total_bytes)); + ret = -EOVERFLOW; + goto out; + } + INIT_LIST_HEAD(&device->dev_list); ret = btrfs_add_device(trans, fs_info, device); if (ret) goto out; - fs_total_bytes = btrfs_super_total_bytes(super) + device_total_bytes; - btrfs_set_super_total_bytes(super, fs_total_bytes); + btrfs_set_super_total_bytes(super, new_size); num_devs = btrfs_super_num_devices(super) + 1; btrfs_set_super_num_devices(super, num_devs); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/configure new/btrfs-progs-v5.2.2/configure --- old/btrfs-progs-v5.2.1/configure 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/configure 2019-09-05 15:34:46.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for btrfs-progs v5.2.1 . +# Generated by GNU Autoconf 2.69 for btrfs-progs v5.2.2 . # # Report bugs to <linux-bt...@vger.kernel.org>. # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='btrfs-progs' PACKAGE_TARNAME='btrfs-progs' -PACKAGE_VERSION='v5.2.1 ' -PACKAGE_STRING='btrfs-progs v5.2.1 ' +PACKAGE_VERSION='v5.2.2 ' +PACKAGE_STRING='btrfs-progs v5.2.2 ' PACKAGE_BUGREPORT='linux-bt...@vger.kernel.org' PACKAGE_URL='http://btrfs.wiki.kernel.org' @@ -1326,7 +1326,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures btrfs-progs v5.2.1 to adapt to many kinds of systems. +\`configure' configures btrfs-progs v5.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1391,7 +1391,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of btrfs-progs v5.2.1 :";; + short | recursive ) echo "Configuration of btrfs-progs v5.2.2 :";; esac cat <<\_ACEOF @@ -1522,7 +1522,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -btrfs-progs configure v5.2.1 +btrfs-progs configure v5.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1891,7 +1891,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by btrfs-progs $as_me v5.2.1 , which was +It was created by btrfs-progs $as_me v5.2.2 , which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -7357,7 +7357,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by btrfs-progs $as_me v5.2.1 , which was +This file was extended by btrfs-progs $as_me v5.2.2 , which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7420,7 +7420,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -btrfs-progs config.status v5.2.1 +btrfs-progs config.status v5.2.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/kernel-lib/overflow.h new/btrfs-progs-v5.2.2/kernel-lib/overflow.h --- old/btrfs-progs-v5.2.1/kernel-lib/overflow.h 1970-01-01 01:00:00.000000000 +0100 +++ new/btrfs-progs-v5.2.2/kernel-lib/overflow.h 2019-09-05 15:34:37.000000000 +0200 @@ -0,0 +1,270 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +#ifndef __LINUX_OVERFLOW_H +#define __LINUX_OVERFLOW_H + +/* + * It would seem more obvious to do something like + * + * #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0) + * #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0) + * + * Unfortunately, the middle expressions, strictly speaking, have + * undefined behaviour, and at least some versions of gcc warn about + * the type_max expression (but not if -fsanitize=undefined is in + * effect; in that case, the warning is deferred to runtime...). + * + * The slightly excessive casting in type_min is to make sure the + * macros also produce sensible values for the exotic type _Bool. [The + * overflow checkers only almost work for _Bool, but that's + * a-feature-not-a-bug, since people shouldn't be doing arithmetic on + * _Bools. Besides, the gcc builtins don't allow _Bool* as third + * argument.] + * + * Idea stolen from + * https://mail-index.netbsd.org/tech-misc/2007/02/05/0000.html - + * credit to Christian Biere. + */ +#define is_signed_type(type) (((type)(-1)) < (type)1) +#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) +#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) +#define type_min(T) ((T)((T)-type_max(T)-(T)1)) + +/* + * Avoids triggering -Wtype-limits compilation warning, + * while using unsigned data types to check a < 0. + */ +#define is_non_negative(a) ((a) > 0 || (a) == 0) +#define is_negative(a) (!(is_non_negative(a))) + +/* Checking for unsigned overflow is relatively easy without causing UB. */ +#define __unsigned_add_overflow(a, b, d) ({ \ + typeof(a) __a = (a); \ + typeof(b) __b = (b); \ + typeof(d) __d = (d); \ + (void) (&__a == &__b); \ + (void) (&__a == __d); \ + *__d = __a + __b; \ + *__d < __a; \ +}) +#define __unsigned_sub_overflow(a, b, d) ({ \ + typeof(a) __a = (a); \ + typeof(b) __b = (b); \ + typeof(d) __d = (d); \ + (void) (&__a == &__b); \ + (void) (&__a == __d); \ + *__d = __a - __b; \ + __a < __b; \ +}) +/* + * If one of a or b is a compile-time constant, this avoids a division. + */ +#define __unsigned_mul_overflow(a, b, d) ({ \ + typeof(a) __a = (a); \ + typeof(b) __b = (b); \ + typeof(d) __d = (d); \ + (void) (&__a == &__b); \ + (void) (&__a == __d); \ + *__d = __a * __b; \ + __builtin_constant_p(__b) ? \ + __b > 0 && __a > type_max(typeof(__a)) / __b : \ + __a > 0 && __b > type_max(typeof(__b)) / __a; \ +}) + +/* + * For signed types, detecting overflow is much harder, especially if + * we want to avoid UB. But the interface of these macros is such that + * we must provide a result in *d, and in fact we must produce the + * result promised by gcc's builtins, which is simply the possibly + * wrapped-around value. Fortunately, we can just formally do the + * operations in the widest relevant unsigned type (u64) and then + * truncate the result - gcc is smart enough to generate the same code + * with and without the (u64) casts. + */ + +/* + * Adding two signed integers can overflow only if they have the same + * sign, and overflow has happened iff the result has the opposite + * sign. + */ +#define __signed_add_overflow(a, b, d) ({ \ + typeof(a) __a = (a); \ + typeof(b) __b = (b); \ + typeof(d) __d = (d); \ + (void) (&__a == &__b); \ + (void) (&__a == __d); \ + *__d = (u64)__a + (u64)__b; \ + (((~(__a ^ __b)) & (*__d ^ __a)) \ + & type_min(typeof(__a))) != 0; \ +}) + +/* + * Subtraction is similar, except that overflow can now happen only + * when the signs are opposite. In this case, overflow has happened if + * the result has the opposite sign of a. + */ +#define __signed_sub_overflow(a, b, d) ({ \ + typeof(a) __a = (a); \ + typeof(b) __b = (b); \ + typeof(d) __d = (d); \ + (void) (&__a == &__b); \ + (void) (&__a == __d); \ + *__d = (u64)__a - (u64)__b; \ + ((((__a ^ __b)) & (*__d ^ __a)) \ + & type_min(typeof(__a))) != 0; \ +}) + +/* + * Signed multiplication is rather hard. gcc always follows C99, so + * division is truncated towards 0. This means that we can write the + * overflow check like this: + * + * (a > 0 && (b > MAX/a || b < MIN/a)) || + * (a < -1 && (b > MIN/a || b < MAX/a) || + * (a == -1 && b == MIN) + * + * The redundant casts of -1 are to silence an annoying -Wtype-limits + * (included in -Wextra) warning: When the type is u8 or u16, the + * __b_c_e in check_mul_overflow obviously selects + * __unsigned_mul_overflow, but unfortunately gcc still parses this + * code and warns about the limited range of __b. + */ + +#define __signed_mul_overflow(a, b, d) ({ \ + typeof(a) __a = (a); \ + typeof(b) __b = (b); \ + typeof(d) __d = (d); \ + typeof(a) __tmax = type_max(typeof(a)); \ + typeof(a) __tmin = type_min(typeof(a)); \ + (void) (&__a == &__b); \ + (void) (&__a == __d); \ + *__d = (u64)__a * (u64)__b; \ + (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ + (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ + (__b == (typeof(__b))-1 && __a == __tmin); \ +}) + + +#define check_add_overflow(a, b, d) \ + __builtin_choose_expr(is_signed_type(typeof(a)), \ + __signed_add_overflow(a, b, d), \ + __unsigned_add_overflow(a, b, d)) + +#define check_sub_overflow(a, b, d) \ + __builtin_choose_expr(is_signed_type(typeof(a)), \ + __signed_sub_overflow(a, b, d), \ + __unsigned_sub_overflow(a, b, d)) + +#define check_mul_overflow(a, b, d) \ + __builtin_choose_expr(is_signed_type(typeof(a)), \ + __signed_mul_overflow(a, b, d), \ + __unsigned_mul_overflow(a, b, d)) + +/** check_shl_overflow() - Calculate a left-shifted value and check overflow + * + * @a: Value to be shifted + * @s: How many bits left to shift + * @d: Pointer to where to store the result + * + * Computes *@d = (@a << @s) + * + * Returns true if '*d' cannot hold the result or when 'a << s' doesn't + * make sense. Example conditions: + * - 'a << s' causes bits to be lost when stored in *d. + * - 's' is garbage (e.g. negative) or so large that the result of + * 'a << s' is guaranteed to be 0. + * - 'a' is negative. + * - 'a << s' sets the sign bit, if any, in '*d'. + * + * '*d' will hold the results of the attempted shift, but is not + * considered "safe for use" if false is returned. + */ +#define check_shl_overflow(a, s, d) ({ \ + typeof(a) _a = a; \ + typeof(s) _s = s; \ + typeof(d) _d = d; \ + u64 _a_full = _a; \ + unsigned int _to_shift = \ + is_non_negative(_s) && _s < 8 * sizeof(*d) ? _s : 0; \ + *_d = (_a_full << _to_shift); \ + (_to_shift != _s || is_negative(*_d) || is_negative(_a) || \ + (*_d >> _to_shift) != _a); \ +}) + +/** + * array_size() - Calculate size of 2-dimensional array. + * + * @a: dimension one + * @b: dimension two + * + * Calculates size of 2-dimensional array: @a * @b. + * + * Returns: number of bytes needed to represent the array or SIZE_MAX on + * overflow. + */ +static inline size_t array_size(size_t a, size_t b) +{ + size_t bytes; + + if (check_mul_overflow(a, b, &bytes)) + return SIZE_MAX; + + return bytes; +} + +/** + * array3_size() - Calculate size of 3-dimensional array. + * + * @a: dimension one + * @b: dimension two + * @c: dimension three + * + * Calculates size of 3-dimensional array: @a * @b * @c. + * + * Returns: number of bytes needed to represent the array or SIZE_MAX on + * overflow. + */ +static inline size_t array3_size(size_t a, size_t b, size_t c) +{ + size_t bytes; + + if (check_mul_overflow(a, b, &bytes)) + return SIZE_MAX; + if (check_mul_overflow(bytes, c, &bytes)) + return SIZE_MAX; + + return bytes; +} + +/* + * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for + * struct_size() below. + */ +static inline size_t __ab_c_size(size_t a, size_t b, size_t c) +{ + size_t bytes; + + if (check_mul_overflow(a, b, &bytes)) + return SIZE_MAX; + if (check_add_overflow(bytes, c, &bytes)) + return SIZE_MAX; + + return bytes; +} + +/** + * struct_size() - Calculate size of structure with trailing array. + * @p: Pointer to the structure. + * @member: Name of the array member. + * @n: Number of elements in the array. + * + * Calculates size of memory needed for structure @p followed by an + * array of @n @member elements. + * + * Return: number of bytes needed or SIZE_MAX on overflow. + */ +#define struct_size(p, member, n) \ + __ab_c_size(n, \ + sizeof(*(p)->member) + __must_be_array((p)->member),\ + sizeof(*(p))) + +#endif /* __LINUX_OVERFLOW_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/mkfs/main.c new/btrfs-progs-v5.2.2/mkfs/main.c --- old/btrfs-progs-v5.2.1/mkfs/main.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/mkfs/main.c 2019-09-05 15:34:37.000000000 +0200 @@ -1268,7 +1268,7 @@ sectorsize, sectorsize, sectorsize); if (ret) { error("unable to add %s to filesystem: %d", file, ret); - goto out; + goto error; } if (verbose >= 2) { struct btrfs_device *device; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/print-tree.c new/btrfs-progs-v5.2.2/print-tree.c --- old/btrfs-progs-v5.2.1/print-tree.c 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/print-tree.c 2019-09-05 15:34:37.000000000 +0200 @@ -689,6 +689,12 @@ void print_objectid(FILE *stream, u64 objectid, u8 type) { switch (type) { + case BTRFS_PERSISTENT_ITEM_KEY: + if (objectid == BTRFS_DEV_STATS_OBJECTID) + fprintf(stream, "DEV_STATS"); + else + fprintf(stream, "%llu", (unsigned long long)objectid); + return; case BTRFS_DEV_EXTENT_KEY: /* device id */ fprintf(stream, "%llu", (unsigned long long)objectid); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/tests/cli-tests/002-balance-full-no-filters/test.sh new/btrfs-progs-v5.2.2/tests/cli-tests/002-balance-full-no-filters/test.sh --- old/btrfs-progs-v5.2.1/tests/cli-tests/002-balance-full-no-filters/test.sh 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/tests/cli-tests/002-balance-full-no-filters/test.sh 2019-09-05 15:34:37.000000000 +0200 @@ -18,4 +18,10 @@ run_check $SUDO_HELPER "$TOP/btrfs" balance --full-balance "$TEST_MNT" run_check $SUDO_HELPER "$TOP/btrfs" balance "$TEST_MNT" +# grep below can't use -q else this could lead to SIGPIPE +run_check_stdout $SUDO_HELPER "$TOP/btrfs" balance start --background "$TEST_MNT" | + grep -F "Full balance without filters requested." >/dev/null || + _fail "full balance warning not in the output" +run_mayfail $SUDO_HELPER "$TOP/btrfs" balance cancel "$TEST_MNT" + run_check_umount_test_dev diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/tests/cli-tests/003-fi-resize-args/test.sh new/btrfs-progs-v5.2.2/tests/cli-tests/003-fi-resize-args/test.sh --- old/btrfs-progs-v5.2.1/tests/cli-tests/003-fi-resize-args/test.sh 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/tests/cli-tests/003-fi-resize-args/test.sh 2019-09-05 15:34:37.000000000 +0200 @@ -16,21 +16,29 @@ # missing the one of the required arguments for sep in '' '--'; do run_check_stdout "$TOP/btrfs" filesystem resize $sep | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 0 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep "$TEST_MNT" | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep -128M | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep +128M | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep 512M | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep 1:-128M | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep 1:512M | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" run_check_stdout "$TOP/btrfs" filesystem resize $sep 1:+128M | - grep -q "btrfs filesystem resize: too few arguments" + grep -q "btrfs filesystem resize: exactly 2 arguments expected, 1 given" || + _fail "no expected error message in the output" done # valid resize @@ -41,6 +49,9 @@ run_check $SUDO_HELPER "$TOP/btrfs" filesystem resize $sep 1:-128M "$TEST_MNT" run_check $SUDO_HELPER "$TOP/btrfs" filesystem resize $sep 1:512M "$TEST_MNT" run_check $SUDO_HELPER "$TOP/btrfs" filesystem resize $sep 1:+128M "$TEST_MNT" + run_check $SUDO_HELPER "$TOP/btrfs" filesystem resize $sep max "$TEST_MNT" + run_check $SUDO_HELPER "$TOP/btrfs" filesystem resize $sep -128M "$TEST_MNT" + run_check $SUDO_HELPER "$TOP/btrfs" filesystem resize $sep 1:max "$TEST_MNT" done run_check_umount_test_dev Binary files old/btrfs-progs-v5.2.1/tests/fsck-tests/041-invalid-root-generation/default_case.img and new/btrfs-progs-v5.2.2/tests/fsck-tests/041-invalid-root-generation/default_case.img differ Binary files old/btrfs-progs-v5.2.1/tests/fsck-tests/042-half-dropped-inode/default.raw.xz and new/btrfs-progs-v5.2.2/tests/fsck-tests/042-half-dropped-inode/default.raw.xz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/tests/fsck-tests/042-half-dropped-inode/test.sh new/btrfs-progs-v5.2.2/tests/fsck-tests/042-half-dropped-inode/test.sh --- old/btrfs-progs-v5.2.1/tests/fsck-tests/042-half-dropped-inode/test.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/btrfs-progs-v5.2.2/tests/fsck-tests/042-half-dropped-inode/test.sh 2019-09-05 15:34:37.000000000 +0200 @@ -0,0 +1,34 @@ +#!/bin/bash +# To check if btrfs check can handle half dropped inodes. +# Such inodes are orphan inodes going through file items evicting. +# During that evicting, btrfs won't bother updating the nbytes of the orphan +# inode as they will soon be removed completely. +# +# Btrfs check should be able to recognize such inodes without giving false +# alerts +# +# The way to reproduce the image: +# - Create a lot of regular file extents for one inode +# Using direct IO with small block size is the easiy method +# - Modify kernel to commit transaction more aggresively +# Two locations are needed: +# * btrfs_unlink(): +# To make the ORPHAN item reach disk asap +# * btrfs_evict_inode(): +# Make the btrfs_end_transaction() call after btrfs_trncate_inode_items() +# to commit transaction, so we can catch every file item deletion +# - Setup dm-log-writes +# To catch every transaction commit +# - Delete the inode +# - Sync the fs +# - Replay the log + +source "$TEST_TOP/common" + +check_prereq btrfs + +check_image() { + run_check "$TOP/btrfs" check "$1" +} + +check_all_images diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/tests/misc-tests/034-metadata-uuid/test.sh new/btrfs-progs-v5.2.2/tests/misc-tests/034-metadata-uuid/test.sh --- old/btrfs-progs-v5.2.1/tests/misc-tests/034-metadata-uuid/test.sh 2019-07-26 17:54:59.000000000 +0200 +++ new/btrfs-progs-v5.2.2/tests/misc-tests/034-metadata-uuid/test.sh 2019-09-05 15:34:37.000000000 +0200 @@ -10,8 +10,8 @@ setup_root_helper prepare_test_dev -if ! check_min_kernel_version 5.0; then - _not_run "kernel too old, METADATA_UUID support needed" +if [ ! -f /sys/fs/btrfs/features/metadata_uuid ] ; then + _not_run "METADATA_UUID feature not supported" fi read_fsid() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v5.2.1/tests/mkfs-tests/018-multidevice-overflow/test.sh new/btrfs-progs-v5.2.2/tests/mkfs-tests/018-multidevice-overflow/test.sh --- old/btrfs-progs-v5.2.1/tests/mkfs-tests/018-multidevice-overflow/test.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/btrfs-progs-v5.2.2/tests/mkfs-tests/018-multidevice-overflow/test.sh 2019-09-05 15:34:37.000000000 +0200 @@ -0,0 +1,24 @@ +#!/bin/bash +# test if mkfs.btrfs will create file systems that overflow total_bytes + +source "$TEST_TOP/common" + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper +prepare_test_dev + +# create a temporary btrfs filesystem for the images to make sure the +# exabyte-scale files will be reliably created +run_check_mkfs_test_dev +run_check_mount_test_dev + +run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img1" +run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img2" +run_check $SUDO_HELPER truncate -s 6E "$TEST_MNT/img3" + +run_mustfail "mkfs for too-large images" \ + $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_MNT"/img[123] + +run_check_umount_test_dev