The total filesystem space on a given device might be smaller than the
device size. We should report that space as well. The original idea was
to report the 'occupied' size but the term was not all clear, so the
logic was reversed to report the slack space.
Signed-off-by: David Sterba <dsterba@suse.com>
btrfs-progs build failed in CentOS 6 and 7:
#./autogen.sh
...
configure.ac:131: error: possibly undefined macro: PKG_CHECK_VAR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
...
Seems PKG_CHECK_VAR is new in pkgconfig 0.28 (24-Jan-2013):
http://redmine.audacious-media-player.org/boards/1/topics/736
And the max available version for CentOS 7 in yum-repo and
rpmfind.net is: pkgconfig-0.27.1-4.el7
http://rpmfind.net/linux/rpm2html/search.php?query=pkgconfig&submit=Search+...&system=centos&arch=
I updated my pkgconfig to 0.30, but still failed at above error.
(Maybe it is my setting problem)
To make user in centos 6 and 7 building btrfs-progs without
more changes, we can avoid using PKG_CHECK_VAR in following
way found in:
f95ab6f939
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
When autogen.sh failed, the success message is still in output:
# ./autogen.sh
...
configure.ac:131: error: possibly undefined macro: PKG_CHECK_VAR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
Now type './configure' and 'make' to compile.
#
Fixed by check return value of autoconf.
After patch:
# ./autogen.sh
...
configure.ac:132: error: possibly undefined macro: PKG_CHECK_VAR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
If source put in dir with blanks, as:
/var/lib/jenkins/workspace/btrfs progs
autogen will failed:
./autogen.sh: line 95: cd: /var/lib/jenkins/workspace/btrfs: No such file or directory
Can be fixed by adding quotes into cd command.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Add new options -q,--quiet to prevent printing messages on stderr, added
--verbose as alternative for -v. Moved 'Mode NO_FILE_DATA enabled'
message to stderr. The default verboisty level is 1 to keep some
backward compatibility.
Signed-off-by: M G Berberich <btrfs@oss.m-berberich.de>
[ minor adjustments in the options, help text and changelog, added
manual page text ]
Signed-off-by: David Sterba <dsterba@suse.com>
Add an easy way to build a debugging version, without optimizations and
with debugging info by default. Any overrides can be done via
DEBUG_CFLAGS that are added on top of the defaults. Can be combined with
V, C or W options.
Usage:
$ make D=1
Signed-off-by: David Sterba <dsterba@suse.com>
Systemd's btrfs rule runs btrfs dev ready on each device
as it's discovered. The btrfs command is executed as a builtin
command via an IMPORT{builtin} rule, which means it gets
executed at rule evaluation time, not rule execution time. That
means that the device mapper links haven't been setup yet and the only
nodes that can be depended upon are /dev/dm-#. That we see
/dev/mapper/name names in /proc/mounts is only because we replace the
device name we have cached with the one passed in via mount. If
we have a multi-device file system and the primary device is removed,
the remaining devices will show /dev/dm-#. In addition, if the
udev rule is executed again by someone generating a change event (e.g.
partprobe), the names are also replaced by the /dev/dm-# names.
This patch adds a new rule that adds a run rule that calls btrfs dev
ready again using the device mapper links once they're created.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
parse_args() always set at least one parameter, 'object', for
{get,list} subcommands. In addition, it always set all three
parameters, 'object', 'name', and 'value' for set subcommand.
So the following conditions can be removed.
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Since <object> parameter is mandatory for all subcommands,
'object' is always set by parse_args()'s callers.
In addition, on setting '*name' and '*value', if 'optind < argc'
is satisfied here, they are always set by parse_args()'s callers.
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This adds 4 fuzz testing images, btrfsck either doesn't detect errors
in them or crashes immediately.
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This adds validation checks for super_total_bytes, super_bytes_used and
super_stripesize.
Since these checks are made after superblock finishes checksum
checking, this also adds a notice of "superblock checksum matches but..".
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
[ adjusted message wording ]
Signed-off-by: David Sterba <dsterba@suse.com>
To survive fuzz filesystem images, we need various validation checks to
make btrfsck detect any invalid value inside chunks including those in
sys_array.
Note that these checks may not be sufficient to cover all corner cases,
we may need to add more later.
This also refractor previous various checks into a helper function so
that we can add more checks into it in the future.
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
props.c uses 'fprintf(stderr, "ERROR: ...")' as its error messages,
however we have generic error() function.
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
When printing the countdown in the safety delay, the number should
correspond to the number of seconds remaining to wait at the time the
delay is printed.
In other words, there should be a one second sleep after printing '1'.
Signed-off-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
The flag OPEN_CTREE_RECOVER_SUPER is set when it's going to recover
any bad superblock copy, the current code doesn't match that.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
The search header is usually accessed in an unaligned way, we could
trigger errors (SIGBUS) on architectures that do not support that.
Signed-off-by: David Sterba <dsterba@suse.com>
In the new add_extent_rec_nolookup() function, we add bytes_used to
update found bytes accounting.
However there is a typo that we used tmpl->nr, which should be rec->nr.
This will make us to add 1 for data backref, instead the correct size.
Reported-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
The extent record's max_size might be 0 and the stripe crossing check
will report a false positive, should use the filesyste nodesize. There's
a global fs_info available.
Signed-off-by: David Sterba <dsterba@suse.com>
Similar to add_extent_rec_nolookup, pass the arguments via a temporary
structure. In case the extent is found, some of the values are not
assigned directly so the semantics is preserved.
Signed-off-by: David Sterba <dsterba@suse.com>
There are just 3 values of flag_block_full_backref, we can utilize a
bitfield and save 8 bytes (192 now).
Signed-off-by: David Sterba <dsterba@suse.com>
Reduce number of parameters that just fill the extent_record from a
temporary template that's supposed to be zeroed and filled by the
callers.
Signed-off-by: David Sterba <dsterba@suse.com>
We want to support version 1.41 due to longterm and enterprise distros,
make the check explicit.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
A short delay with a warning before starting a full balance should
improve usability. We have been getting reports from people who run full
balance after following some random advice and then get surprised by the
performance impact.
The countdown is done even when run from scripts, but as the whole
balance takes significanly more time, this shouldn't be an issue.
Signed-off-by: David Sterba <dsterba@suse.com>
The changes are posted to the mailinglist and to the wiki, but for
packaging reasons it's good to have them locally in the git as well.
The initial conversion from wiki was done by Nick, then adjusted by me.
Reported-by: Nicholas D Steeves <nsteeves@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Read qgroup status for its flags like QGROUP_STATUS_FLAG_RESCAN and
QGROUP_STATUS_FLAG_INCONSISTENT.
This will help to avoid false alert for case like qgroup rescan is still
running when un-mounted.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qgroup verify codes will read fs root to check if the subvolume exists.
But it forgot to free the extent buffer read out, only freeing the
memory.
Fix it by also freeing the extent buffers.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Before this patch, although btrfsck will check qgroups if quota is
enabled, it always return 0 even qgroup numbers are corrupted.
Fix it by allowing return value from report_qgroups function (formally
defined as print_qgroup_difference).
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
>From commit c742debab1 ('btrfs-progs: fix a regression that
"property" with -t option doesn't work'), the number of arguments
is checked strictly. So the following condition never be
satisfied.
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
* actual result
=======================================
# ./btrfs device ready /dev/sdb foo
#
=======================================
* expecting result
=======================================
# ./btrfs device ready /dev/sdb foo
btrfs device ready: too many arguments
usage: btrfs device ready <device>
Check device to see if it has all of its devices in cache for mounting
#
=======================================
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>