| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
|
|
|
|
| |
We just free the log root after we set it up when we open a ctree in the tools.
This isn't nice, it makes double free's and leaks eb's, makes segfaults with
btrfs-image. So fix this to be correct, and fix the cleanup if the buffer is
not uptodate. With this fix I no longer segfault trying to do btrfs-image on a
file system with a log tree. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can't use ext2_dir_entry_2 typecast on big endian machines directly.
The bytes do not get converted during extX block read due to missing
flag EXT2_DIRBLOCK_V2_STRUCT passed down to ext2fs_read_dir_block4 from
ext2fs_process_dir_block. Fixing on the ext2 side needs updating callers
and (maybe) the library interfaces. We'll fix it on the convert side for
now.
CC: Jan Kara <jack@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
|
|
|
| |
Since restore has the ability to open really really screwed up file systems, add
a list roots option to it so we can still get the contents of the tree root on a
horribly broken fs. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
|
|
|
|
| |
This patch simply adds support to decompress lzo compressed extents in restore.
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
search_dir() recurses down the btrfs tree, and used to take the output
path for every item (i.e. in the running system, output root directory
concatenated with btrfs-local pathname) passed as the only path
parameter. Moving the output root directory to a separate parameter
and passing the btrfs-local pathname for each file and directory
separately allows easy filtering based on the btrfs-local pathname.
Signed-off-by: Peter Stuge <peter@stuge.se>
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
|
|
|
|
| |
mirrors exist
Signed-off-by: David Marcin <djmarcin@google.com>
|
|
|
|
|
|
|
| |
If we hit a bad disk and the read doesn't work, try other mirrors in case we
have other disks with good copies. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
|
|
|
|
|
| |
This will make the restore program fall back on other mirrors if it fails to
decompress an extent for whatever reason. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
|
|
|
|
|
|
| |
If the normal fs tree is hosed and the user has multiple subvolumes it's handy
to be able to specify just one of the subvolumes to restore. It's also handy if
a user only wants to restore say /home instead of his entire disk. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
|
|
|
|
| |
Signed-off-by: Matias Bjørling <m@bjorling.me>
|
|
|
|
|
|
|
|
|
|
| |
I missed updating the mkfs.btrfs usage() when I added the
option to force fs overwrite.
Update that, and while we're at it add a long option, since
all other commands have long counterparts.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Of recently and intermittently I am seeing open fail
for /dev/btrfs-control (btrfs is loaded), and there are no
dmesg errors, this may not be a complete help in digging
this issue but something which is necessary.
Thanks
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
| |
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
|
|
|
| |
btrfs-find-root isn't yet integrated into the main btrfs tool, and is
an important recovery tool, so it deserves to be built as a static
binary.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
get_fs_info() has been silently switching from a device to a mounted
path as needed; the caller's filehandle was unexpectedly closed &
reopened outside the caller's scope. Not so great.
The callers do want "fdmnt" to be the filehandle for the mount point
in all cases, though - the various ioctls act on this (not on an fd
for the device). But switching it in the local scope of get_fs_info
is incorrect; it just so happens that *usually* the fd number is
unchanged.
So - use the new helpers to detect when an argument is a block
device, and open the the mounted path more obviously / explicitly
for ioctl use, storing the filehandle in fdmnt.
Then, in get_fs_info, ignore the fd completely, and use the path on
the argument to determine if the caller wanted to act on just that
device, or on all devices for the filesystem.
Affects those commands which are documented to accept either
a block device or a path:
* btrfs device stats
* btrfs replace start
* btrfs scrub start
* btrfs scrub status
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
| |
cmd_scrub_cancel had its own mountpoint discovery routine;
just use open_path_or_dev_mnt() for that now.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add 3 new helpers:
* is_block_device(), to test if a path is a block device.
* get_btrfs_mount(), to get the mountpoint of a device,
if mounted.
* open_path_or_dev_mnt(path), to open either the pathname
or, if it's a mounted btrfs dev, the mountpoint. Useful
for some commands which can take either type of arg.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
Somehow missed these 2 in the last round.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Dave fixed the fs_info to allocate the super copy instead of embedding it, but
he failed to notice that I open code open_ctree in btrfs-find-root so we end up
with a super that's not allocated, so we segfault whenever you try to run
btrfs-find-root. I've fixed this up and now we don't segfault anymore. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
|
|
|
|
|
|
|
|
|
|
| |
Static mkfs.btrfs can be used to "bootstrap" a system from a live CD
which does not provide mkfs.btrfs.
The executable produced is named mkfs.btrfs.static and built by invoking
the "static" make rule.
Signed-off-by: Antoine Sirinelli <antoine@monte-stello.com>
|
|
|
|
|
|
|
|
|
| |
Allocate fs_info::super_copy dynamically of full BTRFS_SUPER_INFO_SIZE
and use it directly for saving superblock to disk.
This fixes incorrect superblock checksum after mkfs.
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
| |
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
|
|
| |
If pthread_mutex_lock() fails it returns the error in ret,
and does not set errno.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
consolidate error handling to ensure that peer_fd
is closed on error paths. Add a couple comments
to the error handling after the thread is complete.
Note that scrub_progress_cycle returns negative
errnos on any error.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Today wrong cmdlines give odd results:
# ./btrfs-vol /dev/sdb1
Unable to open device (null)
# ./btrfs-vol -a /dev/sdb1
usage: btrfs-vol [options] mount_point ...
Make it a bit more informative:
# ./btrfs-vol /dev/sdb1
No command specified
usage: btrfs-vol [options] mount_point ...
# ./btrfs-vol -a /dev/sdb1
No mountpoint specified
usage: btrfs-vol [options] mount_point ...
(even though it's deprecated ...)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The two sigint handlers issue ioctls to clean up, but if
they fail, noone would know. I'm not sure there is
any other error handling to be done at this point, but a
notification seems wise.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
| |
It seems highly unlikely that posix_fadvise could fail,
and even if it does, it was only advisory. Still, if
it does, we could issue a notice to the user.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
| |
cmd_subvol_create() currently returns without freeing resources
in almost every error case. Switch to a goto arrangement
so all cleanup can be done in one place.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
Just whitespace fixes, and magical return value removal.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
| |
cmd_snapshot() currently returns without freeing resources
in almost every error case. Switch to a goto arrangement
so all cleanup can be done in one place.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
Just whitespace fixes, and magical return value removal.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
| |
Because it's better than a segfault if it's called improperly,
and it makes static checkers happier.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
Don't return w/ "metadump" still allocated
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
close fd if open, and free allocated memory in buf
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
stops an fd leak that Coverity found.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
stops an fd leak that Coverity found.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
| |
Since raid5/6 support was introduced, we should update mkfs.btrfs help info.
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
|
|
|
|
| |
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
|
|
|
|
| |
-----
cmds-device.c: fprintf(stderr, "ERROR: unable to scan the device '%s' - %s\n",
utils.c: fprintf(stderr, "ERROR: unable to scan the device '%s' - %s\n",
-----
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
|
| |
A trivial fix, corrects the indentation.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Segmentation fault occurred in the following command.
# btrfs check /dev/sdc7
No valid Btrfs found on /dev/sdc7
Segmentation fault (core dumped)
Fix it.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
|
|
|
|
|
|
|
| |
The original code forgot to output the reason why the commands failed,
fix it.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we fail to execute the command:
btrfs qgroup show <mnt>
It will output the follow messages:
ERROR: can't perform the search - Inappropriate ioctl for device
ERROR: can't list qgroups
The error is outputed twice, this is wrong, fix it.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linking 'btrfs' and other binaries against the dynamic library makes it
tedious to use directly from the git repo. This is useful for testing
various fixes, but now it'd need to also set LD_LIBRARY_PATH or install
the library to a known path.
Add a target for static library and use it for linking, the dynamic
library is to be used by external users.
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
External software wanting to use the functionality provided by the btrfs
send ioctl has a hard time doing so without replicating tons of work. Of
particular interest are functions like btrfs_read_and_process_send_stream()
and subvol_uuid_search(). As that functionality requires a bit more than
just send-stream.c and send-utils.c we have to pull in some other parts of
the progs package.
This patch adds code to the Makefile and headers to create a library,
libbtrfs which the btrfs command now links to.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The coverity runs had a false positive complaining that
save_ptr is uninitialized in the call to strtok_r.
Turns out that under the covers glibc was doing enough
to confuse the checker about what was being called.
Just to keep the noise down, do a harmless initialization,
with a comment as to why.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
Rearrange cmd_subvol_set_default() slightly so we
don't have to close the fd on an error return.
While we're at it, fix whitespace & remove magic
return values.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
| |
Whitespace fixes and fix a variable declaration after
code.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
| |
If we exit with error we must free the allocated memory
to avoid a leak.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Without this we leak the fd when we return from the
function.
Also, remove the senseless random return values.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|