summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: removed extraneous whitespace from mkfs man pagePhillip Susi2012-07-03
| | | | | | | There were extra spaces around some of the arguments in the man page for mkfs. Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
* scrub_fs_info( ) file handle leakingGoffredo Baroncelli2012-07-03
| | | | | | | | | The function scrub_fs_info( ) closes and reopen a file handle passed as argument, when a caller uses the file handle even after the call. The function scrub_fs_info( ) is updated to remove the file handle argument, and instead uses a private own file handle. The callers are updated to not pass the argument.
* btrfs-progs: Update resize documentationShawn Bohrer2012-07-03
| | | | | | | | | | | The btrfs filesystem resize command defaults to only resizing the filesystem for devid 1, and must have a devid passed in to resize the filesystem for the other devices in the filesystem. Additionally the documentation lacked information on how to actually resize the underlying partition so this provides a little more detail. Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
* Fix "set-dafault" typo in cmds-subvolume.cChris Samuel2012-07-03
| | | | | | | Andrei Popa reported that there were two typos of default as dafault, this patch fixes those two typos up. Signed-off-by: Chris Samuel <chris@csamuel.org>
* man: fix btrfs man page formattingHubert Kario2012-07-03
| | | | Signed-off-by: Hubert Kario <kario@wit.edu.pl>
* btrfs-progs: enforce block count on all devices in mkfsJosef Bacik2012-07-03
| | | | | | | | | | I had a test that creates a 7gig raid1 device but it was ending up wonky because the second device that gets added is the full size of the disk instead of the limited size. So enforce the limited size on all disks passed in at mkfs time, otherwise our threshold calculations end up wonky when doing chunk allocations. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
* Btrfs-progs: fix btrfsck's snapshot wrong "unresolved refs"Miao Xie2012-07-03
| | | | | | | | | If the fs/file tree is not the parent of the snapshot, it is reasonable that we can not find the relative reference and back reference. But btrfsck doesn't consider this case, and reports "unresolved refs" message, it's wrong, fix it. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* mkfs: Handle creation of filesystem larger than the first deviceJan Kara2012-07-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Wed 08-02-12 22:05:26, Phillip Susi wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 02/08/2012 06:20 PM, Jan Kara wrote: > > Thanks for your reply. I admit I was not sure what exactly size argument > > should be. So after looking into the code for a while I figured it should > > be a total size of the filesystem - or differently it should be size of > > virtual block address space in the filesystem. Thus when filesystem has > > more devices (or admin wants to add more devices later), it can be larger > > than the first device. But I'm not really a btrfs developper so I might be > > wrong and of course feel free to fix the issue as you deem fit. > > The size of the fs is the total size of the individual disks. When you > limit the size, you limit the size of a disk, not the whole fs. IIRC, > mkfs initializes the fs on the first disk, which is why it was using that > size as the size of the whole fs, and then adds the other disks after ( > which then add their size to the total fs size ). OK, I missed that btrfs_add_to_fsid() increases total size of the filesystem. So now I agree with you. New patch is attached. Thanks for your review. > It might be nice if > mkfs could take sizes for each disk, but it only seems to take one size > for the initial disk. Yes, but I don't see a realistic usecase so I don't think it's really worth the work. Honza -- Jan Kara <jack@suse.cz> SUSE Labs, CR >From e5f46872232520310c56327593c02ef6a7f5ea33 Mon Sep 17 00:00:00 2001 From: Jan Kara <jack@suse.cz> Date: Fri, 10 Feb 2012 11:44:44 +0100 Subject: [PATCH] mkfs: Handle creation of filesystem larger than the first device mkfs does not properly check requested size of the filesystem. Thus if the requested size is larger than the first device, it happily creates larger filesystem than a device it resides on which results in 'attemp to access beyond end of device' messages from the kernel. So verify specified filesystem size against the size of the first device. CC: David Sterba <dsterba@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
* Fix segmentation fault when opening invalid file systemHubert Kario2012-07-03
| | | | Signed-off-by: Hubert Kario <kario@wit.edu.pl>
* Btrfs-progs: make btrfs filesystem show <uuid> actually workJosef Bacik2012-07-03
| | | | | | | | The btrfs filesystem show command is only actually searching for labels, it's not searching for UUID's at all. This patch fixes that problem. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
* mkfs: avoid heap-buffer-read-underrun for zero-length "size" argJim Meyering2012-06-05
| | | | | | | | * mkfs.c (parse_size): ./mkfs.btrfs -A '' would read and possibly write the byte before beginning of strdup'd heap buffer. All other size-accepting options were similarly affected. Reviewed-by: Josef Bacik <josef@redhat.com>
* avoid several strncpy-induced buffer overrunsJim Meyering2012-06-05
| | | | | | | | | | | | | | * restore.c (main): Ensure strncpy-copied dir_name is NUL-terminated. * btrfsctl.c (main): Likewise, for a command-line argument. * utils.c (multiple functions): Likewise. * btrfs-list.c (add_root): Likewise. * btrfslabel.c (change_label_unmounted): Likewise. * cmds-device.c (cmd_add_dev, cmd_rm_dev, cmd_scan_dev): Likewise. * cmds-filesystem.c (cmd_resize): Likewise. * cmds-subvolume.c (cmd_subvol_create, cmd_subvol_delete, cmd_snapshot): Likewise. Reviewed-by: Josef Bacik <josef@redhat.com>
* restore: don't corrupt stack for a zero-length command-line argumentJim Meyering2012-06-05
| | | | | | | | Given a zero-length directory name, the trailing-slash removal code would test dir_name[-1], and if it were found to be a slash, would set it to '\0'. Reviewed-by: Josef Bacik <josef@redhat.com>
* mkfs: use strdup in place of strlen,malloc,strcpy sequenceJim Meyering2012-06-05
| | | | | | * mkfs.c (traverse_directory): No semantic change. Reviewed-by: Josef Bacik <josef@redhat.com>
* btrfs_scan_one_dir: avoid use-after-free on error pathJim Meyering2012-06-05
| | | | | | | | | | If we iterate the "goto again" loop, we've called "closedir(dirp)", yet at the top of the loop, upon malloc failure we "goto fail", where we test dirp and if non-NULL, call closedir(dirp) again. * utils.c (btrfs_scan_one_dir): Clear "dirp" after closedir to avoid use-after-free upon failed fullpath = malloc(... Signed-off-by: Jim Meyering <meyering@redhat.com>
* Btrfs-progs: make btrfsck aware of free space inodesJosef Bacik2012-06-05
| | | | | | | | | | | The new xfstests will run fsck against the volume to make sure we didn't introduce any inconsistencies, which is nice except we will error out immediately if we mount with inode_cache. We need to make btrfsck skip the special free space cache items and then just assume that we have a link for the free space cache inode item. This makes btrfsck pass with success on a fs with inode cache items. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
* Makefile: use $(MAKE) instead of hardcoded 'make'Sergei Trofimovich2012-06-05
| | | | | CC: Chris Mason <chris.mason@oracle.com> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Makefile: use $(CC) as a compilers instead of $(CC)/gccSergei Trofimovich2012-06-05
| | | | | CC: Chris Mason <chris.mason@oracle.com> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* btrfs-progs: cleanup: remove the redundant BTRFS_CSUM_TYPE_CRC32 macro ↵Wang Sheng-Hui2012-06-05
| | | | | | definition in ctree.h Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
* Add incompat flag for big metadata blocksChris Mason2012-03-28
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* mkfs: make -l and -n an alias for each otherChris Mason2012-03-26
| | | | | | | We don't allow different leaf and node blocksizes, so this just makes the two options mean the same thing Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: add early code to handle corrupted block groupsChris Mason2012-02-22
| | | | | | | This is mostly disabled, but it is step one in handling corrupted block groups in the extent allocation tree. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Scan /dev/md and device mapper devices lastChris Mason2012-02-22
| | | | | | | | | | | When we're using multipath or raid0, it is possible that btrfs dev scan will find one of the component devices instead of the proper virtual device the kernel creates. We want to make sure the kernel scans the virtual devices last, since it always remembers the last device it finds with a given fsid. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: use /proc/partitions scanning for btrfs_scan_for_fsidChris Mason2012-02-21
| | | | | | | | btrfs_scan_for_fsid is used by open_ctree and by mkfs when it is checking for mounted devices. It currently scans all of /dev, which is rarely the right answer. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfsck: add the ability to prune corrupt extent allocation tree blocksChris Mason2012-02-21
| | | | | | | When we discover bad blocks in the extent allocation tree, repair can now discard them and recreate the references from the rest of the trees. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: remove extents from the fsck reference tracker as they are freedChris Mason2012-02-10
| | | | | | | | | | | | | | | | | | | During btrfsck --repair, we make an index of extents that have incorrect reference counts. Once we've collect the whole index, we go through and modify the extent allocation tree to reflect the correct results. Changing the extent allocation tree may free blocks, and so it may end up removing a block that had a missing reference structure. The fsck code may then circle back around and add the reference back. The result is an extent that isn't actually used, but is recorded in the extent allocation tree. This commit adds a hook called as extents are freed. The hook searches the index of incorrect references and updates it to reflect the freeing of the extent. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: make sure we fix the block group accounting during repairChris Mason2012-02-09
| | | | | | | | The block group accounting is fixed after we check the extent back references. This makes sure the accounting is fixed unless we were not able to repair the backrefs. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: add --init-csum-tree to replace the csum root with an empty oneChris Mason2012-02-09
| | | | | | | This will effectively delete all of your crcs, but at least you'll be able to mount the FS with nodatasum. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfsck: make sure to dirty all block groups as we fix accountingChris Mason2012-02-09
| | | | | | | | | The code that corrects the count of bytes used in each block group was only marking block groups dirty when they contained extents. This fixes things to dirty all the block groups, so any empty block groups are written with their correct (zero) count. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fix btrfs-convert, btrfs-restore and btrfs-find-root buildChris Mason2012-02-08
| | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com> fixit Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Turn off some commands in MakefileChris Mason2012-02-08
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Merge branch 'for-chris' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-08
|\
| * Btrfs-progs: allow multi-line command group synopsisIlya Dryomov2012-02-08
| | | | | | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | btrfsck: fix block group accounting during repairChris Mason2012-02-08
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfs-corrupt-block: add -E option to randomly corrupt the extent_rootChris Mason2012-02-07
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfsck: add code to rebuild extent recordsChris Mason2012-02-07
| | | | | | | | | | | | | | This also includes a new --repair btrfsck option. For now it can only fix errors in the extent allocation tree. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfs-corrupt-block: add -e option to corrupt the extent recordChris Mason2012-02-07
| | | | | | | | | | | | This will zero out the extent allocation tree records for the extent. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfsck: don't BUG on corrupted extent recordsChris Mason2012-02-06
| |
* | Allow extent_buffers to use more ramChris Mason2012-02-06
| | | | | | | | | | | | | | | | This changes free_some_buffers (called each time we allocate an extent buffer) to allow a higher hard limit on the number of extent buffers in use. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | btrfsck: print some progressChris Mason2012-02-06
| | | | | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* | Add open_ctree_fs_info for partial FS opensChris Mason2012-02-05
|/ | | | | | | | | | fsck needs to be able to open a damaged FS, which means open_ctree needs to be able to return a damaged FS. This adds a new open_ctree_fs_info which can be used to open any and all roots that are valid. btrfs-debug-tree is changed to use it. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Merge branch 'restriper' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-05
|\
| * Btrfs-progs: fall back to the v1 ioctl if the new balance ioctl failsChris Mason2012-02-05
| | | | | | | | | | | | | | | | This only falls back if the plain version of balance start is used. Any args make us report the ioctl isn't supported. Signed-off-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | Merge branch 'restriper' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-05
|\|
| * Btrfs-progs: add restriper commandsIlya Dryomov2012-02-03
| | | | | | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: add 'balance' command group infrastructureIlya Dryomov2012-02-03
| | | | | | | | | | | | | | Add balance command group under both 'btrfs' and 'btrfs filesystem'. Preserve the old 'btrfs filesystem balance <path>' behaviour. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: add restriper headersIlya Dryomov2012-02-03
| | | | | | | | | | | | Add restriper headers and update print-tree.c Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | Merge branch 'parser' of git://github.com/idryomov/btrfs-progsChris Mason2012-02-05
|\|
| * Btrfs-progs: switch all existing commands to a new parserIlya Dryomov2012-02-03
| | | | | | | | | | | | | | The new infrastructure offloads checking number of arguments passed to a command to individual command handlers. Fix them up accordingly. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * Btrfs-progs: implement new subcommand parserIlya Dryomov2012-02-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This completely replaces the existing subcommand infrastructure, which is not flexible enough to accomodate our needs. Instead of a global command table we now have per-level tables and command group handlers, which allows command-group-specific handling of options and subcommands. The new parser exports a clear interface and gets out of the way - all control over how matching is done is passed to commands and command group handlers. One side effect of this is that command implementors have to check the number of arguments themselves - patch to fix up all existing commands follows. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>