[PATCH] btrfs-progs: Don't return any fs_info that contain NULL tree_root or fs_root.

2014-09-29 Thread Qu Wenruo
[BUG]
btrfsck will segfault if it fails to open the fs tree or tree root.

[REPRODUCER]
Execute btrfsck on a highly damaged btrfs image.
fsfuzz can be used to make a junk btrfs image.

[REASON]
Current open_ctree() in btrfs-progs support OPEN_CTREE_PARTIAL flag to
allow return fs_info even some of the trees is missing.

However it is too loose and even allows fs_info containing no tree to be
returned.

And when it happens, fs_info->fs_root is NULL,
close_ctree(fs_info->fs_root) will cause the access to NULL pointer and
segfault.

[FIX]
This patch will add checks for fs_info->tree_root and fs_info->fs_root
before return fs_info.

Signed-off-by: Qu Wenruo 
---
 disk-io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/disk-io.c b/disk-io.c
index 26a532e..21a3083 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -1134,7 +1134,8 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, 
const char *path,
return fs_info;
 
 out_failed:
-   if (flags & OPEN_CTREE_PARTIAL)
+   if (flags & OPEN_CTREE_PARTIAL &&
+   fs_info->tree_root && fs_info->fs_root)
return fs_info;
 out_chunk:
btrfs_release_all_roots(fs_info);
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-29 Thread David Sterba
On Mon, Sep 29, 2014 at 12:45:12PM -0700, Omar Sandoval wrote:
> > > @@ -639,8 +640,7 @@ static int send_header(struct send_ctx *sctx)
> > > - return write_buf(sctx->send_filp, &hdr, sizeof(hdr),
> > > - &sctx->send_off);
> > > + return write_buf(sctx->send_filp, &hdr, sizeof(hdr), &sctx->send_off);
> > 
> > >   ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
> > > - &sctx->send_off);
> > > + &sctx->send_off);
> > 
> > Please do not fold unrelated changes.
> 
> My metric for "related" here was that these were call sites of a function I
> directly modified.

The changes are only in the whitespace, that's not necessary. It's
usually ok to fix style issues in the code you modify directly.

> Is the preferred form to just split style fixes that we encounter into
> a separate patch in the series?

Well, I may only express my point of view. Yes, split the style-only
changes into another patch and don't send it :)

The problem with patches that do not effectively change anything is that
they pollute git history and just add extra step when one has to look
for a patch that broke something, or eg. change context of following
patches and make backporting a bit more tedious. Code cleanups are fine,
but there's usually a point of making the code more readable, compact,
etc.

The coding style should be perfect from the beginning. Nobody will
probably point out minor style violations during review, because it just
pointless for a patch that fixes a real bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-29 Thread Omar Sandoval
On Mon, Sep 29, 2014 at 06:07:38PM +0200, David Sterba wrote:
> On Sun, Sep 28, 2014 at 01:48:11AM -0700, Omar Sandoval wrote:
> > The buffer passed to vfs_write in send and several casts of ioctl fields are
> > missing the __user annotation. Also fixes a couple of related trivial style
> > issues.
> > 
> > Signed-off-by: Omar Sandoval 
> 
> Reviewed-by: David Sterba 

Thank you.

> > @@ -639,8 +640,7 @@ static int send_header(struct send_ctx *sctx)
> > -   return write_buf(sctx->send_filp, &hdr, sizeof(hdr),
> > -   &sctx->send_off);
> > +   return write_buf(sctx->send_filp, &hdr, sizeof(hdr), &sctx->send_off);
> 
> > ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
> > -   &sctx->send_off);
> > +   &sctx->send_off);
> 
> Please do not fold unrelated changes.

My metric for "related" here was that these were call sites of a function I
directly modified. Is the preferred form to just split style fixes that we
encounter into a separate patch in the series?

-- 
Omar
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 02/15] btrfs: new test to run btrfs balance and scrub simultaneously

2014-09-29 Thread Josef Bacik

On 09/26/2014 12:14 AM, Eryu Guan wrote:

Run btrfs balance and scrub operations simultaneously with fsstress
running in background.

Signed-off-by: Eryu Guan 
---
  common/rc   |   9 +
  tests/btrfs/060 | 114 
  tests/btrfs/060.out |   2 +
  tests/btrfs/group   |   1 +
  4 files changed, 126 insertions(+)
  create mode 100755 tests/btrfs/060
  create mode 100644 tests/btrfs/060.out

diff --git a/common/rc b/common/rc
index 2393c4b..d1dec8a 100644
--- a/common/rc
+++ b/common/rc
@@ -2591,6 +2591,15 @@ _btrfs_stress_subvolume()
done
  }

+# stress btrfs by running scrub in a loop
+_btrfs_stress_scrub()
+{
+   local btrfs_mnt=$1
+   while true; do
+   $BTRFS_UTIL_PROG scrub start -B $btrfs_mnt
+   done
+}
+
  init_rc()
  {
if [ "$iam" == new ]
diff --git a/tests/btrfs/060 b/tests/btrfs/060
new file mode 100755
index 000..b270c7b
--- /dev/null
+++ b/tests/btrfs/060
@@ -0,0 +1,114 @@
+#! /bin/bash
+# FSQA Test No. btrfs/060
+#
+# Run btrfs balance and scrub operations simultaneously with fsstress
+# running in background.
+#
+#---
+# Copyright (C) 2014 Red Hat Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#---
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+   cd /
+   rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+# we check scratch dev after each loop
+_require_scratch_nocheck
+_require_scratch_dev_pool 4
+_btrfs_get_profile_configs
+
+rm -f $seqres.full
+
+run_test()
+{
+   local mkfs_opts=$1
+
+   echo "Test $mkfs_opts" >>$seqres.full
+
+   _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+   # make sure we created btrfs with desired options
+   if [ $? -ne 0 ]; then
+   echo "mkfs $mkfs_opts failed"
+   return
+   fi
+   _scratch_mount >>$seqres.full 2>&1
+
+   args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d 
$SCRATCH_MNT/stressdir`
+   echo "Run fsstress $args" >>$seqres.full
+   $FSSTRESS_PROG $args >/dev/null 2>&1 &
+   fsstress_pid=$!
+
+   echo -n "Start balance worker: " >>$seqres.full
+   _btrfs_stress_balance $SCRATCH_MNT >/dev/null 2>&1 &
+   balance_pid=$!
+   echo "$balance_pid" >>$seqres.full
+
+   echo -n "Start scrub worker: " >>$seqres.full
+   _btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+   scrub_pid=$!
+   echo "$scrub_pid" >>$seqres.full
+
+   echo "Wait for fsstress to exit and kill all background workers" 
>>$seqres.full
+   wait $fsstress_pid
+   kill $balance_pid $scrub_pid
+   wait
+   # wait for the balance and scrub operations to finish
+   while ps aux | grep "balance start" | grep -qv grep; do
+   sleep 1
+   done
+   while ps aux | grep "scrub start" | grep -qv grep; do
+   sleep 1
+   done


I'm just going to point this out here again and assume that it applies 
for every other patch in this series.  Thanks,


Josef

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 01/15] btrfs: new test to run btrfs balance and subvolume test simultaneously

2014-09-29 Thread Josef Bacik

On 09/26/2014 12:14 AM, Eryu Guan wrote:

Run btrfs balance and subvolume create/mount/umount/delete simultaneously,
with fsstress running in background.

Signed-off-by: Eryu Guan 
---
  common/rc   | 110 +++--
  tests/btrfs/059 | 115 
  tests/btrfs/059.out |   2 +
  tests/btrfs/group   |   1 +
  4 files changed, 224 insertions(+), 4 deletions(-)
  create mode 100755 tests/btrfs/059
  create mode 100644 tests/btrfs/059.out

diff --git a/common/rc b/common/rc
index 4dab101..2393c4b 100644
--- a/common/rc
+++ b/common/rc
@@ -582,11 +582,17 @@ _scratch_pool_mkfs()
  {
  case $FSTYP in
  btrfs)
-   $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
-   ;;
+# if dup profile is in mkfs options call _scratch_mkfs instead
+# because dup profile only works with single device
+if [[ "$*" =~ dup ]]; then
+_scratch_mkfs $*
+else
+$MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
+fi
+;;
  *)
-   echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
-   ;;
+echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
+;;
  esac
  }

@@ -2489,6 +2495,102 @@ _get_free_inode()
echo $nr_inode
  }

+# get btrfs profile configs being tested
+#
+# A set of pre-set profile configs are exported via _btrfs_profile_configs
+# array. Default configs can be overridden by setting BTRFS_PROFILE_CONFIGS
+# var in the format "metadata_profile:data_profile", multiple configs can be
+# seperated by space, e.g.
+# export BTRFS_PROFILE_CONFIGS="raid0:raid0 raid1:raid1 dup:single"
+_btrfs_get_profile_configs()
+{
+   if [ "$FSTYP" != "btrfs" ]; then
+   return
+   fi
+
+   # no user specified btrfs profile configs, export the default configs
+   if [ -z "$BTRFS_PROFILE_CONFIGS" ]; then
+   # default configs
+   _btrfs_profile_configs=(
+   "-m single -d single"
+   "-m dup -d single"
+   "-m raid0 -d raid0"
+   "-m raid1 -d raid0"
+   "-m raid1 -d raid1"
+   "-m raid10 -d raid10"
+   "-m raid5 -d raid5"
+   "-m raid6 -d raid6"
+   )
+
+   # remove dup/raid5/raid6 profiles if we're doing device replace
+   # dup profile indicates only one device being used 
(SCRATCH_DEV),
+   # but we don't want to replace SCRATCH_DEV, which will be used 
in
+   # _scratch_mount/_check_scratch_fs etc.
+   # and raid5/raid6 doesn't support replace yet
+   if [ "$1" == "replace" ]; then
+   _btrfs_profile_configs=(
+   "-m single -d single"
+   "-m raid0 -d raid0"
+   "-m raid1 -d raid0"
+   "-m raid1 -d raid1"
+   "-m raid10 -d raid10"
+   # add these back when raid5/6 is working with 
replace
+   #"-m raid5 -d raid5"
+   #"-m raid6 -d raid6"
+   )
+   fi
+   export _btrfs_profile_configs
+   return
+   fi
+
+   # parse user specified btrfs profile configs
+   local i=0
+   local cfg=""
+   for cfg in $BTRFS_PROFILE_CONFIGS; do
+   # turn "metadata:data" format to "-m metadata -d data"
+   # and assign it to _btrfs_profile_configs array
+   cfg=`echo "$cfg" | sed -e 's/^/-m /' -e 's/:/ -d /'`
+   _btrfs_profile_configs[$i]="$cfg"
+   let i=i+1
+   done
+
+   if [ "$1" == "replace" ]; then
+   if echo ${_btrfs_profile_configs[*]} | grep -q raid[56]; then
+   _notrun "RAID5/6 doesn't support btrfs device replace 
yet"
+   fi
+   if echo ${_btrfs_profile_configs[*]} | grep -q dup; then
+   _notrun "Do not set dup profile in btrfs device replace 
test"
+   fi
+   fi
+   export _btrfs_profile_configs
+}
+
+# stress btrfs by running balance operation in a loop
+_btrfs_stress_balance()
+{
+   local btrfs_mnt=$1
+   while true; do
+   $BTRFS_UTIL_PROG balance start $btrfs_mnt
+   done
+}
+
+# stress btrfs by creating/mounting/umounting/deleting subvolume in a loop
+_btrfs_stress_subvolume()
+{
+   local btrfs_dev=$1
+   local btrfs_mnt=$2
+   local subvol_name=$3
+   local subvol_mnt=$4
+
+   mkdir -p $subvol_mnt
+   while true; do
+   $BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
+   $MOUNT_PROG -o subvol=$subvol_name $btrfs_dev $subvol_mnt
+   

Re: 3.16.3 btrfs receive dies with rename o4736059-335172-0 -> merlin/RC/OSD failed. Directory not empty machine

2014-09-29 Thread Marc MERLIN
On Mon, Sep 29, 2014 at 06:29:25PM +0100, Filipe David Manana wrote:
> It's better than before, but I still need the *full* output from the
> tree commands and receive -vv --max-errors=0.

(sent off list due to size)

Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems 
   what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | PGP 1024R/763BE901
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 3.16.3 btrfs receive dies with rename o4736059-335172-0 -> merlin/RC/OSD failed. Directory not empty machine

2014-09-29 Thread Filipe David Manana
On Mon, Sep 29, 2014 at 4:43 PM, Marc MERLIN  wrote:
> On Mon, Sep 29, 2014 at 01:10:37PM +0100, Filipe David Manana wrote:
>> > Is there a patch you'd like me to try, or should I just work around the
>> > problem by deleting all these directories and recreating in 2 steps to
>> > get around the bug?
>>
>> For the moment you'll have to use the workaround.
>>
>> I have a hunch about what it might be, but to confirm it (or help if
>> it's wrong/incomplete) please send me the full output of the following
>> commands:
>>
>> - tree -d --inodes, at the root of the parent snapshot
>> - tree -d --inodes, at the root of the second snapshot
>> - btrfs receive -vv --max-errors=0  (needs btrfs-progs 3.16.x I believe)
>>
>> And I'll try to figure it out sometime this week.
>
> Thanks.
>
> Here's the relevant stripped output:
> Before:
> └── [257]  merlin
> ├── [1294378]  RC
> │   ├── [3490376]  Docs
> │   ├── [1651282]  notes -> /home/merlin/public_html/notes/rc
> │   ├── [2682102]  OSD
> │   │   ├── [3964804]  old
> │   │   └── [3964832]  Source
> │   │   ├── [3964833]  Copter
> │   │   └── [3964835]  Plane
>
> After:
> └── [257]  merlin
> ├── [1294378]  RC
> │   ├── [3490376]  Docs
> │   ├── [1651282]  notes -> /home/merlin/public_html/notes/rc
> │   ├── [4736059]  OSD
> │   │   ├── [3964804]  OSD-2.0
> │   │   ├── [4736027]  OSD-Copter 789
> │   │   └── [2682102]  OSD-Plane 788
> │   │   └── [3964832]  Source
> │   │   ├── [3964833]  Copter
> │   │   └── [3964835]  Plane

It's better than before, but I still need the *full* output from the
tree commands and receive -vv --max-errors=0.

thanks Marc

>
> Log (stripped):
> Create a readonly snapshot of 'home' in './home_ro.20140929_08:19:16'
> At subvol home_ro.20140929_08:19:16
> At snapshot home_ro.20140929_08:19:16
> receiving snapshot home_ro.20140929_08:19:16 
> uuid=807e5a76-8a80-9c44-9864-426dc8283523, ctransid=343443 
> parent_uuid=4c7431e0-106f-d243-b317-078e393e091c, parent_ctransid=335144
> truncate merlin/RC/OSD/old/config.xml size=109
> utimes merlin/RC/OSD/old/config.xml
> unlink merlin/downloads/CT Tool for MinimOSD Extra 2.3.2.0 Pre Release 
> r727.zip
> utimes merlin/RC/OSD
> truncate merlin/RC/OSD/config.xml size=274
> utimes merlin/RC/OSD/config.xml
> link o4736027-335149-0/octocopter1.osd -> merlin/RC/OSD/octocopter1.osd
> unlink merlin/RC/OSD/octocopter1.osd
> utimes merlin/RC/OSD
> unlink merlin/downloads/MinimOSDExtra_Copter_Prerelease_2.4_r794.hex
> unlink merlin/downloads/MinimOSDExtra_Copter_Prerelease_2.4_r789.zip
> rename o4736027-335149-0 -> o4736059-335172-0/OSD-Copter 789
> chown o4736059-335172-0/OSD-Copter 789 - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789 - mode=0755
> utimes o4736059-335172-0/OSD-Copter 789
> rename o4736031-335150-0 -> o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg size=18721
> chown o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
> rename o4736032-335150-0 -> o4736059-335172-0/OSD-Copter 789/config.xml
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/config.xml size=274
> chown o4736059-335172-0/OSD-Copter 789/config.xml - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/config.xml - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/config.xml
> rename o4736033-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/MinimOSD_2.4.0.0.mcm
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm size=163847
> chown o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm
> rename o4736034-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/MinimOSD_2.4.0.1.mcm
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm size=163847
> chown o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm
> rename o4736035-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex size=82216
> chown o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex - mode=0644
> utimes o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Ext

[PATCH] btrfs-progs: add root to dirty list when fixing bad keys

2014-09-29 Thread Josef Bacik
A user reported a WARN_ON() when trying to run btrfsck --repair on his fs with
bad key ordering.  This was because the root that was broken wasn't part of the
transaction yet.  We do this open coded thing in a few other places in fsck, so
just make it a helper function and make sure all the places that need to call it
do call it.  With this patch he was able to run repair without it dying.
Thanks,

Signed-off-by: Josef Bacik 
---
 cmds-check.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index d479361..4c01330 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -243,6 +243,17 @@ struct bad_item {
 
 static void reset_cached_block_groups(struct btrfs_fs_info *fs_info);
 
+static void record_root_in_trans(struct btrfs_trans_handle *trans,
+struct btrfs_root *root)
+{
+   if (root->last_trans != trans->transid) {
+   root->track_dirty = 1;
+   root->last_trans = trans->transid;
+   root->commit_root = root->node;
+   extent_buffer_get(root->node);
+   }
+}
+
 static u8 imode_to_type(u32 imode)
 {
 #define S_SHIFT 12
@@ -2429,6 +2440,8 @@ static int try_to_fix_bad_block(struct btrfs_trans_handle 
*trans,
if (IS_ERR(root))
return -EIO;
 
+   record_root_in_trans(trans, root);
+
path = btrfs_alloc_path();
if (!path)
return -EIO;
@@ -4667,12 +4680,7 @@ static int repair_ref(struct btrfs_trans_handle *trans,
 * Have to make sure that this root gets updated when we commit the
 * transaction
 */
-   root->track_dirty = 1;
-   if (root->last_trans != trans->transid) {
-   root->last_trans = trans->transid;
-   root->commit_root = root->node;
-   extent_buffer_get(root->node);
-   }
+   record_root_in_trans(trans, root);
 
/*
 * Ok we have the key of the file extent we want to fix, now we can cow
@@ -6352,12 +6360,7 @@ reinit_data_reloc:
fprintf(stderr, "Error reading data reloc tree\n");
return PTR_ERR(root);
}
-   root->track_dirty = 1;
-   if (root->last_trans != trans->transid) {
-   root->last_trans = trans->transid;
-   root->commit_root = root->node;
-   extent_buffer_get(root->node);
-   }
+   record_root_in_trans(trans, root);
ret = btrfs_fsck_reinit_root(trans, root, 0);
if (ret)
goto out;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] btrfs: correct empty compression property behavior

2014-09-29 Thread David Sterba
On Fri, Sep 19, 2014 at 05:45:49PM +0900, Satoru Takeuchi wrote:
> In the current implementation, compression property == "" has
> the two different meanings: one is with BTRFS_INODE_NOCOMPRESS,
> and the other is without this flag.
> 
> So, even if the two files a and b have the same compression
> property, "", and the same contents, one file seems to be
> compressed and the other is not. It's difficult to understand
> for users and also confuses them.

Fixing this inconsistency is good, let me think more about the
interface.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/4] btrfs: Rename and export __btrfs_set_prop to be called from running transaction

2014-09-29 Thread David Sterba
On Thu, Sep 25, 2014 at 02:55:29PM +0900, Satoru Takeuchi wrote:
> Since "__" prefix means static helper, rename __btrfs_set_prop() to
> btrfs_set_prop_trans.
> 
> Signed-off-by: Naohiro Aota 
> Signed-off-by: Satoru Takeuchi 

Reviewed-by: David Sterba 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] btrfs: fix sparse lock context warnings

2014-09-29 Thread David Sterba
On Sun, Sep 28, 2014 at 01:48:12AM -0700, Omar Sandoval wrote:
> Fix several sparse warnings that can easily be addressed with context
> annotations. These annotations also provide some sort of documentation for the
> internal helper functions.
> 
> Signed-off-by: Omar Sandoval 

Reviewed-by: David Sterba 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-29 Thread David Sterba
On Sun, Sep 28, 2014 at 01:48:11AM -0700, Omar Sandoval wrote:
> The buffer passed to vfs_write in send and several casts of ioctl fields are
> missing the __user annotation. Also fixes a couple of related trivial style
> issues.
> 
> Signed-off-by: Omar Sandoval 

Reviewed-by: David Sterba 

> @@ -639,8 +640,7 @@ static int send_header(struct send_ctx *sctx)
> - return write_buf(sctx->send_filp, &hdr, sizeof(hdr),
> - &sctx->send_off);
> + return write_buf(sctx->send_filp, &hdr, sizeof(hdr), &sctx->send_off);

>   ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
> - &sctx->send_off);
> + &sctx->send_off);

Please do not fold unrelated changes.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] btrfs: fix a overflowing boundary writing in csum_tree_block

2014-09-29 Thread David Sterba
On Thu, Sep 11, 2014 at 10:02:16AM -0400, Chris Mason wrote:
> On 09/09/2014 05:19 AM, rongqing...@windriver.com wrote:
> > From: Li RongQing 
> > 
> > It is impossible that csum_size is larger than sizeof(long), but the codes
> > still add the handler for this condition, like allocate new memory, for
> > extension. If it becomes true someday, copying csum_size size memory to 
> > local
> > 32bit variable found and val will overflow these two variables.
> > 
> > Fix it by returning the max 4 byte checksum.
> 
> Thanks for the patch.  I'd rather not silently truncate the copy down
> though.  How about a one time check at mount to make sure the value in
> the super is reasonable?

The check is already there, see btrfs_check_super_csum(), it validates
the csum_type that's later used to find the checksum size.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 3.16.3 btrfs receive dies with rename o4736059-335172-0 -> merlin/RC/OSD failed. Directory not empty machine

2014-09-29 Thread Marc MERLIN
On Mon, Sep 29, 2014 at 01:10:37PM +0100, Filipe David Manana wrote:
> > Is there a patch you'd like me to try, or should I just work around the
> > problem by deleting all these directories and recreating in 2 steps to
> > get around the bug?
> 
> For the moment you'll have to use the workaround.
> 
> I have a hunch about what it might be, but to confirm it (or help if
> it's wrong/incomplete) please send me the full output of the following
> commands:
> 
> - tree -d --inodes, at the root of the parent snapshot
> - tree -d --inodes, at the root of the second snapshot
> - btrfs receive -vv --max-errors=0  (needs btrfs-progs 3.16.x I believe)
> 
> And I'll try to figure it out sometime this week.

Thanks.

Here's the relevant stripped output:
Before:
└── [257]  merlin
├── [1294378]  RC
│   ├── [3490376]  Docs
│   ├── [1651282]  notes -> /home/merlin/public_html/notes/rc
│   ├── [2682102]  OSD
│   │   ├── [3964804]  old
│   │   └── [3964832]  Source
│   │   ├── [3964833]  Copter
│   │   └── [3964835]  Plane

After:
└── [257]  merlin
├── [1294378]  RC
│   ├── [3490376]  Docs
│   ├── [1651282]  notes -> /home/merlin/public_html/notes/rc
│   ├── [4736059]  OSD
│   │   ├── [3964804]  OSD-2.0
│   │   ├── [4736027]  OSD-Copter 789
│   │   └── [2682102]  OSD-Plane 788
│   │   └── [3964832]  Source
│   │   ├── [3964833]  Copter
│   │   └── [3964835]  Plane

Log (stripped):
Create a readonly snapshot of 'home' in './home_ro.20140929_08:19:16'
At subvol home_ro.20140929_08:19:16
At snapshot home_ro.20140929_08:19:16
receiving snapshot home_ro.20140929_08:19:16 
uuid=807e5a76-8a80-9c44-9864-426dc8283523, ctransid=343443 
parent_uuid=4c7431e0-106f-d243-b317-078e393e091c, parent_ctransid=335144
truncate merlin/RC/OSD/old/config.xml size=109
utimes merlin/RC/OSD/old/config.xml
unlink merlin/downloads/CT Tool for MinimOSD Extra 2.3.2.0 Pre Release r727.zip
utimes merlin/RC/OSD
truncate merlin/RC/OSD/config.xml size=274
utimes merlin/RC/OSD/config.xml
link o4736027-335149-0/octocopter1.osd -> merlin/RC/OSD/octocopter1.osd
unlink merlin/RC/OSD/octocopter1.osd
utimes merlin/RC/OSD
unlink merlin/downloads/MinimOSDExtra_Copter_Prerelease_2.4_r794.hex
unlink merlin/downloads/MinimOSDExtra_Copter_Prerelease_2.4_r789.zip
rename o4736027-335149-0 -> o4736059-335172-0/OSD-Copter 789
chown o4736059-335172-0/OSD-Copter 789 - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789 - mode=0755
utimes o4736059-335172-0/OSD-Copter 789
rename o4736031-335150-0 -> o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg size=18721
chown o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg - mode=0644
utimes o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
rename o4736032-335150-0 -> o4736059-335172-0/OSD-Copter 789/config.xml
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 789/config.xml size=274
chown o4736059-335172-0/OSD-Copter 789/config.xml - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789/config.xml - mode=0644
utimes o4736059-335172-0/OSD-Copter 789/config.xml
rename o4736033-335150-0 -> o4736059-335172-0/OSD-Copter 
789/MinimOSD_2.4.0.0.mcm
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm size=163847
chown o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm - mode=0644
utimes o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm
rename o4736034-335150-0 -> o4736059-335172-0/OSD-Copter 
789/MinimOSD_2.4.0.1.mcm
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm size=163847
chown o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm - mode=0644
utimes o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm
rename o4736035-335150-0 -> o4736059-335172-0/OSD-Copter 
789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 
789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex size=82216
chown o4736059-335172-0/OSD-Copter 
789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 
789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex - mode=0644
utimes o4736059-335172-0/OSD-Copter 
789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex
rename o4736036-335150-0 -> o4736059-335172-0/OSD-Copter 
789/OSD_Config.application
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 789/OSD_Config.application size=1631
chown o4736059-335172-0/OSD-Copter 789/OSD_Config.application - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789/OSD_Config.app

Re: Btrfs-progs releases

2014-09-29 Thread David Sterba
On Thu, Sep 18, 2014 at 10:38:03PM +0100, WorMzy Tykashi wrote:
> I was wondering if you could shed some light on the status of the
> integration branches. Are these going to be discontinued now that you
> are maintaining and tagging the official btrfs-progs releases, or will
> they stick around, serving a similar purpose as before?

The patch flow should stay as is for now, ie. integration branches at
the current repos. The kernel.org repo will serve as release repository
only.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 3.17.0-rc6 system freeze

2014-09-29 Thread Tomasz Chmielewski

On 2014-09-29 16:10 (Mon), Liu Bo wrote:

Hi Tomasz,

On Mon, Sep 29, 2014 at 02:00:18PM +0200, Tomasz Chmielewski wrote:

System froze under 3.17.0-rc6 with btrfs. It had to be hard rebooted.



How does this happen?  A stressful write with compression?


Rsync (with --inplace - can be stressful / lead to fragmentation on 
large files which change) + snapshot + remove old snapshot, for several 
remote sources (rsync server1, snapshot, remove old snap; rsync server2, 
snapshot, remove old snap etc.).


Filesystem is RAID-1 with compress-force=zlib:

/dev/sdc1 on /mnt/lxc2 type btrfs 
(rw,noatime,compress-force=zlib,space_cache)


The last operation written to the logfile was snapshot removal.


--
Tomasz Chmielewski
http://www.sslrack.com

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at fs/btrfs/relocation.c:1065 in 3.14.16 to 3.17-rc3

2014-09-29 Thread Liu Bo
On Wed, Sep 03, 2014 at 02:04:29PM +0200, Olivier Bonvalet wrote:
> Hi,
> 
> I have a btrfs partition which throw kernel BUG, even with linux
> 3.17-rc3 (I tried 3.14.16, 3.16.1 and 3.17-rc3 kernels) :
> 
> [   45.058466] [ cut here ]
> [   45.058539] kernel BUG at fs/btrfs/relocation.c:1065!
> [   45.058578] invalid opcode:  [#1] SMP 
> [   45.058655] Modules linked in: nf_conntrack iTCO_wdt iTCO_vendor_support 
> i2c_i801 lpc_ich ehci_pci i2ccore ehci_hcd mfd_core evdev battery 
> ie31200_edac edac_core video button btrfs xor raid6_pq dm_mod raid1 md_mod sg 
> sd_mod crc_t10dif crct10dif_common thermal ahci libahci libata scsi_mod 
> xhci_hcd e1000e fan ptp pps_core
> [   45.059500] CPU: 2 PID: 1740 Comm: btrfs-balance Not tainted 
> 3.17-rc3-dae-intel #1
> [   45.059550] Hardware name: Digicube sas DediCube/DQ77MK, BIOS 
> MKQ7710H.86A.0058.2013.0226.1541 02/26/2013
> [   45.059602] task: 8802151c17e0 ti: 8802105ec000 task.ti: 
> 8802105ec000
> [   45.059652] RIP: 0010:[]  [] 
> build_backref_tree+0xa3d/0xcf6 [btrfs]
> [   45.059739] RSP: 0018:8802105efaf0  EFLAGS: 00010246
> [   45.059776] RAX: 8802105efb00 RBX: 880213b83800 RCX: 
> 880210565d10
> [   45.059816] RDX: 8802105efb68 RSI: 8802105efb68 RDI: 
> 880210565d10
> [   45.059857] RBP: 880210565d10 R08: 88021313fc40 R09: 
> 1000
> [   45.059896] R10: 1600 R11: 6db6db6db6db6db7 R12: 
> 8800d114d310
> [   45.059937] R13: 8802105efb78 R14: 8800d114d2c0 R15: 
> 88021313fc40
> [   45.059977] FS:  () GS:88021e28() 
> knlGS:
> [   45.060028] CS:  0010 DS:  ES:  CR0: 80050033
> [   45.060066] CR2: 7f2fc9c649b8 CR3: 01611000 CR4: 
> 001407e0
> [   45.060105] Stack:
> [   45.060138]  88021d5fc890 88021417d890  
> 8802105efb68
> [   45.060264]  00010005 880213b83920 8802105efb78 
> 00ffa015ecd1
> [   45.060392]  8800d114d400 8800d114d240 880210464220 
> 880210565d40
> [   45.060516] Call Trace:
> [   45.060556]  [] ? relocate_tree_blocks+0x15f/0x430 
> [btrfs]
> [   45.060607]  [] ? tree_insert+0x44/0x47 [btrfs]
> [   45.060656]  [] ? add_tree_block+0x112/0x13c [btrfs]
> [   45.060702]  [] ? relocate_block_group+0x26d/0x4a6 
> [btrfs]
> [   45.060753]  [] ? btrfs_wait_ordered_roots+0x18f/0x1ab 
> [btrfs]
> [   45.060812]  [] ? btrfs_relocate_block_group+0x154/0x265 
> [btrfs]
> [   45.060872]  [] ? 
> btrfs_relocate_chunk.isra.29+0x52/0x55d [btrfs]
> [   45.060932]  [] ? btrfs_set_lock_blocking_rw+0xa8/0xaa 
> [btrfs]
> [   45.060988]  [] ? btrfs_item_key_to_cpu+0x12/0x30 [btrfs]
> [   45.061039]  [] ? btrfs_get_token_64+0x75/0xcf [btrfs]
> [   45.061088]  [] ? release_extent_buffer+0x26/0x96 [btrfs]
> [   45.061170]  [] ? btrfs_balance+0x9e3/0xb78 [btrfs]
> [   45.061263]  [] ? btrfs_balance+0xb78/0xb78 [btrfs]
> [   45.061314]  [] ? balance_kthread+0x4f/0x6d [btrfs]
> [   45.061360]  [] ? kthread+0xa7/0xaf
> [   45.061420]  [] ? SyS_old_getrlimit+0x21/0xcb
> [   45.061460]  [] ? __kthread_parkme+0x5b/0x5b
> [   45.061501]  [] ? ret_from_fork+0x7c/0xb0
> [   45.061541]  [] ? __kthread_parkme+0x5b/0x5b
> [   45.061579] Code: 26 a8 02 74 0d 4c 89 e7 e8 3c e1 ff ff 41 80 66 71 fd 49 
> 8b 46 58 49 89 6e 58 4c 89 65 00 48 89 45 08 48 89 28 eb c0 a8 10 75 02 <0f> 
> 0b 83 e0 01 39 44 24 10 0f 84 20 ff ff ff 0f 0b 49 8b 46 58 
> [   45.063148] RIP  [] build_backref_tree+0xa3d/0xcf6 
> [btrfs]
> [   45.063219]  RSP 
> [   45.063260] ---[ end trace c396e96e4d1a5697 ]---
> 
> I have dump the FS with btrfs-image, but don't know where to push that.
> So you can download it at : https://daevel.fr/img/btrfs-image.out
> (near 6GB, md5sum ee5559ab31368aba60c259ce3b5b9504)

Would you please try this patch?

https://patchwork.kernel.org/patch/4939761/

thanks,
-liubo
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 3.17.0-rc6 system freeze

2014-09-29 Thread Liu Bo
Hi Tomasz,

On Mon, Sep 29, 2014 at 02:00:18PM +0200, Tomasz Chmielewski wrote:
> System froze under 3.17.0-rc6 with btrfs. It had to be hard rebooted.
> 
> Sep 29 05:50:21 bkp010 kernel: [559018.459704] NMI watchdog: BUG:
> soft lockup - CPU#6 stuck for 22s! [kworker/u16:24:16872]
> Sep 29 05:50:21 bkp010 kernel: [559018.459705] NMI watchdog: BUG:
> soft lockup - CPU#2 stuck for 22s! [kworker/u16:8:17271]
> Sep 29 05:50:21 bkp010 kernel: [559018.459707] NMI watchdog: BUG:
> soft lockup - CPU#0 stuck for 22s! [kworker/u16:11:17272]
> Sep 29 05:50:21 bkp010 kernel: [559018.459709] Modules linked in:
> Sep 29 05:50:21 bkp010 kernel: [559018.459710] Modules linked in:
> Sep 29 05:50:21 bkp010 kernel: [559018.459711]  ipt_MASQUERADE
> Sep 29 05:50:21 bkp010 kernel: [559018.459711]  ipt_MASQUERADE
> Sep 29 05:50:21 bkp010 kernel: [559018.459712]  iptable_nat
> Sep 29 05:50:21 bkp010 kernel: [559018.459712]  iptable_nat
> Sep 29 05:50:21 bkp010 kernel: [559018.459713]  nf_conntrack_ipv4
> Sep 29 05:50:21 bkp010 kernel: [559018.459713]  nf_conntrack_ipv4
> Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_defrag_ipv4
> Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_defrag_ipv4
> Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_nat_ipv4
> Sep 29 05:50:21 bkp010 kernel: [559018.459715]  nf_nat_ipv4
> Sep 29 05:50:21 bkp010 kernel: [559018.459715]  nf_nat
> Sep 29 05:50:21 bkp010 kernel: [559018.459716]  nf_nat
> Sep 29 05:50:21 bkp010 kernel: [559018.459716]  nf_conntrack
> Sep 29 05:50:21 bkp010 kernel: [559018.459717]  nf_conntrack
> Sep 29 05:50:21 bkp010 kernel: [559018.459717]  ip_tables
> Sep 29 05:50:21 bkp010 kernel: [559018.459718]  ip_tables
> Sep 29 05:50:21 bkp010 kernel: [559018.459718]  x_tables
> Sep 29 05:50:21 bkp010 kernel: [559018.459719]  x_tables
> Sep 29 05:50:21 bkp010 kernel: [559018.459719]  cpufreq_ondemand
> Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_ondemand
> Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_conservative
> Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_conservative
> Sep 29 05:50:21 bkp010 kernel: [559018.459721]  cpufreq_powersave
> Sep 29 05:50:21 bkp010 kernel: [559018.459721]  cpufreq_powersave
> Sep 29 05:50:21 bkp010 kernel: [559018.459721]  cpufreq_stats
> Sep 29 05:50:21 bkp010 kernel: [559018.459722]  cpufreq_stats
> Sep 29 05:50:21 bkp010 kernel: [559018.459722]  bridge
> Sep 29 05:50:21 bkp010 kernel: [559018.459723]  bridge
> Sep 29 05:50:21 bkp010 kernel: [559018.459723]  stp
> Sep 29 05:50:21 bkp010 kernel: [559018.459723]  stp
> Sep 29 05:50:21 bkp010 kernel: [559018.459724]  llc
> Sep 29 05:50:21 bkp010 kernel: [559018.459724]  llc
> Sep 29 05:50:21 bkp010 kernel: [559018.459724]  ipv6
> Sep 29 05:50:21 bkp010 kernel: [559018.459725]  ipv6
> Sep 29 05:50:21 bkp010 kernel: [559018.459725]  btrfs
> Sep 29 05:50:21 bkp010 kernel: [559018.459725]  btrfs
> Sep 29 05:50:21 bkp010 kernel: [559018.459726]  xor
> Sep 29 05:50:21 bkp010 kernel: [559018.459726]  xor
> Sep 29 05:50:21 bkp010 kernel: [559018.459726]  raid6_pq
> Sep 29 05:50:21 bkp010 kernel: [559018.459727]  raid6_pq
> Sep 29 05:50:21 bkp010 kernel: [559018.459727]  zlib_deflate
> Sep 29 05:50:21 bkp010 kernel: [559018.459728]  zlib_deflate
> Sep 29 05:50:21 bkp010 kernel: [559018.459728]  coretemp
> Sep 29 05:50:21 bkp010 kernel: [559018.459728]  coretemp
> Sep 29 05:50:21 bkp010 kernel: [559018.459729]  hwmon
> Sep 29 05:50:21 bkp010 kernel: [559018.459729]  hwmon
> Sep 29 05:50:21 bkp010 kernel: [559018.459729]  loop
> Sep 29 05:50:21 bkp010 kernel: [559018.459730]  loop
> Sep 29 05:50:21 bkp010 kernel: [559018.459730]  pcspkr
> Sep 29 05:50:21 bkp010 kernel: [559018.459731]  pcspkr
> Sep 29 05:50:21 bkp010 kernel: [559018.459731]  parport_pc
> Sep 29 05:50:21 bkp010 kernel: [559018.459731]  parport_pc
> Sep 29 05:50:21 bkp010 kernel: [559018.459732]  parport
> Sep 29 05:50:21 bkp010 kernel: [559018.459732]  parport
> Sep 29 05:50:21 bkp010 kernel: [559018.459732]  i2c_i801
> Sep 29 05:50:21 bkp010 kernel: [559018.459733]  i2c_i801
> Sep 29 05:50:21 bkp010 kernel: [559018.459733]  i2ccore
> Sep 29 05:50:21 bkp010 kernel: [559018.459733]  i2ccore
> Sep 29 05:50:21 bkp010 kernel: [559018.459734]  battery
> Sep 29 05:50:21 bkp010 kernel: [559018.459734]  battery
> Sep 29 05:50:21 bkp010 kernel: [559018.459734]  tpm_infineon
> Sep 29 05:50:21 bkp010 kernel: [559018.459735]  tpm_infineon
> Sep 29 05:50:21 bkp010 kernel: [559018.459735]  tpm_tis
> Sep 29 05:50:21 bkp010 kernel: [559018.459735]  tpm_tis
> Sep 29 05:50:21 bkp010 kernel: [559018.459736]  video
> Sep 29 05:50:21 bkp010 kernel: [559018.459736]  video
> Sep 29 05:50:21 bkp010 kernel: [559018.459736]  tpm
> Sep 29 05:50:21 bkp010 kernel: [559018.459737]  tpm
> Sep 29 05:50:21 bkp010 kernel: [559018.459737]  ehci_pci
> Sep 29 05:50:21 bkp010 kernel: [559018.459738]  ehci_pci
> Sep 29 05:50:21 bkp010 kernel: [559018.459738]  ehci_hcd
> Sep 29 05:50:21 bkp010 kernel: [559018.459738]  ehci_hcd
> Sep 29 05:50:21 b

[PATCH RFC] btrfs: introduce procfs interface for the device list

2014-09-29 Thread Anand Jain
From: Anand Jain 

(added RFC prefix to the patch header)
(as of now just an experimental interface)

This patch introduces profs interface /proc/fs/btrfs/devlist,
which as of now exports all the members of kernel fs_devices.

The current /sys/fs/btrfs interface works when the fs is
mounted, and is on the file directory hierarchy and also has
the sysfs limitation max output of U64 per file.

Here btrfs procfs uses seq_file to export all the members of
fs_devices. Also shows the contents when device is not mounted,
but have registered with btrfs kernel (useful as an alternative
to buggy ready ioctl)

An attempt is made to follow the some standard file format
output such as ini. So that a simple warper python script will
provide end user useful interfaces.

Further planning to add few more members to the interface such as
group profile info. The long term idea is to make procfs
interface a onestop btrfs application interface for the device and
fs info from the kernel, where a simple python script can make
use of it.

Signed-off-by: Anand Jain 
---
 fs/btrfs/Makefile  |  2 +-
 fs/btrfs/ctree.h   |  4 +++
 fs/btrfs/procfs.c  | 45 ++
 fs/btrfs/super.c   |  4 +++
 fs/btrfs/volumes.c | 94 ++
 fs/btrfs/volumes.h |  1 +
 6 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 fs/btrfs/procfs.c

diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 6d1d0b9..134a62f 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_BTRFS_FS) := btrfs.o
 btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
   file-item.o inode-item.o inode-map.o disk-io.o \
   transaction.o inode.o file.o tree-defrag.o \
-  extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
+  extent_map.o sysfs.o procfs.o struct-funcs.o xattr.o ordered-data.o \
   extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
   export.o tree-log.o free-space-cache.o zlib.o lzo.o \
   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6db3d4b..600adc30 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3909,6 +3909,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char 
*buffer, size_t size);
 int btrfs_parse_options(struct btrfs_root *root, char *options);
 int btrfs_sync_fs(struct super_block *sb, int wait);
 
+/* procfs.c */
+void btrfs_exit_procfs(void);
+void btrfs_init_procfs(void);
+
 #ifdef CONFIG_PRINTK
 __printf(2, 3)
 void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
diff --git a/fs/btrfs/procfs.c b/fs/btrfs/procfs.c
new file mode 100644
index 000..9c94c6c
--- /dev/null
+++ b/fs/btrfs/procfs.c
@@ -0,0 +1,45 @@
+#include 
+#include 
+#include 
+#include "ctree.h"
+#include "volumes.h"
+
+#define BTRFS_PROC_PATH"fs/btrfs"
+#define BTRFS_PROC_DEVLIST "devlist"
+
+struct proc_dir_entry  *btrfs_proc_root;
+
+static int btrfs_devlist_show(struct seq_file *seq, void *offset)
+{
+   btrfs_print_devlist(seq);
+   return 0;
+}
+
+static int btrfs_seq_open(struct inode *inode, struct file *file)
+{
+   return single_open(file, btrfs_devlist_show, PDE_DATA(inode));
+}
+
+static const struct file_operations btrfs_seq_fops = {
+   .owner   = THIS_MODULE,
+   .open= btrfs_seq_open,
+   .read= seq_read,
+   .llseek  = seq_lseek,
+   .release = single_release,
+};
+
+void btrfs_init_procfs(void)
+{
+   btrfs_proc_root = proc_mkdir(BTRFS_PROC_PATH, NULL);
+   if (btrfs_proc_root)
+   proc_create_data(BTRFS_PROC_DEVLIST, S_IRUGO, btrfs_proc_root,
+   &btrfs_seq_fops, NULL);
+   return;
+}
+
+void btrfs_exit_procfs(void)
+{
+   if (btrfs_proc_root)
+   remove_proc_entry(BTRFS_PROC_DEVLIST, btrfs_proc_root);
+   remove_proc_entry(BTRFS_PROC_PATH, NULL);
+}
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d0f44d9..f545c24 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1976,6 +1976,8 @@ static int __init init_btrfs_fs(void)
if (err)
goto free_hash;
 
+   btrfs_init_procfs();
+
btrfs_init_compress();
 
err = btrfs_init_cachep();
@@ -2048,6 +2050,7 @@ free_cachep:
btrfs_destroy_cachep();
 free_compress:
btrfs_exit_compress();
+   btrfs_exit_procfs();
btrfs_exit_sysfs();
 free_hash:
btrfs_hash_exit();
@@ -2066,6 +2069,7 @@ static void __exit exit_btrfs_fs(void)
extent_io_exit();
btrfs_interface_exit();
unregister_filesystem(&btrfs_fs_type);
+   btrfs_exit_procfs();
btrfs_exit_sysfs();
btrfs_cleanup_fs_uuids();
btrfs_exit_compress();
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 3e803c1..a526722 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -27,6

[PATCH] btrfs: introduce procfs interface for the device list

2014-09-29 Thread Anand Jain
(as of now just an experimental interface)

This patch introduces profs interface /proc/fs/btrfs/devlist,
which as of now exports all the members of kernel fs_devices.

The current /sys/fs/btrfs interface works when the fs is
mounted, and is on the file directory hierarchy and also has
the sysfs limitation max output of U64 per file.

Here btrfs procfs uses seq_file to export all the members of
fs_devices. Also shows the contents when device is not mounted,
but have registered with btrfs kernel (useful as an alternative
to buggy ready ioctl)

An attempt is made to follow the some standard file format
output such as ini. So that a simple warper python script will
provide end user useful interfaces.

Further planning to add few more members to the interface such as
group profile info. The long term idea is to make procfs
interface a onestop btrfs application interface for the device and
fs info from the kernel, where a simple python script can make
use of it.

Signed-off-by: Anand Jain 
---
 fs/btrfs/Makefile  |  2 +-
 fs/btrfs/ctree.h   |  4 +++
 fs/btrfs/procfs.c  | 45 ++
 fs/btrfs/super.c   |  4 +++
 fs/btrfs/volumes.c | 94 ++
 fs/btrfs/volumes.h |  1 +
 6 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 fs/btrfs/procfs.c

diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 6d1d0b9..134a62f 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_BTRFS_FS) := btrfs.o
 btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
   file-item.o inode-item.o inode-map.o disk-io.o \
   transaction.o inode.o file.o tree-defrag.o \
-  extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
+  extent_map.o sysfs.o procfs.o struct-funcs.o xattr.o ordered-data.o \
   extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
   export.o tree-log.o free-space-cache.o zlib.o lzo.o \
   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6db3d4b..600adc30 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3909,6 +3909,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char 
*buffer, size_t size);
 int btrfs_parse_options(struct btrfs_root *root, char *options);
 int btrfs_sync_fs(struct super_block *sb, int wait);
 
+/* procfs.c */
+void btrfs_exit_procfs(void);
+void btrfs_init_procfs(void);
+
 #ifdef CONFIG_PRINTK
 __printf(2, 3)
 void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...);
diff --git a/fs/btrfs/procfs.c b/fs/btrfs/procfs.c
new file mode 100644
index 000..9c94c6c
--- /dev/null
+++ b/fs/btrfs/procfs.c
@@ -0,0 +1,45 @@
+#include 
+#include 
+#include 
+#include "ctree.h"
+#include "volumes.h"
+
+#define BTRFS_PROC_PATH"fs/btrfs"
+#define BTRFS_PROC_DEVLIST "devlist"
+
+struct proc_dir_entry  *btrfs_proc_root;
+
+static int btrfs_devlist_show(struct seq_file *seq, void *offset)
+{
+   btrfs_print_devlist(seq);
+   return 0;
+}
+
+static int btrfs_seq_open(struct inode *inode, struct file *file)
+{
+   return single_open(file, btrfs_devlist_show, PDE_DATA(inode));
+}
+
+static const struct file_operations btrfs_seq_fops = {
+   .owner   = THIS_MODULE,
+   .open= btrfs_seq_open,
+   .read= seq_read,
+   .llseek  = seq_lseek,
+   .release = single_release,
+};
+
+void btrfs_init_procfs(void)
+{
+   btrfs_proc_root = proc_mkdir(BTRFS_PROC_PATH, NULL);
+   if (btrfs_proc_root)
+   proc_create_data(BTRFS_PROC_DEVLIST, S_IRUGO, btrfs_proc_root,
+   &btrfs_seq_fops, NULL);
+   return;
+}
+
+void btrfs_exit_procfs(void)
+{
+   if (btrfs_proc_root)
+   remove_proc_entry(BTRFS_PROC_DEVLIST, btrfs_proc_root);
+   remove_proc_entry(BTRFS_PROC_PATH, NULL);
+}
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d0f44d9..f545c24 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1976,6 +1976,8 @@ static int __init init_btrfs_fs(void)
if (err)
goto free_hash;
 
+   btrfs_init_procfs();
+
btrfs_init_compress();
 
err = btrfs_init_cachep();
@@ -2048,6 +2050,7 @@ free_cachep:
btrfs_destroy_cachep();
 free_compress:
btrfs_exit_compress();
+   btrfs_exit_procfs();
btrfs_exit_sysfs();
 free_hash:
btrfs_hash_exit();
@@ -2066,6 +2069,7 @@ static void __exit exit_btrfs_fs(void)
extent_io_exit();
btrfs_interface_exit();
unregister_filesystem(&btrfs_fs_type);
+   btrfs_exit_procfs();
btrfs_exit_sysfs();
btrfs_cleanup_fs_uuids();
btrfs_exit_compress();
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 3e803c1..a526722 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #in

Re: 3.16.3 btrfs receive dies with rename o4736059-335172-0 -> merlin/RC/OSD failed. Directory not empty machine

2014-09-29 Thread Filipe David Manana
On Sat, Sep 27, 2014 at 9:19 PM, Marc MERLIN  wrote:
> Hi Filipe and others,
>
> After I moved directories around, and since then my hourly
> btrfs backup is failing.
>
> Does this output help?

Partially.

>
> Is there a patch you'd like me to try, or should I just work around the
> problem by deleting all these directories and recreating in 2 steps to
> get around the bug?

For the moment you'll have to use the workaround.

I have a hunch about what it might be, but to confirm it (or help if
it's wrong/incomplete) please send me the full output of the following
commands:

- tree -d --inodes, at the root of the parent snapshot
- tree -d --inodes, at the root of the second snapshot
- btrfs receive -vv --max-errors=0  (needs btrfs-progs 3.16.x I believe)

And I'll try to figure it out sometime this week.

thanks

>
> Thanks,
> Marc
>
> grep OSD in btrfs receive -v -v -v output gives:
> truncate merlin/RC/OSD/old/config.xml size=109
> utimes merlin/RC/OSD/old/config.xml
> utimes merlin/RC/OSD
> truncate merlin/RC/OSD/config.xml size=274
> utimes merlin/RC/OSD/config.xml
> link o4736027-335149-0/octocopter1.osd -> merlin/RC/OSD/octocopter1.osd
> unlink merlin/RC/OSD/octocopter1.osd
> utimes merlin/RC/OSD
> rename o4736027-335149-0 -> o4736059-335172-0/OSD-Copter 789
> chown o4736059-335172-0/OSD-Copter 789 - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789 - mode=0755
> utimes o4736059-335172-0/OSD-Copter 789
> rename o4736031-335150-0 -> o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg size=18721
> chown o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
> rename o4736032-335150-0 -> o4736059-335172-0/OSD-Copter 789/config.xml
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/config.xml size=274
> chown o4736059-335172-0/OSD-Copter 789/config.xml - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/config.xml - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/config.xml
> rename o4736033-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/MinimOSD_2.4.0.0.mcm
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm size=163847
> chown o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.0.mcm
> rename o4736034-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/MinimOSD_2.4.0.1.mcm
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm size=163847
> chown o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/MinimOSD_2.4.0.1.mcm
> rename o4736035-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex size=82216
> chown o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex - mode=0644
> utimes o4736059-335172-0/OSD-Copter 
> 789/MinimOSD-Extra_Copter_Pre-release_2.4_r789.hex
> rename o4736036-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/OSD_Config.application
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/OSD_Config.application size=1631
> chown o4736059-335172-0/OSD-Copter 789/OSD_Config.application - uid=500, 
> gid=500
> chmod o4736059-335172-0/OSD-Copter 789/OSD_Config.application - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/OSD_Config.application
> rename o4736037-335150-0 -> o4736059-335172-0/OSD-Copter 789/OSD_Config.exe
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/OSD_Config.exe size=215040
> chown o4736059-335172-0/OSD-Copter 789/OSD_Config.exe - uid=500, gid=500
> chmod o4736059-335172-0/OSD-Copter 789/OSD_Config.exe - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/OSD_Config.exe
> rename o4736038-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/OSD_Config.exe.config
> utimes o4736059-335172-0/OSD-Copter 789
> truncate o4736059-335172-0/OSD-Copter 789/OSD_Config.exe.config size=117
> chown o4736059-335172-0/OSD-Copter 789/OSD_Config.exe.config - uid=500, 
> gid=500
> chmod o4736059-335172-0/OSD-Copter 789/OSD_Config.exe.config - mode=0644
> utimes o4736059-335172-0/OSD-Copter 789/OSD_Config.exe.config
> rename o4736039-335150-0 -> o4736059-335172-0/OSD-Copter 
> 789/OSD_Config.exe.manifest
> utimes o4736059-335172-0/OSD

3.17.0-rc6 system freeze

2014-09-29 Thread Tomasz Chmielewski

System froze under 3.17.0-rc6 with btrfs. It had to be hard rebooted.

Sep 29 05:50:21 bkp010 kernel: [559018.459704] NMI watchdog: BUG: soft 
lockup - CPU#6 stuck for 22s! [kworker/u16:24:16872]
Sep 29 05:50:21 bkp010 kernel: [559018.459705] NMI watchdog: BUG: soft 
lockup - CPU#2 stuck for 22s! [kworker/u16:8:17271]
Sep 29 05:50:21 bkp010 kernel: [559018.459707] NMI watchdog: BUG: soft 
lockup - CPU#0 stuck for 22s! [kworker/u16:11:17272]

Sep 29 05:50:21 bkp010 kernel: [559018.459709] Modules linked in:
Sep 29 05:50:21 bkp010 kernel: [559018.459710] Modules linked in:
Sep 29 05:50:21 bkp010 kernel: [559018.459711]  ipt_MASQUERADE
Sep 29 05:50:21 bkp010 kernel: [559018.459711]  ipt_MASQUERADE
Sep 29 05:50:21 bkp010 kernel: [559018.459712]  iptable_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459712]  iptable_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459713]  nf_conntrack_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459713]  nf_conntrack_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_defrag_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_defrag_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_nat_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459715]  nf_nat_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459715]  nf_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459716]  nf_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459716]  nf_conntrack
Sep 29 05:50:21 bkp010 kernel: [559018.459717]  nf_conntrack
Sep 29 05:50:21 bkp010 kernel: [559018.459717]  ip_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459718]  ip_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459718]  x_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459719]  x_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459719]  cpufreq_ondemand
Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_ondemand
Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_conservative
Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_conservative
Sep 29 05:50:21 bkp010 kernel: [559018.459721]  cpufreq_powersave
Sep 29 05:50:21 bkp010 kernel: [559018.459721]  cpufreq_powersave
Sep 29 05:50:21 bkp010 kernel: [559018.459721]  cpufreq_stats
Sep 29 05:50:21 bkp010 kernel: [559018.459722]  cpufreq_stats
Sep 29 05:50:21 bkp010 kernel: [559018.459722]  bridge
Sep 29 05:50:21 bkp010 kernel: [559018.459723]  bridge
Sep 29 05:50:21 bkp010 kernel: [559018.459723]  stp
Sep 29 05:50:21 bkp010 kernel: [559018.459723]  stp
Sep 29 05:50:21 bkp010 kernel: [559018.459724]  llc
Sep 29 05:50:21 bkp010 kernel: [559018.459724]  llc
Sep 29 05:50:21 bkp010 kernel: [559018.459724]  ipv6
Sep 29 05:50:21 bkp010 kernel: [559018.459725]  ipv6
Sep 29 05:50:21 bkp010 kernel: [559018.459725]  btrfs
Sep 29 05:50:21 bkp010 kernel: [559018.459725]  btrfs
Sep 29 05:50:21 bkp010 kernel: [559018.459726]  xor
Sep 29 05:50:21 bkp010 kernel: [559018.459726]  xor
Sep 29 05:50:21 bkp010 kernel: [559018.459726]  raid6_pq
Sep 29 05:50:21 bkp010 kernel: [559018.459727]  raid6_pq
Sep 29 05:50:21 bkp010 kernel: [559018.459727]  zlib_deflate
Sep 29 05:50:21 bkp010 kernel: [559018.459728]  zlib_deflate
Sep 29 05:50:21 bkp010 kernel: [559018.459728]  coretemp
Sep 29 05:50:21 bkp010 kernel: [559018.459728]  coretemp
Sep 29 05:50:21 bkp010 kernel: [559018.459729]  hwmon
Sep 29 05:50:21 bkp010 kernel: [559018.459729]  hwmon
Sep 29 05:50:21 bkp010 kernel: [559018.459729]  loop
Sep 29 05:50:21 bkp010 kernel: [559018.459730]  loop
Sep 29 05:50:21 bkp010 kernel: [559018.459730]  pcspkr
Sep 29 05:50:21 bkp010 kernel: [559018.459731]  pcspkr
Sep 29 05:50:21 bkp010 kernel: [559018.459731]  parport_pc
Sep 29 05:50:21 bkp010 kernel: [559018.459731]  parport_pc
Sep 29 05:50:21 bkp010 kernel: [559018.459732]  parport
Sep 29 05:50:21 bkp010 kernel: [559018.459732]  parport
Sep 29 05:50:21 bkp010 kernel: [559018.459732]  i2c_i801
Sep 29 05:50:21 bkp010 kernel: [559018.459733]  i2c_i801
Sep 29 05:50:21 bkp010 kernel: [559018.459733]  i2ccore
Sep 29 05:50:21 bkp010 kernel: [559018.459733]  i2ccore
Sep 29 05:50:21 bkp010 kernel: [559018.459734]  battery
Sep 29 05:50:21 bkp010 kernel: [559018.459734]  battery
Sep 29 05:50:21 bkp010 kernel: [559018.459734]  tpm_infineon
Sep 29 05:50:21 bkp010 kernel: [559018.459735]  tpm_infineon
Sep 29 05:50:21 bkp010 kernel: [559018.459735]  tpm_tis
Sep 29 05:50:21 bkp010 kernel: [559018.459735]  tpm_tis
Sep 29 05:50:21 bkp010 kernel: [559018.459736]  video
Sep 29 05:50:21 bkp010 kernel: [559018.459736]  video
Sep 29 05:50:21 bkp010 kernel: [559018.459736]  tpm
Sep 29 05:50:21 bkp010 kernel: [559018.459737]  tpm
Sep 29 05:50:21 bkp010 kernel: [559018.459737]  ehci_pci
Sep 29 05:50:21 bkp010 kernel: [559018.459738]  ehci_pci
Sep 29 05:50:21 bkp010 kernel: [559018.459738]  ehci_hcd
Sep 29 05:50:21 bkp010 kernel: [559018.459738]  ehci_hcd
Sep 29 05:50:21 bkp010 kernel: [559018.459739]  lpc_ich
Sep 29 05:50:21 bkp010 kernel: [559018.459739]  lpc_ich
Sep 29 05:50:21 bkp010 kernel: [559018.459739]  mfd_core
Sep 29 05:50:21 bkp010 kernel: [559018.459740]  mfd_core
Sep 29 05:50:21 bkp010 kernel: [

Re: BTRFS backup questions

2014-09-29 Thread James Pharaoh

On 27/09/14 18:59, Hugo Mills wrote:

2. Duplicating NOCOW files

Are you trying to cross a mount-point with that? It works for me:


Here's a script which replicates what I'm doing:

https://gist.github.com/jamespharaoh/d693067ffd203689ebea

And here's the output when I run it:

https://gist.github.com/jamespharaoh/75cb937fd73b05c9128d


Be aware that the current implementation of (manual) defrag will
separate the shared extents, so you no longer get the deduplication
effect. There was a snapshot-aware defrag implementation, but it
caused filesystem corruption, and has been removed for now until a
working version can be written. I think Josef was working on this.


Yeah, good to know but won't be a major problem. So I'll probably leave 
cow on in almost all cases even for database files. I'll defragment 
those files and deduplicate all the rest. In the case of very large 
sites, which will be rare, I'll use nocow for those files and provision 
replication or whatever.


I'll do some performance testing at some point and post some code and 
the results here ;-)



Yes, this is one of my main inspirations. The problem is that I am pretty
sure it won't handle deduplication of the data.

It does. That's one of the things it's explicitly designed to do.


Ok, so I think I understand this now. I believe that the only type of 
object with a universal id is a subvolume, so the receive function can't 
identify items which already exist by themselves, or that it would be 
expensive to do so.


Providing a "parent" subvolume allows it to do that. So as long as the 
parent subvolume shares the reference with the filesystem being sent it 
will do so after the receive takes place on the target.


I think the issue for me is the word "parent". These are really 
"reference" filesystems.


The subvolumes you've told me to list as the parents are not parent 
filesystems at all, compared to the one I'm sending, except for the 
previous version of the same subvolume of course.


Is that all correct?

James
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH][v2] btrfs: fix a overflowing boundary writing in csum_tree_block

2014-09-29 Thread roy . qing . li
From: Li RongQing 

It is impossible that csum_size is larger than sizeof(long), but the codes
still add the handler for this condition, like allocate new memory, for
extension. If it becomes true someday, copying csum_size size memory to local
32bit variable found and val will overflow these two variables.

Fix it by returning the max 4 byte checksum, and print the csum_size

Signed-off-by: Li RongQing 
---
 fs/btrfs/disk-io.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a1d36e6..d9b52ac 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -295,14 +295,17 @@ static int csum_tree_block(struct btrfs_root *root, 
struct extent_buffer *buf,
if (memcmp_extent_buffer(buf, result, 0, csum_size)) {
u32 val;
u32 found = 0;
+
+   csum_size = min_t(u16, csum_size, sizeof(u32));
memcpy(&found, result, csum_size);
 
read_extent_buffer(buf, &val, 0, csum_size);
printk_ratelimited(KERN_INFO
"BTRFS: %s checksum verify failed on %llu 
wanted %X found %X "
-   "level %d\n",
+   "level %d checksum size %d\n",
root->fs_info->sb->s_id, buf->start,
-   val, found, btrfs_header_level(buf));
+   val, found, btrfs_header_level(buf), csum_size);
+
if (result != (char *)&inline_result)
kfree(result);
return 1;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html