summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: Remove deprecated btrfs-show-superNikolay Borisov2018-04-24
| | | | | | | | | | | Its function has been superseded by btrfs inspect-internal show-super. Furthermore the tools is currently not built by default. Just remove it. Deprecated since 4.8. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove deprecated btrfs-zero-log standalone toolNikolay Borisov2018-04-24
| | | | | | | | | | | Its function has been subsumed by "btrfs rescue zero-log". Remove its source file and adjust make/tests soruces accordingly. Deprecated since 4.0. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove btrfs-debug-tree commandNikolay Borisov2018-04-24
| | | | | | | | | | | | | There is already a replacement in the face of btrfs inspect-internal dump-tree. And this command is just a simple wrapper around it. Just remove it and adjust the show-blocks script to call the main btrfs binary to achieve the same effect. Informally deprecated since 4.4. Issue: #97 Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: send-utils: remove unused functions path_cat and path_cat3Gu Jinxiang2018-04-24
| | | | | | | | Since function path_cat and path_cat3 are not used anymore, remove them. They have been reprecated since version 4.0. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: return nozero value on thin provisioned deviceSu Yue2018-04-11
| | | | | | | | | | | | | | | | With mkfs.btrfs on a thin provisioned device with very small backing size and big virtual size, all code works well in mkfs.btrfs until close_ctree() is called. close_ctree() fails to sync device due to small backing size while closing devices. However, mkfs returns 0 in such situation which causes failure of fstests generic/405. So, let mkfs returns nonzero value if previous steps succeeded but close_ctree() failed. Then fstests generic/405 passes now. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sb-mod: add compat bit to the recognized fieldsDavid Sterba2018-04-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sb-mod: add csum_typeDavid Sterba2018-04-11
| | | | | | Let SET and GET work on superblock::csum_type. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: sb-mod: add preliminary support for non-u64 typesDavid Sterba2018-04-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs progs v4.16David Sterba2018-04-06
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for v4.16David Sterba2018-04-06
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs rootdir: use lgetxattr() not to follow a symbolic linkMisono Tomohiro2018-04-06
| | | | | | | | | | | | | mkfs-test 016 "rootdir-bad-symbolic-link" fails when selinux is enabled. This is because add_xattr_item() uses getxattr() and tries to follow a bad symbolic link for selinux item, which causes ENOENT error. The line above already uses llistxattr() for getting list of xattr in order not to follow a symbolic link, so just use lgetxattr() too. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: Do not use cp -a to install library linksPeter Kjellerstedt2018-04-06
| | | | | | | | | | | | Using cp -a to install files will preserve the ownership of the original files (if possible), which is typically not wanted. E.g. if the files were built by a normal user, but are being installed by root, then the installed files would maintain the UIDs/GIDs of the user that built the files rather than be owned by root. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: fix typosDavid Sterba2018-03-31
| | | | | | | | A few more typo fixes, merged with the pull request. Pull-request: #120 Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: fix test assumptions about top-level subvolumeOmar Sandoval2018-03-30
| | | | | | | | | | Since "btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREE", the top-level subvolume has a non-zero UUID, ctime, and otime. Fix the subvolume_info() test to not check for zero. Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: always build libbtrfsutil.so.$MAJOROmar Sandoval2018-03-30
| | | | | | | Otherwise, make test-libbtrfsutil from a fresh checkout fails. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: use local mkfs.btrfs for tests if it existsOmar Sandoval2018-03-30
| | | | | | | The system might not have mkfs installed at all. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: fix memory leak in deleted_subvolumes()Omar Sandoval2018-03-30
| | | | | | | If we fail to reallocate the ID array, we still need to free it. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* libbtrfsutil: don't return free space cache inodes from deleted_subvolumes()Omar Sandoval2018-03-30
| | | | | | | | | | | Deleted free space cache inodes also get an orphan item in the root tree, but we shouldn't report those as deleted subvolumes. Deleted subvolumes will still have the root item, so we can just do an extra tree search. Reported-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: precreate the uuid treeDavid Sterba2018-03-30
| | | | | | | | | We can easily create the uuid tree that's usually created after first mount. The kernel will still check the tree on first mount so we don't try to fake the uuid tree generation so it appears consistent, even if it's empty. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Test if btrfs-image can handle RAID1 missing deviceQu Wenruo2018-03-30
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix offset-by-one error in read_data_extent()Qu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | For read_data_extent() in convert/main.c it's using mirror number in a incorrect way, which will not get correct copy for RAID1: for (cur_mirror = 0; cur_mirror < num_copies; cur_mirror++) { In such case, for RAID1 @cur_mirror will only be 0 and 1. However for 0 and 1 case, btrfs_map_block() will only return the first copy. To reach the 2nd copy, it correct @cur_mirror range should be 1 and 2. So with this off-by-one error, btrfs-image will never be able to read out data extent if the first stripe of the chunk is the missing one. Fix it by starting @cur_mirror from 1 and to @num_copies (including). Fixes: 2d46558b30f5 ("btrfs-progs: Use existing facility to replace read_data_extent function") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: disk-io: Fix read_extent_data() error handler for missing deviceQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | When device is missing, read_extent_data() (function exported from old btrfs check code) has the following problems: 1) Modifies @len parameter if device is missing If device returned in @multi is missing, @len can be larger than @max_len (originl length). This could confuse caller and underflow in the read loop. 2) Still returns 0 for missing device It only handles read error, missing device is not handled and 0 is returned. 3) Wrong check for device->fd In fact, 0 is also a valid fd. Although not possible under most cases, but still needs fix. Fix them all. Fixes: 1bad2f2f2dfe ("Btrfs-progs: fsck: add an option to check data csums") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Test if mkfs.btrfs --rootdir can handle ng symlinkQu Wenruo2018-03-30
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Remove unused parameterGu Jinxiang2018-03-30
| | | | | | | | Parameter usagestr is not used, remove it. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs/rootdir: Don't follow symbolic link when calcuating sizeQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [BUG] If we have a symbolic link in rootdir pointing to non-existing location, mkfs.btrfs --rootdir will just fail: ------ $ mkfs.btrfs -f --rootdir /tmp/rootdir/ /dev/data/btrfs btrfs-progs v4.15.1 See http://btrfs.wiki.kernel.org for more information. ERROR: ftw subdir walk of /tmp/rootdir/ failed: No such file or directory ------ [CAUSE] Commit 599a0abed564 ("btrfs-progs: mkfs/rootdir: Use over-reserve method to make size estimate easier") add extra ftw walk to estimate the filesystem size. Such default ftw walk will follow symbolic link and gives ENOENT error. [FIX] Use nftw() to specify FTW_PHYS so we won't follow symbolic link for size calculation. Issue: #109 Reported-by: Alexander Kanavin <alexander.kanavin@intel.com> Fixes: 599a0abed564 ("btrfs-progs: mkfs/rootdir: Use over-reserve method to make size estimate easier") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: modify cscope/ctags rules to include directories such as ↵Lu Fengqi2018-03-30
| | | | | | | | | | check Modify cscope/ctags rule to include directories such as check/ libbtrfsutil/kernel-lib/kernel-shared. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add tool to edit super blocksDavid Sterba2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | | $ make btrfs-sb-mod $ ./btrfs-sb-mod image field1 operation1 ... Fields (only u64 supported for now): * total_bytes * root * generation * chunk_root * chunk_root_generation * cache_generation * uuid_tree_generation Operations: * read value ?0 * set value =NUMBER * add to +NUMBER * subtract from value -NUMBER * xor with value ^NUMBER * byteswap (u64) @0 Use with care! Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check/original: Remove unused variable first_keyQu Wenruo2018-03-30
| | | | | | | | | | | | | | This @first_key variable is introduced in f5c4c4f3b75b ("btrfsck: add code to rebuild extent records"), however it's not only unused, but also used incorrectly. It's calling btrfs_item_key_to_cpu() on an node extent buffer. Anyway, just remove it. Fixes: f5c4c4f3b75b ("btrfsck: add code to rebuild extent records") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove BTRFS_CRC32_SIZE definitionMisono, Tomohiro2018-03-30
| | | | | | | | | | The kernel code no longer has BTRFS_CRC32_SIZE and only uses btrfs_csum_sizes[]. So, update the progs code as well. Suggested-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add shell quotes to misc test scriptsDavid Sterba2018-03-30
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add shell quotes to mkfs test scriptsDavid Sterba2018-03-30
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: remove trivial use of local variablesDavid Sterba2018-03-30
| | | | | | | No need to use a temporary variable if the parameter usage is obvious from the context. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add shell quoting to fuzz test scriptsDavid Sterba2018-03-30
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert/014 use shell builtin for generating contentDavid Sterba2018-03-30
| | | | | | | We can remove dependency on perl and use shell builtin go generate sequence of bytes. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: update README, images, coding styleDavid Sterba2018-03-30
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: mkfs fills uuid and otime for FS_TREEDavid Sterba2018-03-30
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREEMisono Tomohiro2018-03-30
| | | | | | | | | | | | | | | | | Currently, the top-level subvolume lacks the UUID. As a result, both non-snapshot subvolume and snapshot of top-level subvolume do not have Parent UUID and cannot be distinguisued. Therefore "fi show" of top-level lists all the subvolumes which lacks the UUID in "Snapshot(s)" filed. Also, it lacks the otime information. Fix this by adding the UUID and otime at the mkfs time. As a consequence, snapshots of top-level subvolume now have a Parent UUID and UUID tree will create an entry for top-level subvolume at mount time. This should not cause the problem for current kernel, but user program which relies on the empty Parent UUID may be affected by this change. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Beautify owner when printing leaf/nodesNikolay Borisov2018-03-30
| | | | | | | | | | | | | | | Currently we print the raw values of the owner field of leaf/nodes. This can result in output like the following: leaf 30490624 items 2 free space 16061 generation 4 owner 18446744073709551607 With the patch applied the same leaf looks like: leaf 30490624 items 2 free space 16061 generation 4 owner DATA_RELOC_TREE Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: don't use fallocate in mkfs/014-rootdir-inline-extentDavid Sterba2018-03-30
| | | | | | | If fallocate is not supported, this test fails. Use a shell trick to fill with given number of bytes. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Add testcase for rootdir inline extent sizeQu Wenruo2018-03-30
| | | | | | | | Add a test case for mkfs --rootdir, using files with different file sizes to check if invalid large inline extent could exist. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/convert: Add test case for invalid large inline data extentQu Wenruo2018-03-30
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check/lowmem mode: Check inline extent sizeQu Wenruo2018-03-30
| | | | | Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: original mode: Check inline extent sizeQu Wenruo2018-03-30
| | | | | | | | | | | | | | | For inline compressed file extent, kernel doesn't allow inline extent ram size larger than sector size and on-disk inline extent size should not exceed BTRFS_MAX_INLINE_DATA_SIZE(). For inline uncompressed file extent, kernel doesn't allow inline extent ram and on-disk size larger than either BTRFS_MAX_INLINE_DATA_SIZE() or sector size. Check it in original mode. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs/rootdir: Fix inline extent creation checkQu Wenruo2018-03-30
| | | | | | | | Just like convert, we need extra check against sector size for creating inline extent. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert: Fix inline file extent creation conditionQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Bug] On btrfs converted from ext*, one user reported the following kernel warning: ------------[ cut here ]------------ BTRFS: Transaction aborted (error -95) WARNING: CPU: 0 PID: 324 at fs/btrfs/inode.c:3042 btrfs_finish_ordered_io+0x7ab/0x850 [btrfs] Workqueue: btrfs-endio-write btrfs_endio_write_helper [btrfs] RIP: 0010:btrfs_finish_ordered_io+0x7ab/0x850 [btrfs] ... Call Trace: normal_work_helper+0x39/0x370 [btrfs] process_one_work+0x1ce/0x410 worker_thread+0x2b/0x3d0 ? process_one_work+0x410/0x410 kthread+0x113/0x130 ? kthread_create_on_node+0x70/0x70 ? do_syscall_64+0x74/0x190 ? SyS_exit_group+0x10/0x10 ret_from_fork+0x35/0x40 ---[ end trace c8ed62ff6a525901 ]--- BTRFS: error (device dm-2) in btrfs_finish_ordered_io:3042: errno=-95 unknown BTRFS info (device dm-2): forced readonly BTRFS error (device dm-2): pending csums is 6447104 [Cause] The call trace and the unique return value points to __btrfs_drop_extents(), when we tries to drop pages of an inline extent, we will trigger such -EOPNOTSUPP. However kernel has limitation on the size of inline file extent (sector size for ram size and sector size - 1 for on-disk size), btrfs-convert doesn't have the same limitation, resulting much larger file extent. The lack of correct inline extent size check dates back to 2008 when btrfs-convert is added into btrfs-progs. [Fix] Fix the inline extent creation condition, not only using BTRFS_MAX_INLINE_DATA_SIZE(), which is only the maximum size of inline data according to nodesize, but also limit it against sector size. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: add option to print children nodes of a given blockQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | When debuging with "btrfs inspect dump-tree", it's not that handy if we want to iterate all child tree blocks starting from a specified block. -b can only print a single block, while without -b "btrfs inspect dump-tree" will need extra tree roots fulfilled to continue, which is not possible for a damaged filesystem. Add a new option --follow to iterate a sub-tree starting from block specified by --block. Signed-off-by: Qu Wenruo <wqu@suse.com> [ remove the short option for now ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Enhance warning on tree block level mismatch and ↵Qu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | | | | | | error handling This patch enhances the tree block level mismatch by the following methods: 1) Merge same warning branches into one We had two branches showing the same message, and their condition is also the same. Merge them 2) Only skip bad slot The old code skipped all the remaining slots, here we just skip one slot to output as many correct tree blocks as possible. 3) Enhance warning message Output the parent bytenr and expected and wrong level, so we don't need to refer to stdout to get which tree block is corrupted. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Fix typos in docs and user-facing stringsNicholas D Steeves2018-03-30
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Do correct offset output for ROOT_ITEMQu Wenruo2018-03-30
| | | | | | | | | | | | | | | | | Commit Fixes: 8c36786c8198 ("btrfs-progs: print-tree: Print offset as tree objectid for ROOT_ITEM") changes how we translate offset of ROOT_ITEM. However the fact is, even for ROOT_ITEM, we have different meaning of offset. For tree reloc tree, it's indeed subvolume id. But for other trees, it's the transid of when it's created. Reported-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert/ext2: Remove check for ext2_ext_attr_entry->e_value_blockQu Wenruo2018-03-30
| | | | | | | | | | | | | In latest e2fsprogs (1.44.0) definition of ext2_ext_attr_entry has removed member e_value_block, as currently ext* doesn't support it set anyway. So remove such check so that we can pass compile. Issue: #110 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199071 Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>