summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: Introduce change_header_uuid functionQu Wenruo2015-05-14
| | | | | | | | | | This function is used to change fsid and chunk_tree_uuid of a node/leaf. The function does it without transaction protection. This is the basis of offline uuid change. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Export write_tree_blockQu Wenruo2015-05-14
| | | | | | | | | | Export write_tree_block() function and allow it write extent without transaction. This provides the basis for later uuid change function. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add open_ctree check for uuid changingQu Wenruo2015-05-14
| | | | | | | | | | | Now open_ctree will exit if it found the superblock is marked CHANGING_FSID, except given IGNORE_FSID open ctree flags. Kernel will do the same thing later. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [removed the chunk tree flag, reworded the error message] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: show-super: print human readable text for super flagsQu Wenruo2015-05-14
| | | | | | | | | Use the new __print_readable_flag() to implement print_readable_super_flag(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [removed the chunk tree flag] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Use unified function to implement print_readable_*_flag functionQu Wenruo2015-05-14
| | | | | | | | | | Now add a new unified __print_readable_flag() function to implement print_readable_incompat_flag(). This makes later extension for human readable flags easier. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add CHANGING_FSID super flagQu Wenruo2015-05-14
| | | | | | | | | Add the super flag to inform kernel not to mount a filesystem wich fsid change is in progress. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [removed the chunk tree flag] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use the correct variableAnand Jain2015-05-14
| | | | | | | | It's res instead of ret, wrong error message could be prointed in case of error. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: btrfs_scan_block_devices is unused function delete itAnand Jain2015-05-14
| | | | | | | | | After Patch: remove BTRFS_SCAN_PROC scan method There isn't any consumer for btrfs_scan_block_devices() so delete it. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fsck: Fix a shallow copy which will leads to segfault.Qu Wenruo2015-05-14
| | | | | | | | | | | | | | | In copy_inode_rec(), a shallow copy happens on rec->holes rb_root. So for shared inode case, new rec->holes still points to old rb_root, and when the old inode record is freed, the new inode_rec->holes will points to garbage and cause segfault when we try to free new inode_rec->holes. Fix it by calling copy_file_extent_holes() to do deep copy. Reported-by: Eric Sandeen <sandeen@redhat.com> Reported-by: Filipe David Manana <fdmanana@gmail.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: drop dependency on sys/acl.hDavid Sterba2015-05-14
| | | | | | | | | | | | | | The file sys/acl.h is part of libacl and if the development package is not installed, build of btrfs-convert fails. We do not link against libacl nor use the functions provided by libacl. The ACL_* values are directly read from the extN data, so it's more part of the on-disk format rather than an interface to libacl. The dependency on libacl is completely dropped. Reported-by: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: add more long option variantsDavid Sterba2015-05-14
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: shift option textsDavid Sterba2015-05-14
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: use bigger buffer for output path nameDavid Sterba2015-05-14
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: optionally restore symlinks.Dan Merillat2015-05-14
| | | | | | | Restore symlinks, optionally with owner/times. Signed-off-by: Dan Merillat <dan.merillat@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: separate the overwrite checkDan Merillat2015-04-29
| | | | | | | | | Symlink restore needs this, but the cut&paste became too complicated. Simplify everything. Signed-off-by: Dan Merillat <dan.merillat@gmail.com> [message wording adjustments] Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs progs v4.0David Sterba2015-04-29
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: don't misreport errors from search_dirDavid Sterba2015-04-29
| | | | | | | | The logic around return value has changed in the metadata restore patches. The return value from btrfs_search_slot may remain non-zero and is returned. This is incorrectly interpreted as an error. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: receive: unconditionally print if doing chrootDavid Sterba2015-04-24
| | | | | | | The chroot action seems important enough to be printed unconditionally and without the verbose option that prints way too much information. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix typos in restore help/docDavid Sterba2015-04-24
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: document metadata restore.Dan Merillat2015-04-24
| | | | | | | This was lost in the cleanup of 71a559 Signed-off-by: Dan Merillat <dan.merillat@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: cleanup, use PATH_MAXDavid Sterba2015-04-24
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check: fix compile warnings in del_file_extent_holeDavid Sterba2015-04-24
| | | | | | | | | | | | make[1]: Nothing to be done for `all'. cmds-check.c: In function ‘del_file_extent_hole’: cmds-check.c:289:26: warning: ‘prev.start’ may be used uninitialized in this function cmds-check.c:289:26: warning: ‘prev.len’ may be used uninitialized in this function cmds-check.c:290:26: warning: ‘next.start’ may be used uninitialized in this function cmds-check.c:290:26: warning: ‘next.len’ may be used uninitialized in this function Reported-by: Anand Jain <Anand.Jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: convert copy_file exit paths to a single returnDavid Sterba2015-04-24
| | | | | Resolves-coverity-id: 1295365 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: convert search_dir exit paths to a single returnDavid Sterba2015-04-24
| | | | | Resolves-coverity-id: 1295366 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: fix path leak in copy_metadataDavid Sterba2015-04-24
| | | | | | | The path lifecycle spans only this function and we have to free it. Resolves-coverity-id: 1295367 Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: optionally enforce chroot for btrfs receiveLauri Võsandi2015-04-24
| | | | | | | | | | | This patch forces btrfs receive to issue chroot before parsing the btrfs stream using command-line flag -C to confine the process and minimize damage that could be done via malicious btrfs stream. Signed-off-by: Lauri Võsandi <lauri.vosandi@gmail.com> [added long option variant, added docs] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: restore: optionally restore metadataDan Merillat2015-04-24
| | | | | | | | | | As long as the inode is intact, the file metadata can be restored. Directory data is restored at the end of search_dir. Errors are checked and returned, unless ignore_errors is requested. Signed-off-by: Dan Merillat <dan.merillat@gmail.com> [minor style fixes, error message updates] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: report failure when resize ioctl failsZygo Blaxell2015-04-24
| | | | | | | | | | | | | | | | | The BTRFS_IOC_RESIZE ioctl returns 0 on success, negative for POSIX errors, and positive for btrfs-specific errors. If resize fails with a btrfs-specific error, decode the error and report it. If we can't decode the error, report its numeric value so that the userspace tool is not instantly useless when a new error code is defined in the kernel. Exit with non-zero status on any resize error. This is very important for scripts that will shrink the underlying storage when btrfs reports success! Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix typo in btrfs-device.txtAnand Jain2015-04-24
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: check for matching free space in cacheJosef Bacik2015-04-24
| | | | | | | | | | | We have this check in the kernel but not in userspace, which makes fsck fail when we wouldn't have a problem in the kernel. This was meant to catch this case because it really isn't good, unfortunately it will require a design change to fix in the kernel so in the meantime add this check so we can be sure our tests only catch real problems. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fix btrfs quota rescan failed on PPC64 archGeorge Wang2015-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | PPC64 arch use such following IOC values " \#define _IOC_NONE 1U \#define _IOC_READ 2U \#define _IOC_WRITE 4U " comparing to the default IOC values " \#define _IOC_NONE 0U \#define _IOC_READ 2U \#define _IOC_WRITE 1U" This means the value "_IOW*" will be negative when we store it in the int variables. Such as the "BTRFS_IOC_QGROUP_CREATE", it will be "0x4010942e" on X86_64, but "0x8010942e" on PPC64. Notice that the IOC values are the "unsigned long" type, so we use the "unsigned long" to store it, and this can insure the comparison between the variable and BTRFS_IOC_* valid. Signed-off-by: George Wang <xuw2015@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> [manpage states that it's int, kernel uses unsigned int, glibc wants unsigned long int] Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add zero-log to rescue commandDavid Sterba2015-04-22
| | | | | | | | Copy the functionality of standalone btrfs-zero-log to the main tool. Delete man page for btrfs-zero-log and copy the relevant parts into btrfs-rescue(8). The standalone utility will be removed later. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup, rename *disk_usage* files to usageDavid Sterba2015-04-22
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fi resize: accept only directories as pathsDavid Sterba2015-04-22
| | | | | | | | Resize of a filesystem image does not work as expected. This has been confusing and can have bad consequences as people have reported, resizing the wrong filesystem. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Documentaion: rename to .asciidocDavid Sterba2015-04-14
| | | | | | | | | | | | | A few minor benefits: * editors set highliting according to the extensions * web access to the git repository (github) renders the .asciidoc files: * we can link to them from the wiki * the files are editable via browser and such editations can be submitted for merge easily Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: improve troubleshooting avoid duplicate error stringsAnand Jain2015-04-14
| | | | | | | | | | | | | | | | my troubleshooting experience says have unique error string per module. In the below eg, its one additional step to know error line, cat -n cmds-device.c | egrep "error removing the device" 185 "ERROR: error removing the device '%s' - %s\n", 190 "ERROR: error removing the device '%s' - %s\n", which is completely avoidable. Signed-off-by: Anand Jain <anand.jain@oracle.com> [merged the two messages into one] Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fix compile warningsAnand Jain2015-04-14
| | | | | | | | | | | simple compile time warning fixes. btrfs-calc-size.c: In function ‘print_seek_histogram’: btrfs-calc-size.c:221: warning: ‘group_start’ may be used uninitialized in this function btrfs-calc-size.c:223: warning: ‘group_end’ may be used uninitialized in this function Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use local btrfs-image in leaf corruption testWorMzy Tykashi2015-04-09
| | | | | | | | | | Currently this test uses the system btrfs-image. If there isn't a btrfs-image on $PATH, the test fails. The test should be using the locally compiled btrfs-image, not the system one. Signed-off-by: WorMzy Tykashi <wormzy.tykashi@gmail.com> Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: getopt, use symbolic name for argument requirementsDavid Sterba2015-04-08
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup option index argument from getopt_longDavid Sterba2015-04-08
| | | | | | | We're not using it anywhere. The best practice is to add enums with values > 255 for the long options, option index counting is error prone. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print fs features filtered by a maskDavid Sterba2015-04-07
| | | | | | | mkfs and convert will not support the same features, -O will print only the list according to the given mask. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move feature parsing from mkfs to utilsDavid Sterba2015-04-07
| | | | | | | We'll use them in convert as well. Move defines and the interface functions to utils.*. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: mkfs, deprecate leafsize and clean up the codeDavid Sterba2015-04-07
| | | | | | | Using the --leafsize will issue a warning. Replace leafsize with nodesize in the mkfs-related code. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert: use exact size for reading superblockDavid Sterba2015-04-07
| | | | | | | | | We've passed blocksize to prepare_system_chunk and used it to read and write superblock. While this does not cause a bug (SUPER_INFO is blocksize ie. page size on most arches), we should really use the correct size. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: remove duplicate output for fsck test 013David Sterba2015-04-07
| | | | | | The test name is logged since it lives in it's own directory. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: split make rule for fsck and convert tests, fix ↵David Sterba2015-04-07
| | | | | | | | | | prerequisities We'd like to run each class of tests separately. There were some missing prerequisities that should be/are verified by the tests, makefile rules have been synced. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert tests: preserve test image permissionsDavid Sterba2015-04-07
| | | | | | | If the test image is eg. on NFS it's not writable for root, so chmod 0777 fixes that but then we must not delete the file. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Doc: Add warning and note on btrfs-convert.Qu Wenruo2015-04-07
| | | | | | | | | | | | | | | Although btrfs-convert can rollback converted btrfs, it still has some limitation to ensure rollback. Add a warning on the limitations. Also add a note for users who decides to go on with btrfs and don't need the rollback ability. Reported-by: Vytautas D <vytdau@gmail.com> Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert-tests: Add check for converted btrfs with regular file ↵Qu Wenruo2015-04-07
| | | | | | | | | | extent. Regression test for previous patch "btrfs-progs: convert: Make ext*_image file obey datacsum setting." Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert-tests: Update to use test framework infrastructure.Qu Wenruo2015-04-07
| | | | | | | | Also change the test() to convert_test(), to avoid conflict name with bash test function. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>