[PATCH V2] btrfs: document mount options in Documentation/fs/btrfs.txt

2013-03-26 Thread Eric Sandeen
Document all current btrfs mount options. Signed-off-by: Eric Sandeen sand...@redhat.com --- V2: * reflect that btrfs is no longer new ;) * make it clear that alloc_start is for each device * highlight potential perf impacts of -o discard * reword skip_balance docs to refer to resume diff

[PATCH] btrfs: document mount options in Documentation/fs/btrfs.txt

2013-03-23 Thread Eric Sandeen
Document all current btrfs mount options. Signed-off-by: Eric Sandeen sand...@redhat.com --- please, Please, PLEASE review this and suggest improvements. I'm no btrfs wizard but I've done my best to get this all right based on commit logs, code reading, and wiki reading. In cases where any

Re: [PATCH] btrfs: document mount options in Documentation/fs/btrfs.txt

2013-03-23 Thread Eric Sandeen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/23/13 1:33 PM, Roman Mamedov wrote: On Sat, 23 Mar 2013 12:48:54 -0500 Eric Sandeen sand...@redhat.com wrote: diff --git a/Documentation/filesystems/btrfs.txt b/Documentation/filesystems/btrfs.txt index 7671352..02a19c8 100644

Re: btrfs-show vs. btrfs different output

2013-03-22 Thread Eric Sandeen
On 3/22/13 8:59 AM, Jon Nelson wrote: On Thu, Mar 21, 2013 at 11:25 AM, Eric Sandeen sand...@redhat.com wrote: On 3/21/13 10:29 AM, Jon Nelson wrote: On Thu, Mar 21, 2013 at 10:11 AM, Eric Sandeen sand...@redhat.com wrote: On 3/21/13 10:04 AM, Jon Nelson wrote: ... 2. the current git btrfs

Re: [PATCH] btrfs-progs: fix one bracket issue in mkfs.btrfs manpage

2013-03-21 Thread Eric Sandeen
...@linux.vnet.ibm.com Whoops, yes. Thanks for spotting that. Reviewed-by: Eric Sandeen sand...@redhat.com --- man/mkfs.btrfs.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in index cdccd6a..a3f1503 100644 --- a/man

Re: btrfs-show vs. btrfs different output

2013-03-21 Thread Eric Sandeen
On 3/21/13 10:04 AM, Jon Nelson wrote: I'm running openSUSE 12.3 x86_64 which has an unknown git version, but reports v0.19. I'm also supplying the output from git which reports itself as: v0.20-rc1-253-g7854c8b The problem is that btrfs-show (git) and btrfs fi show (git) give /different/

Re: btrfs-show vs. btrfs different output

2013-03-21 Thread Eric Sandeen
On 3/21/13 10:29 AM, Jon Nelson wrote: On Thu, Mar 21, 2013 at 10:11 AM, Eric Sandeen sand...@redhat.com wrote: On 3/21/13 10:04 AM, Jon Nelson wrote: ... 2. the current git btrfs-show and btrfs fi show both output *different* devices for device with UUID b5dc52bd-21bf-4173-8049-d54d88c82240

Re: Problems with compiling btrfs

2013-03-21 Thread Eric Sandeen
On 3/21/13 4:11 PM, Joseph Moore wrote: I'm trying to compile the btrfs source code but I'm getting an error. Any suggestions? Older libblkid doesn't have that function. This is where a configure script would really help :( Locally I currently am keeping a patch around to just remove it; you

Re: Problems with compiling btrfs

2013-03-21 Thread Eric Sandeen
On 3/21/13 5:23 PM, Mitch Harder wrote: On Thu, Mar 21, 2013 at 4:46 PM, Avi Miller avi.mil...@oracle.com wrote: Hi, On 22/03/2013, at 8:11 AM, Joseph Moore jap...@gmail.com wrote: [root@ol6 btrfs-progs]# uname -a Linux ol6.localdomain 2.6.39-400.17.2.el6uek.x86_64 #1 SMP Wed Mar 13

Re: [PATCH] xfstests: add background noise to test 276 (btrfs backref resolving)

2013-03-19 Thread Eric Sandeen
it doesn't bother me. Looks ok to me: Reviewed-by: Eric Sandeen sand...@redhat.com Thanks, -Eric Signed-off-by: Jan Schmidt list.bt...@jan-o-sch.net --- 276 | 29 ++--- 1 files changed, 26 insertions(+), 3 deletions(-) diff --git a/276 b/276 index 65da464..40b30cf

Re: [PATCH] btrfs-progs: return zero for success

2013-03-18 Thread Eric Sandeen
On 3/18/13 2:24 AM, Anand Jain wrote: Signed-off-by: Anand Jain anand.j...@oracle.com You've got your testcase leaking into this defrag fix. When you resend, can you add defrag to the patch subject somehow? -Eric --- Makefile | 6 +- check-mounted.c | 31

Re: [PATCH] btrfs-progs: return zero for success

2013-03-18 Thread Eric Sandeen
On 3/18/13 11:18 AM, Eric Sandeen wrote: On 3/18/13 2:24 AM, Anand Jain wrote: Signed-off-by: Anand Jain anand.j...@oracle.com You've got your testcase leaking into this defrag fix. When you resend, can you add defrag to the patch subject somehow? -Eric Ugh,sorry. Should read all

Re: [PATCH 3/3 V4] xfstests: btrfs tests for basic informational commands

2013-03-15 Thread Eric Sandeen
Yep sorry. I figure its always a race in numbers do I don't bother with fixing them up. Should I? On Mar 15, 2013, at 5:16 AM, Dave Chinner da...@fromorbit.com wrote: On Wed, Mar 13, 2013 at 02:01:58PM -0500, Eric Sandeen wrote: Run basic btrfs information commands in various ways

Re: [PATCH 3/3 V4] xfstests: btrfs tests for basic informational commands

2013-03-15 Thread Eric Sandeen
On Mar 15, 2013, at 9:23 AM, Rich Johnston rjohns...@sgi.com wrote: On 03/15/2013 08:46 AM, Eric Sandeen wrote: Yep sorry. I figure its always a race in numbers do I don't bother with fixing them up. Should I? Eric, I was going to revert and resubmit as test 306, is that OK with you

Re: [PATCH] xfstests: make defrag test 222 generic

2013-03-15 Thread Eric Sandeen
On 3/15/13 11:03 AM, Rich Johnston wrote: On 03/15/2013 09:55 AM, David Sterba wrote: On Tue, Mar 12, 2013 at 11:42:50AM -0500, Eric Sandeen wrote: Define a new _defrag_dir() helper which just runs noisy/debug dir defrag for ext4 and/or btrfs as well, and use that in 222 instead of hardcoded

Re: [PATCH 3/3 v4] btrfs-progs: disable using backup superblock by default

2013-03-15 Thread Eric Sandeen
On 3/15/13 7:03 AM, Anand Jain wrote: maybe a little more commit log would be good? So here is what confuses me now. :) *every* caller of btrfs_read_dev_super() is now called with 0 for the flags variable, so it never reads the backup under any circumstance. If it's always called w/

Re: [PATCH] xfstests: enable test 032 (mkfs overwrite) for btrfs

2013-03-15 Thread Eric Sandeen
it's a bug, just bad administrative practice ;) -Eric --Rich On 03/13/2013 11:01 AM, Eric Sandeen wrote: Now that btrfs has an -f arg, we can test that it doesn't improperly overwrite other filesystems in 032 like we do for xfs. Signed-off-by: Eric Sandeen sand...@redhat.com

Re: btrfs_scan_one_device return error code

2013-03-14 Thread Eric Sandeen
On 3/14/13 3:31 AM, Anand Jain wrote: Hi, /dev/sdc does not contain btrfs SB at all.. --- # btrfs dev scan /dev/sdc Scanning for Btrfs filesystems in '/dev/sdc' ERROR: unable to scan the device '/dev/sdc' - Invalid argument --- here appropriate error is something like no

Re: [PATCH 3/3 v4] btrfs-progs: disable using backup superblock by default

2013-03-14 Thread Eric Sandeen
On 3/14/13 3:56 AM, Anand Jain wrote: On 03/14/2013 12:36 PM, Eric Sandeen wrote: On 3/13/13 10:05 PM, Anand Jain wrote: maybe a little more commit log would be good? So here is what confuses me now. :) *every* caller of btrfs_read_dev_super() is now called with 0 for the flags

Re: [PATCH 3/3 v4] btrfs-progs: disable using backup superblock by default

2013-03-14 Thread Eric Sandeen
On 3/14/13 9:47 AM, Eric Sandeen wrote: On 3/14/13 3:56 AM, Anand Jain wrote: On 03/14/2013 12:36 PM, Eric Sandeen wrote: On 3/13/13 10:05 PM, Anand Jain wrote: maybe a little more commit log would be good? So here is what confuses me now. :) *every* caller of btrfs_read_dev_super

[PATCH 2/3] xfstests: keep newlines out of SCRATCH_DEV_POOL

2013-03-13 Thread Eric Sandeen
SCRATCH_DEV_POOL processing actually takes the first device out for SCRATCH_DEV and leaves the rest in SCRATCH_DEV_POOL. I'm not totally sold on that behavior, but for now, at least don't populate SCRATCH_DEV_POOL with newlines. Cc: linux-btrfs@vger.kernel.org Signed-off-by: Eric Sandeen sand

[PATCH 3/3] xfstests: btrfs tests for basic informational commands

2013-03-13 Thread Eric Sandeen
. This also adds quite a few new filters to accomodate the output of the new commands. Cc: linux-btrfs@vger.kernel.org Signed-off-by: Eric Sandeen sand...@redhat.com --- 313 | 96 + 313.out | 51

[PATCH] xfstests: enable test 032 (mkfs overwrite) for btrfs

2013-03-13 Thread Eric Sandeen
Now that btrfs has an -f arg, we can test that it doesn't improperly overwrite other filesystems in 032 like we do for xfs. Signed-off-by: Eric Sandeen sand...@redhat.com --- diff --git a/032 b/032 index bf88492..89fb225 100755 --- a/032 +++ b/032 @@ -38,12 +38,18 @@ rm -f $seq.full

Re: [PATCH 3/3] xfstests: btrfs tests for basic informational commands

2013-03-13 Thread Eric Sandeen
On 3/13/13 10:32 AM, Stefan Behrens wrote: On Wed, 13 Mar 2013 09:57:03 -0500, Eric Sandeen wrote: [...] +echo == Show device stats by mountpoint +$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats Is the number of devices in SCRATCH_DEV_POOL fixed to 3? Otherwise you

[PATCH 3/3 V2] xfstests: btrfs tests for basic informational commands

2013-03-13 Thread Eric Sandeen
. This also adds quite a few new filters to accommodate the output of the new commands. Cc: linux-btrfs@vger.kernel.org Signed-off-by: Eric Sandeen sand...@redhat.com --- V2: sort uniq device stats output to account for variable nrs. of devices. Optionally check that the proper nr. of devices

Re: [PATCH 2/3] xfstests: keep newlines out of SCRATCH_DEV_POOL

2013-03-13 Thread Eric Sandeen
On 3/13/13 12:43 PM, Rich Johnston wrote: On 03/13/2013 09:57 AM, Eric Sandeen wrote: SCRATCH_DEV_POOL processing actually takes the first device out for SCRATCH_DEV and leaves the rest in SCRATCH_DEV_POOL. I'm not totally sold on that behavior, but for now, at least don't populate

[PATCH 3/3 V3] xfstests: btrfs tests for basic informational commands

2013-03-13 Thread Eric Sandeen
. This also adds quite a few new filters to accommodate the output of the new commands. Cc: linux-btrfs@vger.kernel.org Signed-off-by: Eric Sandeen sand...@redhat.com --- V2: sort uniq device stats output to account for variable nrs. of devices. Optionally check that the proper nr. of devices

[PATCH 3/3 V4] xfstests: btrfs tests for basic informational commands

2013-03-13 Thread Eric Sandeen
. This also adds quite a few new filters to accommodate the output of the new commands. Cc: linux-btrfs@vger.kernel.org Signed-off-by: Eric Sandeen sand...@redhat.com --- V2: sort uniq device stats output to account for variable nrs. of devices. Optionally check that the proper nr. of devices

Re: [PATCH 3/3 v4] btrfs-progs: disable using backup superblock by default

2013-03-13 Thread Eric Sandeen
On 3/13/13 10:05 PM, Anand Jain wrote: maybe a little more commit log would be good? So here is what confuses me now. :) *every* caller of btrfs_read_dev_super() is now called with 0 for the flags variable, so it never reads the backup under any circumstance. If it's always called w/ 0, what

[PATCH] xfstests: make defrag test 222 generic

2013-03-12 Thread Eric Sandeen
at the top while we're at it. Signed-off-by: Eric Sandeen sand...@redhat.com --- diff --git a/218 b/218 index 77782c6..e337bbf 100755 --- a/218 +++ b/218 @@ -44,7 +44,7 @@ _cleanup() . ./common.defrag # real QA test starts here -_supported_fs xfs ext4 btrfs +_supported_fs generic _supported_os

Re: Debian 3.7.1 BTRFS crash

2013-03-12 Thread Eric Sandeen
On 3/12/13 8:38 PM, Russell Coker wrote: I have a workstation running the Debian packaged 3.7.1 kernel from 24th December last year. After some period of uptime (maybe months) it crashed and mounted the root filesystem read-only. Now when I boot it the root filesystem gets mounted

Re: [PATCH 3/3] btrfs-progs: use BTRFS_SCAN_BACKUP_SB flag in btrfs_scan_one_device

2013-03-11 Thread Eric Sandeen
On 3/8/13 9:25 AM, Anand Jain wrote: bug: --- mkfs.btrfs /dev/sdb -f yes| mkfs.ext4 /dev/sdb mount /dev/sdb /ext4 mkfs.btrfs -f /dev/sdc /dev/sdd (run twice) mkfs.btrfs -f /dev/sdc /dev/sdd :: ERROR: unable to scan the device '/dev/sdb' - Device or resource busy ERROR: unable to scan

[PATCH 2/4] btrfs-progs: three new device/path helpers

2013-03-11 Thread Eric Sandeen
take either type of arg. Signed-off-by: Eric Sandeen sand...@redhat.com --- utils.c | 84 +++ utils.h |3 ++ 2 files changed, 87 insertions(+), 0 deletions(-) diff --git a/utils.c b/utils.c index 1c73d67..4bf457f 100644 --- a/utils.c

[PATCH 4/4] btrfs-progs: rework get_fs_info to remove side effects

2013-03-11 Thread Eric Sandeen
device or a path: * btrfs device stats * btrfs replace start * btrfs scrub start * btrfs scrub status Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-device.c |5 ++- cmds-replace.c |6 +++- cmds-scrub.c | 10 --- utils.c| 73

[PATCH 1/4] btrfs-progs: close fd on return from label get/set functions

2013-03-11 Thread Eric Sandeen
Somehow missed these 2 in the last round. Signed-off-by: Eric Sandeen sand...@redhat.com --- utils.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/utils.c b/utils.c index f68436d..1c73d67 100644 --- a/utils.c +++ b/utils.c @@ -1217,6 +1217,7 @@ static int

[PATCH 0/4] smalle cleanup + get_fs_info rework

2013-03-11 Thread Eric Sandeen
The first patch is a trival close of fd on function returns, somehow missed that last go-round. The next 3 are a little more substantial, working to avoid the nasty behavior of get_fs_info, closing re-opening the callers' filehandle out of scope, if it needs to switch from device node to

[PATCH 3/4] btrfs-progs: don't open-code mountpoint discovery in scrub cancel

2013-03-11 Thread Eric Sandeen
cmd_scrub_cancel had its own mountpoint discovery routine; just use open_path_or_dev_mnt() for that now. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-scrub.c | 53 + 1 files changed, 17 insertions(+), 36 deletions(-) diff --git

Re: [PATCH 4/4] btrfs-progs: rework get_fs_info to remove side effects

2013-03-11 Thread Eric Sandeen
On 3/11/13 6:13 PM, Eric Sandeen wrote: 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

[PATCH 4/4 V2] btrfs-progs: rework get_fs_info to remove side effects

2013-03-11 Thread Eric Sandeen
device or a path: * btrfs device stats * btrfs replace start * btrfs scrub start * btrfs scrub status Signed-off-by: Eric Sandeen sand...@redhat.com --- V2: don't call BTRFS_IOC_FS_INFO in the single device case after we change path/fd to be for the fs mount point. In the single device case we

Re: xfstests: 301: sparse copy between different filesystems/mountpoints on btrfs

2013-03-10 Thread Eric Sandeen
On 3/10/13 6:03 PM, Dave Chinner wrote: On Sat, Mar 09, 2013 at 06:24:47PM -0600, Eric Sandeen wrote: On 1/18/13 3:48 PM, Koen De Wit wrote: +} + +_scratch_mount +_create_reflinks_to $TESTDIR2 +_scratch_unmount + +mount $TEST_DEV $SCRATCH_MNT +_create_reflinks_to $TESTDIR3 +umount

Re: [PATCH] use rcu_barrier() to wait for bdev puts at unmount

2013-03-09 Thread Eric Sandeen
On 3/9/13 6:27 AM, Chris Mason wrote: On Fri, Mar 08, 2013 at 10:23:01PM -0700, Eric Sandeen wrote: Doing this would reliably fail with -EBUSY for me: # mount /dev/sdb2 /mnt/scratch; umount /mnt/scratch; mkfs.btrfs -f /dev/sdb2 ... unable to open /dev/sdb2: Device or resource busy because

[PATCH V2] btrfs: use rcu_barrier() to wait for bdev puts at unmount

2013-03-09 Thread Eric Sandeen
free once unmount completes. Cc: sta...@vger.kernel.org Signed-off-by: Eric Sandeen sand...@redhat.com --- V2: expand commit msg, add code comment, cc: stable diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5cbb7f4..92a8bfc 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c

Re: xfstests: 297: simple sparse copy testcase for btrfs

2013-03-09 Thread Eric Sandeen
On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com Sorry for the late review. Better late than never? cc'ing linux-btrfs - in general a good idea so btrfs experts can evaluate the test as well. --- 297 | 75

Re: xfstests: 298: sparse copy of a directory tree on btrfs

2013-03-09 Thread Eric Sandeen
On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com same basic comments as for the previous test: need definition of _require_cp_reflink somewhere need to add test to groups file remove recreate testdir to avoid collisions (or mktemp maybe?) use

Re: xfstests: 299: moving and deleting sparse copies on btrfs

2013-03-09 Thread Eric Sandeen
On 3/9/13 11:47 AM, Eric Sandeen wrote: On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com same comments as the others; looks good otherwise. (whoops, cc: btrfs list) -Eric --- 299 | 69

Re: xfstests: 300: diskspace consumption of cloned files on btrfs

2013-03-09 Thread Eric Sandeen
On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com --- 300 | 84 +++ 300.out |4 +++ 2 files changed, 88 insertions(+), 0 deletions(-) create mode 100644 300 create mode

Re: xfstests: 301: sparse copy between different filesystems/mountpoints on btrfs

2013-03-09 Thread Eric Sandeen
On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com --- 301 | 95 +++ 301.out |7 2 files changed, 102 insertions(+), 0 deletions(-) create mode 100644 301 create mode

Re: xfstests: 303: send/receive functionality of btrfs

2013-03-09 Thread Eric Sandeen
On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com --- 303 | 127 +++ 303.out | 72 +++ group |7 +++ 3 files changed, 206 insertions(+), 0

Re: xfstests: 302: cross-subvolume sparse copies on btrfs

2013-03-09 Thread Eric Sandeen
On 1/18/13 3:48 PM, Koen De Wit wrote: Signed-off-by: Koen De Wit koen.de@oracle.com --- 302 | 108 +++ 302.out | 28 2 files changed, 136 insertions(+), 0 deletions(-) create mode 100644 302

Re: [PATCH 04/14] btrfs-progs: don't leak fd in get_fs_info

2013-03-08 Thread Eric Sandeen
On 3/5/13 5:41 PM, Eric Sandeen wrote: On 3/4/13 4:39 PM, Eric Sandeen wrote: If we discover that a passed-in fd is not a mountpoint, we determine whether it is a device, and issue another open() against the device's mount point if it is mounted. If we do so, ensure this 2nd fd gets closed

[PATCH] use rcu_barrier() to wait for bdev puts at unmount

2013-03-08 Thread Eric Sandeen
puts shows a kworker thread doing a blkdev put after mkfs attempts a get; this is left over from the unmount. Adding an rcu_barrier() to btrfs_close_devices() causes unmount to wait until all blkdev_put()s are done, and the device is truly free once unmount completes. Signed-off-by: Eric Sandeen

Re: mkfs.btrfs broken

2013-03-07 Thread Eric Sandeen
On 3/7/13 6:11 AM, Swâmi Petaramesh wrote: Hi, mkfs.btrfs v0.20-rc1, as provided in the excellent Parted Magic tool, latest version dated 2013/02/28, is broken : Unfortunately v0.20-rc1 spans months of development, since btrfs-progs has no consistent release or versioning activity. When

Re: mkfs.btrfs broken

2013-03-07 Thread Eric Sandeen
On 3/7/13 9:09 AM, Swâmi Petaramesh wrote: Le 07/03/2013 14:37, Eric Sandeen a écrit : What error messages does it emit, anything helpful? root@partedmagic:~# file -s /dev/sda5 /dev/sda5: data root@partedmagic:~# mkfs.btrfs /dev/sda5 WARNING! - Btrfs v0.20-rc1 IS EXPERIMENTAL WARNING

[PATCH] xfstests: Fix hang when mkfs.btrfs isn't present

2013-03-05 Thread Eric Sandeen
My earlier patch (xfstests: handle new mkfs.btrfs -f option cleanly) had a flaw in that if set_prog_path mkfs.btrfs returns nothing, the grep will hang. Test for that case to avoid it, and just return the empty string in that case. Reported-by: Rich Johnston rjohns...@sgi.com Signed-off-by: Eric

Re: [PATCH 04/14] btrfs-progs: don't leak fd in get_fs_info

2013-03-05 Thread Eric Sandeen
On 3/4/13 4:39 PM, Eric Sandeen wrote: If we discover that a passed-in fd is not a mountpoint, we determine whether it is a device, and issue another open() against the device's mount point if it is mounted. If we do so, ensure this 2nd fd gets closed before we return so that it does

[PATCH 03/14] btrfs-progs: free resources on do_rollback error returns

2013-03-04 Thread Eric Sandeen
close fd if open, and free allocated memory in buf Signed-off-by: Eric Sandeen sand...@redhat.com --- convert.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/convert.c b/convert.c index 4a75895..76a1076 100644 --- a/convert.c +++ b/convert.c @@ -2455,7 +2455,7

[PATCH 02/14] btrfs-progs: close fd on do_convert error returns

2013-03-04 Thread Eric Sandeen
stops an fd leak that Coverity found. Signed-off-by: Eric Sandeen sand...@redhat.com --- convert.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/convert.c b/convert.c index 2b3f42f..4a75895 100644 --- a/convert.c +++ b/convert.c @@ -2277,7 +2277,8 @@ err: int

[PATCH 14/14] btrfs-progs: Error handling in scrub_progress_cycle() thread

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- cmds-scrub.c | 48

[PATCH 12/14] btrfs-progs: Issue warnings if ioctls fail in sigint handlers

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- cmds-replace.c |5 - cmds-scrub.c |6

[PATCH 01/14] btrfs-progs: close fd on cmd_subvol_list return

2013-03-04 Thread Eric Sandeen
stops an fd leak that Coverity found. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-subvolume.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 461eed9..a13a58d 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c

[PATCH 13/14] btrfs-progs: better option/error handling for btrfs-vol

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- btrfs-vol.c |7 ++- 1 files changed, 6

[PATCH 04/14] btrfs-progs: don't leak fd in get_fs_info

2013-03-04 Thread Eric Sandeen
-off-by: Eric Sandeen sand...@redhat.com --- utils.c | 21 ++--- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/utils.c b/utils.c index 1813dda..54d577c 100644 --- a/utils.c +++ b/utils.c @@ -1462,6 +1462,7 @@ int get_fs_info(int fd, char *path, struct

[PATCH 00/14] btrfs-progs: more Coverity cleanups

2013-03-04 Thread Eric Sandeen
This gets the coverity issue count down to 33. Before Zach started this process, we were over 150, IIRC. So it's almost to the point where the scans will be manageable going forward. Not a lot of real bugfixes here, but a bit better error handling in places. I sent out 2 dumb patches

[PATCH 11/14] btrfs-progs: check return of posix_fadvise

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- disk-io.c |6 -- volumes.c |3 ++- 2 files changed, 6 insertions(+), 3

[PATCH 10/14] btrfs-progs: Free resources when returning error from cmd_subvol_create()

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- cmds-subvolume.c | 29 - 1 files changed, 16

[PATCH 08/14] btrfs-progs: Free resources when returning error from cmd_snapshot()

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- cmds-subvolume.c | 41 - 1 files changed, 24

[PATCH 09/14] btrfs-progs: tidy up cmd_subvol_create() whitespace returns

2013-03-04 Thread Eric Sandeen
Just whitespace fixes, and magical return value removal. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-subvolume.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 96f7cbd..bee 100644 --- a/cmds

[PATCH 07/14] btrfs-progs: tidy up cmd_snapshot() whitespace returns

2013-03-04 Thread Eric Sandeen
Just whitespace fixes, and magical return value removal. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-subvolume.c | 30 +++--- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index a13a58d..a4d88a1 100644

[PATCH 06/14] btrfs-progs: check for null string in parse_size

2013-03-04 Thread Eric Sandeen
Because it's better than a segfault if it's called improperly, and it makes static checkers happier. Signed-off-by: Eric Sandeen sand...@redhat.com --- utils.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/utils.c b/utils.c index 54d577c..a38ac70 100644 --- a/utils.c

[PATCH 05/14] btrfs-progs: free allocated metadump structure on restore failure

2013-03-04 Thread Eric Sandeen
Don't return w/ metadump still allocated Signed-off-by: Eric Sandeen sand...@redhat.com --- btrfs-image.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/btrfs-image.c b/btrfs-image.c index a54e6c9..5b0af28 100644 --- a/btrfs-image.c +++ b/btrfs-image.c

Re: [PATCH 14/14] btrfs-progs: Error handling in scrub_progress_cycle() thread

2013-03-04 Thread Eric Sandeen
On 3/4/13 4:00 PM, Zach Brown wrote: -ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, old); +ret = -pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, old); if (ret) -return ERR_PTR(-ret); +goto out; Am I the only one who finds ret =

Re: [PATCH 12/14] btrfs-progs: Issue warnings if ioctls fail in sigint handlers

2013-03-04 Thread Eric Sandeen
On 3/4/13 3:57 PM, Zach Brown wrote: +ret = ioctl(cancel_fd, BTRFS_IOC_SCRUB_CANCEL, NULL); +if (ret 0) +perror(Scrub cancel failed\n); Probably don't want the extra newline. - z Doh, thanks. -- To unsubscribe from this list: send the line unsubscribe linux-btrfs

[PATCH 12/14 V2] btrfs-progs: Issue warnings if ioctls fail in sigint handlers

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- cmds-replace.c |5 - cmds-scrub.c |6

[PATCH 14/14 V2] btrfs-progs: Error handling in scrub_progress_cycle() thread

2013-03-04 Thread Eric Sandeen
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 sand...@redhat.com --- V2: collect positive

[PATCH 15/14] btrfs-progs: fix scrub error return from pthread_mutex_lock

2013-03-04 Thread Eric Sandeen
If pthread_mutex_lock() fails it returns the error in ret, and does not set errno. Signed-off-by: Eric Sandeen sand...@redhat.com --- diff --git a/cmds-scrub.c b/cmds-scrub.c index f73b3c6..8129601 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -763,7 +763,7 @@ static int scrub_write_progress

Re: [PATCH] btrfs-progs: traverse to backup super-block only when indicated

2013-03-01 Thread Eric Sandeen
On 3/1/13 4:13 AM, Anand Jain wrote: This patch adds 4th parameter to btrfs_scan_one_device() which when set to non-zero value will traverse to check backup super-block. Signed-off-by: Anand Jain anand.j...@oracle.com --- btrfs-show.c | 2 +- btrfsctl.c| 2 +-

Re: [PATCH] btrfs-progs: usage should match what is coded

2013-03-01 Thread Eric Sandeen
On 3/1/13 4:10 AM, Anand Jain wrote: Signed-off-by: Anand Jain anand.j...@oracle.com Revieed-by: Eric Sandeen sand...@redhat.com But the curious side of me wonders how it got this way. commit e43cc461550130494194201037590a2b1f0f6880 Author: Ian Kumlien po...@demius.net Date: Fri Feb 8 01:37

Re: [PATCH] Btrfs-progs: fix parse_limit function to return errors when parsing unit

2013-02-27 Thread Eric Sandeen
On 2/27/13 9:52 AM, David Sterba wrote: On Thu, Feb 21, 2013 at 08:26:15PM +0800, Wang Shilong wrote: From: Wang Shilong wangsl-f...@cn.fujitsu.com Steps to reproduce: btrfs qgroup limit m mnt/subv Here, unit(k/K/g/G/m/M/t/T) all will trigger the problem. For the above command, the

Re: [PATCH] xfstests 276: fix error 'FIBMAP: Invalid argument'

2013-02-27 Thread Eric Sandeen
On 2/27/13 5:04 PM, Dave Chinner wrote: On Wed, Feb 27, 2013 at 03:15:16PM +0800, Wang Sheng-Hui wrote: Btrfs doesn't support FIEMAP_FLAG_XATTR, which is enabled by -x option of filefrag, and will fail with 'FIBMAP: Invalid argument' for 'filefrag -vx'. 'filefrag -vx' fails on btrfs with

Re: [PATCH 17/17] btrfs-progs: replace strtok_r with strsep

2013-02-26 Thread Eric Sandeen
On 2/26/13 12:47 PM, Goffredo Baroncelli wrote: On 02/25/2013 11:54 PM, Eric Sandeen wrote: The coverity had a false positive complaining that save_ptr is uninitialized in the call to strtok_r. We could initialize it, but Zach points out that just using strsep is a lot simpler if there's

Re: [PATCH 01/17] btrfs-progs: Unify size-parsing

2013-02-26 Thread Eric Sandeen
On 2/26/13 12:50 PM, Goffredo Baroncelli wrote: On 02/25/2013 11:54 PM, Eric Sandeen wrote: cmds-qgroup.c contained a parse_limit() function which duplicates much of the functionality of parse_size. The only unique behavior is to handle none; then we can just pass it off to parse_size

[PATCH 17/17 V2] btrfs-progs: replace strtok_r with strsep

2013-02-26 Thread Eric Sandeen
The coverity runs had a false positive complaining that save_ptr is uninitialized in the call to strtok_r. We could initialize it, but Zach points out that just using strsep is a lot simpler if there's only one delimiter, so just switch to that. Signed-off-by: Eric Sandeen sand...@redhat.com

Re: [PATCH, RFC] btrfs-progs: require mkfs -f force option to overwrite filesystem or partition table

2013-02-26 Thread Eric Sandeen
On 2/20/13 9:37 AM, Stefan Behrens wrote: ... This means that it is now required to change all occurrences of mkfs.btrfs to mkfs.btrfs -f everywhere. Can't we first establish a time period of 100 years where the -f option is tolerated and ignored, and then in 2113 we require that the users

Re: [PATCH 16/17] btrfs-progs: fix fd leak in cmd_subvol_set_default

2013-02-26 Thread Eric Sandeen
On 2/26/13 12:46 PM, Goffredo Baroncelli wrote: Hi Eric, On 02/25/2013 11:54 PM, Eric Sandeen wrote: 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

[PATCH] xfstests: handle new mkfs.btrfs -f option cleanly

2013-02-26 Thread Eric Sandeen
that it is an always-included option during the tests. Signed-off-by: Eric Sandeen sand...@redhat.com --- diff --git a/common.config b/common.config index 57f505d..9f1d309 100644 --- a/common.config +++ b/common.config @@ -101,6 +101,17 @@ set_prog_path() return 1 } +# Handle mkfs.btrfs which does

Re: [PATCH 17/17 V2] btrfs-progs: replace strtok_r with strsep

2013-02-26 Thread Eric Sandeen
On 2/26/13 2:40 PM, Ilya Dryomov wrote: On Tue, Feb 26, 2013 at 02:20:30PM -0600, Eric Sandeen wrote: The coverity runs had a false positive complaining that save_ptr is uninitialized in the call to strtok_r. We could initialize it, but Zach points out that just using strsep is a lot simpler

[PATCH 17/17 V3] btrfs-progs: initialize save_ptr prior to strtok_r

2013-02-26 Thread Eric Sandeen
as to why. Signed-off-by: Eric Sandeen sand...@redhat.com --- V3: Keep strtok_r for old compat, and just init the var. diff --git a/cmds-balance.c b/cmds-balance.c index b671e1d..f5dc317 100644 --- a/cmds-balance.c +++ b/cmds-balance.c @@ -67,7 +67,7 @@ static int parse_one_profile(const char *profile

[PATCH 03/17] btrfs-progs: Remove write-only var fdres in cmd_dev_stats()

2013-02-25 Thread Eric Sandeen
fdres is initialized to -1, then later tested, but never set. Just remove it. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-device.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index 198ad68..58df6da 100644 --- a/cmds

[PATCH 02/17] btrfs-progs: fix btrfs_get_subvol cut/paste error

2013-02-25 Thread Eric Sandeen
future errors. Signed-off-by: Eric Sandeen sand...@redhat.com --- btrfs-list.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/btrfs-list.c b/btrfs-list.c index d02d620..ab9179f 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -1515,6 +1515,13 @@ int

[PATCH 06/17] btrfs-progs: fix open error test in cmd_start_replace

2013-02-25 Thread Eric Sandeen
open() returns a negative fd on failure, not 0. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-replace.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cmds-replace.c b/cmds-replace.c index d14c9b5..9397396 100644 --- a/cmds-replace.c +++ b/cmds-replace.c

[PATCH 07/17] btrfs-progs: fix close of error fd in scrub cancel

2013-02-25 Thread Eric Sandeen
If we retry opening the mountpoint and fail, we'll call close on a filehandle w/ value -1. Rearrange so the retry uses the same open and same error handling. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-scrub.c | 13 + 1 files changed, 5 insertions(+), 8 deletions

[PATCH 11/17] btrfs-progs: provide positive errno to strerror in cmd_restore

2013-02-25 Thread Eric Sandeen
check_mounted returns a negative errno, so it needs to be flipped again before passing to strerror. Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-restore.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cmds-restore.c b/cmds-restore.c index 12b2188..9385042

[PATCH 00/17] btrfs-progs: More misc fixes cleanups

2013-02-25 Thread Eric Sandeen
A bunch of Coverity static analysis checker fixes, including a couple actual bugfixes. This gets it down from around 80 defects to about 50; I have a couple other patches I need to clean up which quiets it even more. By getting it to a tolerable level, subsequent runs to check for regressions

[PATCH 01/17] btrfs-progs: Unify size-parsing

2013-02-25 Thread Eric Sandeen
cmds-qgroup.c contained a parse_limit() function which duplicates much of the functionality of parse_size. The only unique behavior is to handle none; then we can just pass it off to parse_size(). Signed-off-by: Eric Sandeen sand...@redhat.com --- cmds-qgroup.c | 44

[PATCH 09/17] btrfs-progs: free memory before error exit in read_whole_eb

2013-02-25 Thread Eric Sandeen
Free the memory allocated to multi before the error exit in read_whole_eb(). Set it to NULL after we free it in the loop to avoid any potential double-free. Signed-off-by: Eric Sandeen sand...@redhat.com --- disk-io.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git

[PATCH 15/17] btrfs-progs: Tidy up resolve_root

2013-02-25 Thread Eric Sandeen
Whitespace fixes and fix a variable declaration after code. Signed-off-by: Eric Sandeen sand...@redhat.com --- btrfs-list.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/btrfs-list.c b/btrfs-list.c index 8c3f84d..a748d5e 100644 --- a/btrfs-list.c +++ b

[PATCH 17/17] btrfs-progs: replace strtok_r with strsep

2013-02-25 Thread Eric Sandeen
The coverity had a false positive complaining that save_ptr is uninitialized in the call to strtok_r. We could initialize it, but Zach points out that just using strsep is a lot simpler if there's only one delimiter, so just switch to that. Signed-off-by: Eric Sandeen sand...@redhat.com

[PATCH 16/17] btrfs-progs: fix fd leak in cmd_subvol_set_default

2013-02-25 Thread Eric Sandeen
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 sand...@redhat.com --- cmds-subvolume.c | 17 + 1 files changed, 9 insertions(+), 8

[PATCH 14/17] btrfs-progs: fix mem leak in resolve_root

2013-02-25 Thread Eric Sandeen
If we exit with error we must free the allocated memory to avoid a leak. Signed-off-by: Eric Sandeen sand...@redhat.com --- btrfs-list.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/btrfs-list.c b/btrfs-list.c index 851c059..8c3f84d 100644 --- a/btrfs-list.c

[PATCH 10/17] btrfs-progs: don't call close on error fd

2013-02-25 Thread Eric Sandeen
In the error case where fd 0, close(fd) is the wrong thing to do. Signed-off-by: Eric Sandeen sand...@redhat.com --- btrfs-show-super.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index 3614c52..f587f10 100644 --- a/btrfs-show

<    1   2   3   4   5   6   >