Goffredo Baroncelli [Tue, 5 Jun 2012 17:26:34 +0000 (19:26 +0200)]
scrub_fs_info( ) file handle leaking
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.
Shawn Bohrer [Sat, 26 May 2012 17:57:55 +0000 (12:57 -0500)]
btrfs-progs: Update resize documentation
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>
Chris Samuel [Fri, 11 May 2012 12:55:17 +0000 (22:55 +1000)]
Fix "set-dafault" typo in cmds-subvolume.c
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>
Hubert Kario [Mon, 30 Apr 2012 23:54:08 +0000 (01:54 +0200)]
man: fix btrfs man page formatting
Signed-off-by: Hubert Kario <kario@wit.edu.pl>
Josef Bacik [Wed, 28 Mar 2012 18:20:52 +0000 (14:20 -0400)]
btrfs-progs: enforce block count on all devices in mkfs
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>
Miao Xie [Thu, 23 Feb 2012 07:52:58 +0000 (15:52 +0800)]
Btrfs-progs: fix btrfsck's snapshot wrong "unresolved refs"
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>
Jan Kara [Fri, 10 Feb 2012 10:49:19 +0000 (11:49 +0100)]
mkfs: Handle creation of filesystem larger than the first device
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>
Hubert Kario [Sun, 19 Feb 2012 20:11:46 +0000 (21:11 +0100)]
Fix segmentation fault when opening invalid file system
Signed-off-by: Hubert Kario <kario@wit.edu.pl>
Josef Bacik [Wed, 25 Apr 2012 18:22:32 +0000 (14:22 -0400)]
Btrfs-progs: make btrfs filesystem show <uuid> actually work
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>
Jim Meyering [Fri, 20 Apr 2012 19:27:26 +0000 (21:27 +0200)]
mkfs: avoid heap-buffer-read-underrun for zero-length "size" arg
* 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>
Jim Meyering [Fri, 20 Apr 2012 19:27:25 +0000 (21:27 +0200)]
avoid several strncpy-induced buffer overruns
* 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>
Jim Meyering [Fri, 20 Apr 2012 19:27:24 +0000 (21:27 +0200)]
restore: don't corrupt stack for a zero-length command-line argument
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>
Jim Meyering [Fri, 20 Apr 2012 19:27:23 +0000 (21:27 +0200)]
mkfs: use strdup in place of strlen,malloc,strcpy sequence
* mkfs.c (traverse_directory): No semantic change.
Reviewed-by: Josef Bacik <josef@redhat.com>
Jim Meyering [Wed, 11 Apr 2012 14:42:50 +0000 (16:42 +0200)]
btrfs_scan_one_dir: avoid use-after-free on error path
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>
Josef Bacik [Mon, 9 Apr 2012 19:22:13 +0000 (15:22 -0400)]
Btrfs-progs: make btrfsck aware of free space inodes
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>
Sergei Trofimovich [Mon, 2 Apr 2012 13:10:02 +0000 (16:10 +0300)]
Makefile: use $(MAKE) instead of hardcoded 'make'
CC: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Sergei Trofimovich [Mon, 2 Apr 2012 13:10:01 +0000 (16:10 +0300)]
Makefile: use $(CC) as a compilers instead of $(CC)/gcc
CC: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Wang Sheng-Hui [Mon, 5 Mar 2012 05:33:59 +0000 (13:33 +0800)]
btrfs-progs: cleanup: remove the redundant BTRFS_CSUM_TYPE_CRC32 macro definition in ctree.h
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Chris Mason [Wed, 28 Mar 2012 16:05:27 +0000 (12:05 -0400)]
Add incompat flag for big metadata blocks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Mon, 26 Mar 2012 20:17:08 +0000 (16:17 -0400)]
mkfs: make -l and -n an alias for each other
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>
Chris Mason [Wed, 22 Feb 2012 02:20:54 +0000 (21:20 -0500)]
btrfsck: add early code to handle corrupted block groups
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>
Chris Mason [Tue, 21 Feb 2012 20:56:10 +0000 (15:56 -0500)]
Scan /dev/md and device mapper devices last
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>
Chris Mason [Tue, 21 Feb 2012 20:33:20 +0000 (15:33 -0500)]
Btrfs: use /proc/partitions scanning for btrfs_scan_for_fsid
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>
Chris Mason [Tue, 21 Feb 2012 19:37:21 +0000 (14:37 -0500)]
Btrfsck: add the ability to prune corrupt extent allocation tree blocks
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>
Chris Mason [Fri, 10 Feb 2012 18:28:50 +0000 (13:28 -0500)]
btrfsck: remove extents from the fsck reference tracker as they are freed
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>
Chris Mason [Thu, 9 Feb 2012 16:53:33 +0000 (11:53 -0500)]
btrfsck: make sure we fix the block group accounting during repair
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>
Chris Mason [Thu, 9 Feb 2012 15:38:05 +0000 (10:38 -0500)]
btrfsck: add --init-csum-tree to replace the csum root with an empty one
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>
Chris Mason [Thu, 9 Feb 2012 14:29:19 +0000 (09:29 -0500)]
btrfsck: make sure to dirty all block groups as we fix accounting
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>
Chris Mason [Thu, 9 Feb 2012 03:26:26 +0000 (22:26 -0500)]
Fix btrfs-convert, btrfs-restore and btrfs-find-root build
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fixit
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Thu, 9 Feb 2012 02:38:20 +0000 (21:38 -0500)]
Turn off some commands in Makefile
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Thu, 9 Feb 2012 02:29:56 +0000 (21:29 -0500)]
Merge branch 'for-chris' of git://github.com/idryomov/btrfs-progs
Chris Mason [Thu, 9 Feb 2012 02:29:13 +0000 (21:29 -0500)]
btrfsck: fix block group accounting during repair
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Ilya Dryomov [Wed, 8 Feb 2012 15:45:54 +0000 (17:45 +0200)]
Btrfs-progs: allow multi-line command group synopsis
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Chris Mason [Tue, 7 Feb 2012 13:36:38 +0000 (08:36 -0500)]
btrfs-corrupt-block: add -E option to randomly corrupt the extent_root
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Tue, 7 Feb 2012 10:13:24 +0000 (05:13 -0500)]
btrfsck: add code to rebuild extent records
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>
Chris Mason [Mon, 6 Feb 2012 13:54:05 +0000 (08:54 -0500)]
btrfs-corrupt-block: add -e option to corrupt the extent record
This will zero out the extent allocation tree records for the extent.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Mon, 6 Feb 2012 13:53:43 +0000 (08:53 -0500)]
btrfsck: don't BUG on corrupted extent records
Chris Mason [Mon, 6 Feb 2012 10:06:18 +0000 (05:06 -0500)]
Allow extent_buffers to use more ram
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>
Chris Mason [Mon, 6 Feb 2012 10:05:59 +0000 (05:05 -0500)]
btrfsck: print some progress
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Sun, 5 Feb 2012 21:11:48 +0000 (16:11 -0500)]
Add open_ctree_fs_info for partial FS opens
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>
Chris Mason [Sun, 5 Feb 2012 20:09:10 +0000 (15:09 -0500)]
Merge branch 'restriper' of git://github.com/idryomov/btrfs-progs
Chris Mason [Sun, 5 Feb 2012 15:42:02 +0000 (10:42 -0500)]
Btrfs-progs: fall back to the v1 ioctl if the new balance ioctl fails
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>
Chris Mason [Sun, 5 Feb 2012 15:14:09 +0000 (10:14 -0500)]
Merge branch 'restriper' of git://github.com/idryomov/btrfs-progs
Chris Mason [Sun, 5 Feb 2012 15:14:01 +0000 (10:14 -0500)]
Merge branch 'parser' of git://github.com/idryomov/btrfs-progs
Ilya Dryomov [Fri, 3 Feb 2012 19:02:30 +0000 (21:02 +0200)]
Btrfs-progs: add restriper commands
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Ilya Dryomov [Fri, 3 Feb 2012 19:02:30 +0000 (21:02 +0200)]
Btrfs-progs: add 'balance' command group infrastructure
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>
Ilya Dryomov [Fri, 3 Feb 2012 19:02:29 +0000 (21:02 +0200)]
Btrfs-progs: add restriper headers
Add restriper headers and update print-tree.c
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Ilya Dryomov [Fri, 3 Feb 2012 19:00:17 +0000 (21:00 +0200)]
Btrfs-progs: switch all existing commands to a new parser
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>
Ilya Dryomov [Fri, 3 Feb 2012 19:00:17 +0000 (21:00 +0200)]
Btrfs-progs: implement new subcommand parser
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>
Ilya Dryomov [Fri, 3 Feb 2012 19:00:17 +0000 (21:00 +0200)]
Btrfs-progs: rearrange files in the repo
Separate every command group into its own file (cmds_<group>.c) and
rearrange includes. Remove btrfs_cmds.c.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Ilya Dryomov [Mon, 12 Dec 2011 18:00:25 +0000 (20:00 +0200)]
Btrfs-progs: change the way mkfs picks raid profiles
Currently mkfs in response to
mkfs.btrfs -d raid10 dev1 dev2
instead of telling "you can't do that" creates a SINGLE on two devices,
and only rebalance can transform it to raid0. Generally, it never warns
users about decisions it makes and it's not at all obvious which profile
it picks when.
Fix this by checking the number of effective devices and reporting back
if the specified profile is impossible to create. Do not create FS in
case invalid profile was given.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Ilya Dryomov [Mon, 12 Dec 2011 18:00:25 +0000 (20:00 +0200)]
Btrfs-progs: fail gracefully on error from open_ctree()
Error checking block got moved mistakenly exposing us to a potential
segmentation fault.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Arnd Hannemann [Thu, 1 Dec 2011 16:33:21 +0000 (11:33 -0500)]
Btrfs-progs: Relocate -lpthread in makefile
This patch fixes the following compile error when compiled with
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3):
gcc -lpthread -g -O0 -o btrfs btrfs.o btrfs_cmds.o scrub.o \
ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o btrfs-list.o btrfslabel.o -luuid
scrub.o: In function `scrub_start':
/home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1342: undefined reference to `pthread_create'
/home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1360: undefined reference to `pthread_create'
/home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1374: undefined reference to `pthread_join'
/home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1430: undefined reference to `pthread_cancel'
/home/arnd/Projekte/kernel/btrfs-progs/scrub.c:1432: undefined reference to `pthread_join'
collect2: ld returned 1 exit status
make: *** [btrfs] Error 1
The gcc man page says: "[...] the placement of the -l option is significant." so lets include -lpthread together with the usual $(LIBS)
Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Mon, 21 Nov 2011 15:27:17 +0000 (10:27 -0500)]
btrfs-progs: make sure btrfs-zero-log writes something
The close_ctree code does a check to see if the FS has
changed before it does any IO. This forces the commit.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Sat, 5 Nov 2011 18:58:41 +0000 (14:58 -0400)]
Btrfs: add the tree history log to btrfs-progs
This also adds btrfs-debug-tree -R to print the history
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Thu, 3 Nov 2011 16:17:49 +0000 (12:17 -0400)]
Btrfs: fix raid10 reading math
The btrfs-progs raid10 code has been silently reading the wrong
raid10 block forever. We didn't notice because it was always fixed
up by the retry code.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Jan Schmidt [Wed, 2 Nov 2011 15:42:30 +0000 (11:42 -0400)]
Btrfs-progs: added ioctls and commands to resolve inodes and logical addrs
two new commands that make use of the new path resolving functions
implemented for scrub, doing the resolving in-kernel. the result for both
commands is a list of files belonging to that inode / logical address.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Jan Schmidt [Fri, 8 Jul 2011 10:25:11 +0000 (12:25 +0200)]
Btrfs-progs: added resolve commands to man page
Added "inspect-internal inode-resolve" and "inspect-internal
logical-resolve" to the btrfs(8) man page.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Li Zefan [Wed, 15 Dec 2010 03:33:33 +0000 (03:33 +0000)]
Fix missing entries in listing of subvolumes
Stephane Chazelas <stephane.chazelas@gmail.com> writes:
> I've got a btrfs FS with 84 subvolumes in it (some created with
> "btrfs sub create", some with "btrfs sub snap" of the other
> ones). There's no nesting of subvolumes at all (all direct children
> of the root subvolume).
>
> The "btrfs subvolume list" is only showing 80 subvolumes. The 4
> missing ones (1 original volume, 3 snapshots) do exist on disk and
> files in there have different st_devs from any other subvolume.
>
> I found
> http://thread.gmane.org/gmane.comp.file-systems.btrfs/8123/focus=8208
>
> which looks like the same issue, with Li Zefan saying he had a
> fix, but I couldn't find any mention that it was actually fixed.
Li Zefan <lizf@cn.fujitsu.com> replied:
> After that, I posted a patch to fix btrfs-progs, which Chris aggreed
> on:
>
> http://marc.info/?l=linux-btrfs&m=
129238454714319&w=2
So this btrfs-progs patch should fix missing subvolumes in the output of
"subvolume list":
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Chris Mason [Wed, 2 Nov 2011 15:22:09 +0000 (11:22 -0400)]
Btrfs-progs: btrfs-list: split list_subvols
split list_subvols to separate functions and allow printing only in the
containing function. lets us make use of those functions when resolving
logical addresses.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Mon, 31 Oct 2011 18:05:03 +0000 (14:05 -0400)]
Merge branch 'recovery-beta' of git://git./linux/kernel/git/mason/btrfs-progs
Chris Mason [Fri, 28 Oct 2011 02:40:23 +0000 (22:40 -0400)]
btrfs-progs: remove old debugging statement
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Fri, 28 Oct 2011 02:02:19 +0000 (22:02 -0400)]
btrfs-progs: add a utility to corrupt a single block
Chris Mason [Thu, 27 Oct 2011 21:42:26 +0000 (17:42 -0400)]
btrfs-debug-tree: add -r option to print only the roots
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Thu, 27 Oct 2011 20:25:12 +0000 (16:25 -0400)]
restore: deal with holes and set i_size correctly
This changes restore to set the i_size of the files it
copies out based on the size in the inode. It also changes
it to skip over holes.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Thu, 27 Oct 2011 20:23:14 +0000 (16:23 -0400)]
btrfs-progs: fixup is_mounted checks
/proc/mounts contains device names that don't exist,
we end up erroring out because we're not able to stat
the device (that doesn't exist).
Fix this by allowing the mkfs when the target device doesn't exist.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Josef Bacik [Fri, 26 Aug 2011 13:51:36 +0000 (09:51 -0400)]
btrfs-progs: add a recovery utility to pull files from damanged filesystems
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Wed, 15 Dec 2010 21:03:00 +0000 (16:03 -0500)]
Print the root generation in btrfs-debug-tree
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Wed, 15 Dec 2010 21:03:00 +0000 (16:03 -0500)]
Print the root generation in btrfs-debug-tree
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Ilya Dryomov [Sat, 8 Oct 2011 21:09:19 +0000 (00:09 +0300)]
Btrfs-progs: make btrfs df report profiles for mixed block groups
Profiles other than SINGLE for mixed chunks might sound a bit strange,
but there is nothing in the filesystem that prevents a crazy user from
doing it. So make "btrfs fi df" report them properly.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Zhong, Xin [Tue, 21 Jun 2011 01:45:59 +0000 (09:45 +0800)]
btrfs-progs: Improvement for making btrfs image from source directory.
* Initialize ret in btrfs_csum_file_block
* Do not abort when xattr is not supported in the source directory
* Remove size limitation of 256M
* Alloc data chunk in a smaller size (8M) to make btrfs image smaller
* Let user specify the btrfs image name
Depends on below patch from samsung guys:
http://marc.info/?l=linux-btrfs&m=
127858068226025&w=2
Signed-off-by: Zhong, Xin <xin.zhong@intel.com>
Goffredo Baroncelli [Wed, 15 Jun 2011 19:55:25 +0000 (21:55 +0200)]
Scan the devices listed in /proc/partitions
During the commands:
- btrfs filesystem show
- btrfs device scan
the devices "scanned" are extracted from /proc/partitions. This
should avoid to scan devices not suitable for a btrfs filesystem like cdrom
and floppy or to scan not existant devices.
The old behavior (scan all the block devices under /dev) may be
forced passing the "--all-devices" switch.
Jeff Liu [Wed, 31 Aug 2011 04:35:51 +0000 (12:35 +0800)]
Btrfs-progs: specify label length larger than 255 bytes cause mkfs.btrfs buffer overflow
Hello,
While going through the mkfs.c, I noticed there is an issue for label
length checking, mkfs.btrfs will crashed if the label length exceeding
255 bytes, it's easy to triggered that out as below:
jeff@pibroch:~/opensource/btrfs-progs$ sudo ./mkfs.btrfs -L `perl -e
'print "A"x256'` /usr/src/linux-3.0/img0
WARNING! - Btrfs v0.19-35-g1b444cd IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
*** buffer overflow detected ***: ./mkfs.btrfs terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0xb7774df0]
/lib/i386-linux-gnu/libc.so.6(+0xe4cca)[0xb7773cca]
/lib/i386-linux-gnu/libc.so.6(__strcpy_chk+0x3f)[0xb777305f]
./mkfs.btrfs[0x805acc4]
./mkfs.btrfs[0x805def6]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0xb76a5e37]
./mkfs.btrfs[0x8048ef1]
======= Memory map: ========
......
a tiny patch could fix it.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Sergei Trofimovich [Sun, 28 Aug 2011 11:23:24 +0000 (14:23 +0300)]
btrfsck: decode error properly
check_mounted() returns kernel-style negative errors.
Patch drops sign for strerror().
Before the patch:
check_mounted(): Could not open /dev/sdb2
Could not check mount status: Unknown error
18446744073709551603
After the patch:
check_mounted(): Could not open /dev/sdb2
Could not check mount status: Permission denied
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Andreas Philipp [Thu, 11 Aug 2011 06:45:40 +0000 (08:45 +0200)]
check number of args for btrfs sub snap correctly
Check whether there are the right number of arguments (exatly 2 without
the flag -r) in the subcommand handler for the btrfs subvolume snapshot
command.
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Zhong, Xin [Tue, 12 Jul 2011 02:48:37 +0000 (10:48 +0800)]
Btrfs-progs: add "btrfs subvolume get-default" subcommand
Add subcommand to get the default subvolume of btrfs filesystem
V2->V3:
* add man page
* based on http://git.darksatanic.net/repo/btrfs-progs-unstable.git
integration-
20110705
Reviewed-by: Andreas Philipp <philipp.andreas@gmail.com>
Reviewed-by: Goffredo Baroncelli <kreijack@libero.it>
Reported-by: Yang, Yi <yi.y.yang@intel.com>
Signed-off-by: Zhong, Xin <xin.zhong@intel.com>
Wang Sheng-Hui [Mon, 18 Jul 2011 07:26:56 +0000 (15:26 +0800)]
btrfs-progs-unstable: replace debug-tree to btrfs-debug-tree in INSTALL
From
c04da1655df6d75db834ddbd3a3b4a58a0d9a0c9 Mon Sep 17 00:00:00 2001
From: Wang Sheng-Hui <shhuiw@gmail.com>
Date: Mon, 18 Jul 2011 02:17:31 -0500
Subject: [PATCH] btrfs-progs-unstable: replace debug-tree to btrfs-debug-tree in INSTALL
debug-tree doesn't exist after btrfs-progs installed.
Use btrfs-debug-tree to print FS metadata in text form,
not debug-tree.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Hugo Mills [Sat, 9 Jul 2011 17:50:23 +0000 (18:50 +0100)]
fix incorrect argument checking for "btrfs sub snap -r"
Stephane Chazelas and Andreas Philipp spotted that the earlier patch
fixing this issue was incomplete, and should also update the argument-
count checking code as well.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Jan Schmidt [Mon, 18 Jul 2011 12:37:25 +0000 (14:37 +0200)]
btrfs-progs: scrub added to manpage
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Jan Schmidt [Mon, 18 Jul 2011 12:37:24 +0000 (14:37 +0200)]
btrfs-progs: scrub userland implementation
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Jan Schmidt [Mon, 18 Jul 2011 12:37:23 +0000 (14:37 +0200)]
btrfs-progs: added check_mounted_where
new version of check_mounted() returning more information gathered while
searching. check_mounted() is now a wrapper for check_mounted_where(). the
new version is needed by scrub.c
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Jan Schmidt [Mon, 18 Jul 2011 12:37:22 +0000 (14:37 +0200)]
btrfs-progs: scrub ioctls
- scrub structs added
- ioctls for scrub
- BTRFS_FSID_SIZE moved
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Jan Schmidt [Mon, 18 Jul 2011 12:37:21 +0000 (14:37 +0200)]
btrfs-progs: commands added
- scrub commands added
- open_file_or_dir no longer static (needed by scrub.c)
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Andreas Philipp [Sun, 3 Jul 2011 19:34:20 +0000 (21:34 +0200)]
remove unused include "version.h"
In the file btrfs-list.c version.h was included but not used. So just
drop it.
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Andreas Philipp [Sat, 2 Jul 2011 22:26:40 +0000 (00:26 +0200)]
update manpage entries for btrfs subvolume list
Update the manpage entries for the btrfs subvolume list command to
reflect the newly created additional option '-p'.
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Andreas Philipp [Sat, 2 Jul 2011 22:26:39 +0000 (00:26 +0200)]
print parent ID in btrfs suvolume list
There was some discussion on "where" subvolumes live in. Why do we not
simply print the parent ID for each subvolume in btrfs subvolume list?
This patch adds this functionality when called with parameter "-p".
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Andreas Philipp [Fri, 1 Jul 2011 22:44:38 +0000 (00:44 +0200)]
some style/layout changes
Just do a few simple style/layout changes to make the makefile look
better.
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Andreas Philipp [Fri, 1 Jul 2011 22:44:36 +0000 (00:44 +0200)]
add all targets to clean target
When issuing 'make clean' not all files generated by the individual
targets have been deleted since some files have been missing in the
definition of the 'make clean' target.
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Hubert Kario [Wed, 29 Jun 2011 17:54:35 +0000 (19:54 +0200)]
remove unused variables
fixes compilation warnings with gcc 4.6.0
20110429
Signed-off-by: Hubert Kario <kario@wit.edu.pl>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Hugo Mills [Thu, 28 Jul 2011 21:17:57 +0000 (22:17 +0100)]
gcc 4.6: fix potentially unused variable
Fix a complaint by gcc 4.6 that "ret" may be unused in
process_one_leaf of btrfsck.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Kamble, Nitin A [Tue, 28 Jun 2011 19:11:35 +0000 (12:11 -0700)]
make btrfs cross compilation friendly
Attached is a patch to fix a cross compilation issue I observed with btrfs-tools.
Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Nitin A Kamble
Yocto Project
www.yoctoproject.org
Avoid these kinds of errors while doing cross build:
| ccache i586-poky-linux-gcc -march=i586 --sysroot=/disk0/pokybuild/build0/tmp/sysroots/qemux86 -Wp,-MMD,./.btrfsctl.o.d,-MT,btrfsctl.o -Wall -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -pipe -g -feliminate-unused-debug-types -c btrfsctl.c
| gcc -O2 -pipe -g -feliminate-unused-debug-types -o btrfsctl btrfsctl.o ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o btrfs-list.o -Wl,-O1 -Wl,--as-needed -luuid
| /usr/bin/ld: i386 architecture of input file `btrfsctl.o' is incompatible with i386:x86-64 output
| /usr/bin/ld: i386 architecture of input file `ctree.o' is incompatible with i386:x86-64 output
Hugo Mills [Sun, 26 Jun 2011 18:41:18 +0000 (19:41 +0100)]
mkfs.btrfs: Fix compilation errors with gcc 4.6
gcc 4.6 complains about several possible use-before-initialise cases
in mkfs, and stops. Fix these by initialising one of the variables in
question, and using the correct error-handling paths for the
remainder.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
cwillu [Mon, 13 Jun 2011 22:24:11 +0000 (16:24 -0600)]
Btrfs-progs: Correct path munging in bcp
Bcp was assuming that a path on the command line would never have a slash after
it, which is silly, and would cause the first letter of everything in the root
of the source to be truncated. Instead, use os.path.relpath to handle
it properly.
Signed-off-by: Carey Underwood <cwillu@cwillu.com>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Arne Jansen [Mon, 14 Mar 2011 11:57:49 +0000 (12:57 +0100)]
btrfs-map-logical: segfaults when no output file is given
when no output file is given, info_file stays NULL and the following
fprintf segfaults. Default to stdout.
Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:24 +0000 (11:19 +0300)]
mkfs.btrfs: fix error text in '-r' mode
Smart gcc noticed use of uninitialized warning when compiled
with -O0 flags:
mkfs.c:1291: error: 'file' may be used uninitialized in this function
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:23 +0000 (11:19 +0300)]
mkfs.btrfs: fix memory leak caused by 'scandir()' calls
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:22 +0000 (11:19 +0300)]
mkfs.btrfs: free buffers allocated by pretty_sizes
found by valgrind:
==2559== 16 bytes in 1 blocks are definitely lost in loss record 3 of 19
==2559== at 0x4C2720E: malloc (vg_replace_malloc.c:236)
==2559== by 0x412F7E: pretty_sizes (utils.c:1054)
==2559== by 0x4179E9: main (mkfs.c:1395)
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:21 +0000 (11:19 +0300)]
mkfs.btrfs: write zeroes instead on uninitialized data.
Found by valgrind:
==8968== Use of uninitialised value of size 8
==8968== at 0x41CE7D: crc32c_le (crc32c.c:98)
==8968== by 0x40A1D0: csum_tree_block_size (disk-io.c:82)
==8968== by 0x40A2D4: csum_tree_block (disk-io.c:105)
==8968== by 0x40A7D6: write_tree_block (disk-io.c:241)
==8968== by 0x40ACEE: __commit_transaction (disk-io.c:354)
==8968== by 0x40AE9E: btrfs_commit_transaction (disk-io.c:385)
==8968== by 0x42CF66: make_image (mkfs.c:1061)
==8968== by 0x42DE63: main (mkfs.c:1410)
==8968== Uninitialised value was created by a stack allocation
==8968== at 0x42B5FB: add_inode_items (mkfs.c:493)
1. On-disk inode format has reserved (and thus, random at alloc time) fields:
btrfs_inode_item: __le64 reserved[4]
2. Sometimes extents are created on disk without writing data there.
(Or at least not all data is written there). Kernel code always had
it kzalloc'ed.
Zero them all.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:20 +0000 (11:19 +0300)]
mkfs.btrfs: fix symlink names writing
Found by valgrind:
==8968== Use of uninitialised value of size 8
==8968== at 0x41CE7D: crc32c_le (crc32c.c:98)
==8968== by 0x40A1D0: csum_tree_block_size (disk-io.c:82)
==8968== by 0x40A2D4: csum_tree_block (disk-io.c:105)
==8968== by 0x40A7D6: write_tree_block (disk-io.c:241)
==8968== by 0x40ACEE: __commit_transaction (disk-io.c:354)
==8968== by 0x40AE9E: btrfs_commit_transaction (disk-io.c:385)
==8968== by 0x42CF66: make_image (mkfs.c:1061)
==8968== by 0x42DE63: main (mkfs.c:1410)
==8968== Uninitialised value was created by a stack allocation
==8968== at 0x42B5FB: add_inode_items (mkfs.c:493)
readlink(2) does not write '\0' for us, so make it manually.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
Sergei Trofimovich [Sat, 4 Jun 2011 08:19:19 +0000 (11:19 +0300)]
mkfs.btrfs: return some defined value instead of garbage when lookup checksum
==31873== Command: ./mkfs.btrfs -r /some/root/
==31873== Parent PID: 31872
==31873==
==31873== Conditional jump or move depends on uninitialised value(s)
==31873== at 0x42C3D0: add_file_items (mkfs.c:792)
==31873== by 0x42CAB3: traverse_directory (mkfs.c:948)
==31873== by 0x42CF11: make_image (mkfs.c:1047)
==31873== by 0x42DE53: main (mkfs.c:1401)
==31873== Uninitialised value was created by a stack allocation
==31873== at 0x41B1B1: btrfs_csum_file_block (file-item.c:195)
'ret' value was not initialized for 'found' branch.
The same fix sits in kernel:
> commit
639cb58675ce9b507eed9c3d6b3335488079b21a
> Author: Chris Mason <chris.mason@oracle.com>
> Date: Thu Aug 28 06:15:25 2008 -0400
>
> Btrfs: Fix variable init during csum creation
>
> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>