Re: transaction commit deadlock on current rc
On Thu, Oct 17, 2013 at 12:56:14PM -0700, Sage Weil wrote: Hey, I'm seeing the deadlock below under a ceph-osd workload. There may be a subtle problem with the async transaction sequence (since nobody but ceph uses that that I know of), but not obvious to me why create_pending_snapshots would get stuck on btrfs_tree_lock... Can you do sysrq+w when this happens so I can see everybody who's blocked? 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
[PATCH] Btrfs: optimize extent item search in run_delayed_extent_op
Instead of doing another extent tree search if the first search failed to find a metadata item, check if the previous item in the leaf is an extent item and use it if it is, otherwise do the second tree search for an extent item. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 9be5e35..7baefe4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2138,15 +2138,28 @@ again: } if (ret 0) { if (metadata) { - btrfs_release_path(path); - metadata = 0; + if (path-slots[0] 0) { + path-slots[0]--; + btrfs_item_key_to_cpu(path-nodes[0], key, + path-slots[0]); + if (key.objectid == node-bytenr + key.type == BTRFS_EXTENT_ITEM_KEY + key.offset == node-num_bytes) + ret = 0; + } + if (ret 0) { + btrfs_release_path(path); + metadata = 0; - key.offset = node-num_bytes; - key.type = BTRFS_EXTENT_ITEM_KEY; - goto again; + key.objectid = node-bytenr; + key.offset = node-num_bytes; + key.type = BTRFS_EXTENT_ITEM_KEY; + goto again; + } + } else { + err = -EIO; + goto out; } - err = -EIO; - goto out; } leaf = path-nodes[0]; -- 1.7.9.5 -- 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: transaction commit deadlock on current rc
On Fri, 18 Oct 2013, Josef Bacik wrote: On Thu, Oct 17, 2013 at 12:56:14PM -0700, Sage Weil wrote: Hey, I'm seeing the deadlock below under a ceph-osd workload. There may be a subtle problem with the async transaction sequence (since nobody but ceph uses that that I know of), but not obvious to me why create_pending_snapshots would get stuck on btrfs_tree_lock... Can you do sysrq+w when this happens so I can see everybody who's blocked? Thanks, Oops, forgot to attach the bug link. It's at http://tracker.ceph.com/attachments/download/1035/a http://tracker.ceph.com/issues/6451 The machine is still hung.. if there is additional info I can gather you can ping me on irc. Thanks! sage -- 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] Btrfs: fix up seek_hole/seek_data handling
Whoever wrote this was braindead. Also it doesn't work right if you have VACANCY's since we assumed you would only have that at the end of the file, which won't be the case in the near future. I tested this with generic/285 and generic/286 as well as the btrfs tests that use fssum since it uses seek_hole/seek_data to verify things are ok. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- fs/btrfs/file.c | 93 + 1 file changed, 20 insertions(+), 73 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d12107e..728f56f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2405,14 +2405,12 @@ out_reserve_fail: static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) { struct btrfs_root *root = BTRFS_I(inode)-root; - struct extent_map *em; + struct extent_map *em = NULL; struct extent_state *cached_state = NULL; u64 lockstart = *offset; u64 lockend = i_size_read(inode); u64 start = *offset; - u64 orig_start = *offset; u64 len = i_size_read(inode); - u64 last_end = 0; int ret = 0; lockend = max_t(u64, root-sectorsize, lockend); @@ -2429,89 +2427,38 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) lock_extent_bits(BTRFS_I(inode)-io_tree, lockstart, lockend, 0, cached_state); - /* -* Delalloc is such a pain. If we have a hole and we have pending -* delalloc for a portion of the hole we will get back a hole that -* exists for the entire range since it hasn't been actually written -* yet. So to take care of this case we need to look for an extent just -* before the position we want in case there is outstanding delalloc -* going on here. -*/ - if (whence == SEEK_HOLE start != 0) { - if (start = root-sectorsize) - em = btrfs_get_extent_fiemap(inode, NULL, 0, 0, -root-sectorsize, 0); - else - em = btrfs_get_extent_fiemap(inode, NULL, 0, -start - root-sectorsize, -root-sectorsize, 0); - if (IS_ERR(em)) { - ret = PTR_ERR(em); - goto out; - } - last_end = em-start + em-len; - if (em-block_start == EXTENT_MAP_DELALLOC) - last_end = min_t(u64, last_end, inode-i_size); - free_extent_map(em); - } - - while (1) { + while (start inode-i_size) { em = btrfs_get_extent_fiemap(inode, NULL, 0, start, len, 0); if (IS_ERR(em)) { ret = PTR_ERR(em); + em = NULL; break; } - if (em-block_start == EXTENT_MAP_HOLE) { - if (test_bit(EXTENT_FLAG_VACANCY, em-flags)) { - if (last_end = orig_start) { - free_extent_map(em); - ret = -ENXIO; - break; - } - } - - if (whence == SEEK_HOLE) { - *offset = start; - free_extent_map(em); + if (whence == SEEK_HOLE + (em-block_start == EXTENT_MAP_HOLE || +test_bit(EXTENT_FLAG_PREALLOC, em-flags))) { + break; + } else if (whence == SEEK_DATA) { + if (em-block_start EXTENT_MAP_LAST_BYTE + !test_bit(EXTENT_FLAG_PREALLOC, em-flags)) + break; + if (em-block_start == EXTENT_MAP_DELALLOC) break; - } - } else { - if (whence == SEEK_DATA) { - if (em-block_start == EXTENT_MAP_DELALLOC) { - if (start = inode-i_size) { - free_extent_map(em); - ret = -ENXIO; - break; - } - } - - if (!test_bit(EXTENT_FLAG_PREALLOC, - em-flags)) { - *offset = start; - free_extent_map(em); - break; - } - } }
Re: transaction commit deadlock on current rc
On Fri, Oct 18, 2013 at 08:42:28AM -0700, Sage Weil wrote: On Fri, 18 Oct 2013, Josef Bacik wrote: On Thu, Oct 17, 2013 at 12:56:14PM -0700, Sage Weil wrote: Hey, I'm seeing the deadlock below under a ceph-osd workload. There may be a subtle problem with the async transaction sequence (since nobody but ceph uses that that I know of), but not obvious to me why create_pending_snapshots would get stuck on btrfs_tree_lock... Can you do sysrq+w when this happens so I can see everybody who's blocked? Thanks, Oops, forgot to attach the bug link. It's at http://tracker.ceph.com/attachments/download/1035/a http://tracker.ceph.com/issues/6451 The machine is still hung.. if there is additional info I can gather you can ping me on irc. Oops, I'll fix that right up, sorry about that. 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] Btrfs: fix up seek_hole/seek_data handling
On Fri, 18 Oct 2013 11:48:21 -0400 Josef Bacik jba...@fusionio.com wrote: Whoever wrote this was braindead. You do realize you sent a number of people googling for Delalloc is such a pain. If we have a hole and we have pending just out of curiosity? :)) -- With respect, Roman signature.asc Description: PGP signature
Re: [PATCH] Btrfs: fix up seek_hole/seek_data handling
On Fri, Oct 18, 2013 at 10:11:15PM +0600, Roman Mamedov wrote: On Fri, 18 Oct 2013 11:48:21 -0400 Josef Bacik jba...@fusionio.com wrote: Whoever wrote this was braindead. You do realize you sent a number of people googling for Delalloc is such a pain. If we have a hole and we have pending just out of curiosity? :)) When I say things like this you can just assume it was me who wrote it ;). 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] Btrfs: fix up seek_hole/seek_data handling
On Fri, Oct 18, 2013 at 10:11:15PM +0600, Roman Mamedov wrote: On Fri, 18 Oct 2013 11:48:21 -0400 Josef Bacik jba...@fusionio.com wrote: Whoever wrote this was braindead. You do realize you sent a number of people googling for Delalloc is such a pain. If we have a hole and we have pending just out of curiosity? :)) Hmm? git blame, friend :). Not that we needed to. We knew exactly who he was referring to the moment we read the comment. We love us some Josef. - z -- 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: transaction commit deadlock on current rc
Quoting Sage Weil (2013-10-18 11:42:28) On Fri, 18 Oct 2013, Josef Bacik wrote: On Thu, Oct 17, 2013 at 12:56:14PM -0700, Sage Weil wrote: Hey, I'm seeing the deadlock below under a ceph-osd workload. There may be a subtle problem with the async transaction sequence (since nobody but ceph uses that that I know of), but not obvious to me why create_pending_snapshots would get stuck on btrfs_tree_lock... Can you do sysrq+w when this happens so I can see everybody who's blocked? Thanks, Oops, forgot to attach the bug link. It's at http://tracker.ceph.com/attachments/download/1035/a http://tracker.ceph.com/issues/6451 The machine is still hung.. if there is additional info I can gather you can ping me on irc. Thanks Sage and Josef, I've got this one queued up pending an ack from Sage. But it's obviously not harmful, so I'll probably send this afternoon either way. -chris -- 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 6/8] xfstests: generic/311: add a few more test cases
Btrfs had some issues with fsync()'ing directories and fsync()'ing after renames. These three new tests cover the 3 different issues we were seeing. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/generic/311 | 89 +-- tests/generic/311.out | 8 + 2 files changed, 95 insertions(+), 2 deletions(-) diff --git a/tests/generic/311 b/tests/generic/311 index 675d927..002ad57 100644 --- a/tests/generic/311 +++ b/tests/generic/311 @@ -70,6 +70,8 @@ testfile=$SCRATCH_MNT/$seq.fsync FLAKEY_TABLE=0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 180 0 FLAKEY_TABLE_DROP=0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 drop_writes _TEST_OPTIONS= +allow_writes=0 +drop_writes=1 _mount_flakey() { @@ -104,8 +106,6 @@ _load_flakey_table() _run_test() { # _run_test testnum 0 - buffered | 1 - O_DIRECT - allow_writes=0 - drop_writes=1 test_num=$1 direct_opt= @@ -131,6 +131,83 @@ _run_test() _mount_flakey } +_clean_working_dir() +{ + _mount_flakey + rm -rf $SCRATCH_MNT/* + _unmount_flakey +} + +# Btrfs wasn't making sure the directory survived fsync +_directory_test() +{ + echo fsync new directory + _mount_flakey + mkdir $SCRATCH_MNT/bar + $XFS_IO_PROG -c fsync $SCRATCH_MNT/bar + _load_flakey_table $drop_writes + _unmount_flakey + + _load_flakey_table $allow_writes + _mount_flakey + _ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }' + _unmount_flakey + _check_scratch_fs $FLAKEY_DEV + [ $? -ne 0 ] _fatal fsck failed +} + +# Btrfs was losing a rename into a new directory +_rename_test() +{ + echo rename fsync test + _mount_flakey + touch $SCRATCH_MNT/foo + mkdir $SCRATCH_MNT/bar + $XFS_IO_PROG -c fsync $SCRATCH_MNT/foo + mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar/foo + $XFS_IO_PROG -c fsync $SCRATCH_MNT/bar + $XFS_IO_PROG -c fsync $SCRATCH_MNT/bar/foo + _load_flakey_table $drop_writes + _unmount_flakey + + _load_flakey_table $allow_writes + _mount_flakey + _ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }' + _ls_l $SCRATCH_MNT/bar | tail -n +2 | awk '{ print $1, $9 }' + _unmount_flakey + _check_scratch_fs $FLAKEY_DEV + [ $? -ne 0 ] _fatal fsck failed +} + +# Btrfs was failing to replay a log when we had a inode with a smaller inode +# number that is renamed into a directory with a higher inode number +_replay_rename_test() +{ + echo replay rename fsync test + _mount_flakey + touch $SCRATCH_MNT/foo + mkdir $SCRATCH_MNT/bar + $XFS_IO_PROG -c fsync $SCRATCH_MNT/foo + mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar/foo + $XFS_IO_PROG -c fsync $SCRATCH_MNT/bar + + # This is to force btrfs to relog the entire inode including the ref so + # we are sure to try and replay the ref along with the dir_index item + setfattr -n user.foo -v blah $SCRATCH_MNT/bar/foo $seqres.full 21 + + $XFS_IO_PROG -c fsync $SCRATCH_MNT/bar/foo + _load_flakey_table $drop_writes + _unmount_flakey + + _load_flakey_table $allow_writes + _mount_flakey + _ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }' + _ls_l $SCRATCH_MNT/bar | tail -n +2 | awk '{ print $1, $9 }' + _unmount_flakey + _check_scratch_fs $FLAKEY_DEV + [ $? -ne 0 ] _fatal fsck failed +} + _scratch_mkfs $seqres.full 21 # Create a basic flakey device that will never error out @@ -157,5 +234,13 @@ for i in $(seq 1 20); do _run_test $i $direct done +rm -rf $SCRATCH_MNT/* +_unmount_flakey +_directory_test +_clean_working_dir +_rename_test +_clean_working_dir +_replay_rename_test + status=0 exit diff --git a/tests/generic/311.out b/tests/generic/311.out index 5bad6a7..8a0d5c8 100644 --- a/tests/generic/311.out +++ b/tests/generic/311.out @@ -319,3 +319,11 @@ Running test 20 direct, nolockfs Random seed is 20 a16ac2b84456d41a15a1a4cc1202179f a16ac2b84456d41a15a1a4cc1202179f +fsync new directory +drwxr-xr-x bar +rename fsync test +drwxr-xr-x bar +-rw-r--r-- foo +replay rename fsync test +drwxr-xr-x bar +-rw-r--r-- foo -- 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
[PATCH 7/8] xfstests: btrfs/017: add a regression test for snapshot creation
We had a regression where you couldn't snapshot a file system if you mounted it ro and then remounted it rw. This is a test that does just that to make sure we don't have this problem again. I ran the test without the fix and it blew up, and then applied the fix and verified that it passed. Thanks, Reviewed-by: Stefan Behrens sbehr...@giantdisaster.de Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/btrfs/017 | 61 + tests/btrfs/017.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 64 insertions(+) create mode 100644 tests/btrfs/017 create mode 100644 tests/btrfs/017.out diff --git a/tests/btrfs/017 b/tests/btrfs/017 new file mode 100644 index 000..d45f32a --- /dev/null +++ b/tests/btrfs/017 @@ -0,0 +1,61 @@ +#! /bin/bash +# FS QA Test No. btrfs/017 +# +# Regression test to make sure we can create a snapshot after mounting with +# readonly and remounting rw. +# +#--- +# Copyright (c) 2013 Fusion IO. 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 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap _cleanup ; exit \$status 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +rm -f $seqres.full + +_scratch_mkfs /dev/null 21 +_scratch_mount -o ro +_scratch_mount -o rw,remount + +$BTRFS_UTIL_PROG sub snap $SCRATCH_MNT $SCRATCH_MNT/snap $seqres.full 21 \ + || _fail couldn't create snapshot + +echo Silence is golden +status=0 ; exit diff --git a/tests/btrfs/017.out b/tests/btrfs/017.out new file mode 100644 index 000..8222844 --- /dev/null +++ b/tests/btrfs/017.out @@ -0,0 +1,2 @@ +QA output created by 017 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 082fd67..be9476d 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -19,3 +19,4 @@ 014 auto 015 auto quick 016 auto quick +017 auto quick -- 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
[PATCH 1/8] xfstests: fix btrfs/002 to not use the scratch dev pool
This test doesn't need the scratch dev pool and it also doesn't call _require_scratch_dev_pool, so just kick out the scratch dev pool part of the test. Thanks, Reviewed-by: Anand Jain anand.j...@oracle.com Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/btrfs/002 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/btrfs/002 b/tests/btrfs/002 index f4389ae..19a62c6 100755 --- a/tests/btrfs/002 +++ b/tests/btrfs/002 @@ -45,9 +45,8 @@ _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch -_require_scratch_dev_pool -_scratch_pool_mkfs /dev/null 21 || _fail mkfs failed +_scratch_mkfs /dev/null 21 || _fail mkfs failed _scratch_mount # Create and save sha256sum -- 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
[PATCH 5/8] xfstests: generic/274 increase scratch fs size to 2g
With 1 gig btrfs defaults to mixed block groups, so we ENOSPC in this test because we run out of metadata space, not data space. Increasing to 2g allows us to use our normal setup and allows us to pass this test. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/generic/274 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/generic/274 b/tests/generic/274 index da45fab..7c4887f 100755 --- a/tests/generic/274 +++ b/tests/generic/274 @@ -57,7 +57,7 @@ echo -- rm -f $seqres.full umount $SCRATCH_DEV 2/dev/null -_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) $seqres.full 21 +_scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) $seqres.full 21 _scratch_mount # Create a 4k file and Allocate 4M past EOF on that file -- 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
[PATCH 4/8] xfstests: btrfs/016: a hole punching send test
I recently added a patch to avoid sending holes with btrfs send, but I screwed it up by not sending a hole when we did a hole punch. This is an xfstest version of the test I wrote to show that I had a bug and to verify I was fixing it properly. This test properly fails with my old patch and passes with my good patch. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/btrfs/016 | 100 tests/btrfs/016.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 103 insertions(+) create mode 100644 tests/btrfs/016 create mode 100644 tests/btrfs/016.out diff --git a/tests/btrfs/016 b/tests/btrfs/016 new file mode 100644 index 000..d711ecb --- /dev/null +++ b/tests/btrfs/016 @@ -0,0 +1,100 @@ +#! /bin/bash +# FS QA Test No. btrfs/016 +# +# btrfs send hole punch test +# +#--- +# Copyright (c) 2013 Fusion IO. 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=`mktemp -d` +tmp_dir=send_temp_$seq + +status=1 # failure is the default! + +_cleanup() +{ + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap /dev/null 21 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap1 /dev/null 21 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/send /dev/null 21 + rm -rf $TEST_DIR/$tmp_dir + rm -f $tmp.* +} + +trap _cleanup ; exit \$status 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +FSSUM_PROG=$here/src/fssum +[ -x $FSSUM_PROG ] || _notrun fssum not built + +_scratch_mkfs /dev/null 21 + +#receive needs to be able to setxattrs, including the selinux context, if we use +#the normal nfs context thing it screws up our ability to set the +#security.selinux xattrs so we need to disable this for this test +export SELINUX_MOUNT_OPTIONS= + +_scratch_mount + +mkdir $TEST_DIR/$tmp_dir +$BTRFS_UTIL_PROG subvol create $TEST_DIR/$tmp_dir/send \ +$seqres.full 21 || _fail failed subvol create + +dd if=/dev/urandom of=$TEST_DIR/$tmp_dir/send/foo bs=1M count=10 $seqres.full \ + 21 || _fail dd failed +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap $seqres.full 21 || _fail failed snap +$XFS_IO_PROG -c fpunch 1m 1m $TEST_DIR/$tmp_dir/send/foo +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap1 $seqres.full 21 || _fail failed snap + +$FSSUM_PROG -A -f -w $tmp/fssum.snap $TEST_DIR/$tmp_dir/snap $seqres.full \ + 21 || _fail fssum gen failed +$FSSUM_PROG -A -f -w $tmp/fssum.snap1 $TEST_DIR/$tmp_dir/snap1 $seqres.full \ + 21 || _fail fssum gen failed + +$BTRFS_UTIL_PROG send $TEST_DIR/$tmp_dir/snap -f $tmp/send.snap \ + $seqres.full 21 || _fail failed send +$BTRFS_UTIL_PROG send $TEST_DIR/$tmp_dir/snap1 -p $TEST_DIR/$tmp_dir/snap \ + -f $tmp/send.snap1 $seqres.full 21 || _fail failed send + +$BTRFS_UTIL_PROG receive -f $tmp/send.snap $SCRATCH_MNT $seqres.full 21 \ + || _fail failed recv +$BTRFS_UTIL_PROG receive -f $tmp/send.snap1 $SCRATCH_MNT $seqres.full 21 \ + || _fail failed recv + +$FSSUM_PROG -r $tmp/fssum.snap $SCRATCH_MNT/snap $seqres.full 21 \ + || _fail fssum failed +$FSSUM_PROG -r $tmp/fssum.snap1 $SCRATCH_MNT/snap1 $seqres.full 21 \ + || _fail fssum failed + +echo Silence is golden +status=0 ; exit diff --git a/tests/btrfs/016.out b/tests/btrfs/016.out new file mode 100644 index 000..aa2526b --- /dev/null +++ b/tests/btrfs/016.out @@ -0,0 +1,2 @@ +QA output created by 016 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index a6f1820..082fd67 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -18,3 +18,4 @@ 013 auto quick 014 auto 015 auto quick +016 auto quick -- 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
[PATCH 8/8] xfstests: btrfs/018: a regression test for subvolume rename
A user reported a regression where we could no longer rename a subvolume into another subvolume. This is a test case to do just that to make sure we don't regress on this again. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/btrfs/018 | 61 + tests/btrfs/018.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 64 insertions(+) create mode 100644 tests/btrfs/018 create mode 100644 tests/btrfs/018.out diff --git a/tests/btrfs/018 b/tests/btrfs/018 new file mode 100644 index 000..de7a793 --- /dev/null +++ b/tests/btrfs/018 @@ -0,0 +1,61 @@ +#! /bin/bash +# FS QA Test No. btrfs/018 +# +# Regression test to make sure we can move a subvol into another subvol +# +#--- +# Copyright (c) 2013 Fusion IO. 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 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap _cleanup ; exit \$status 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +rm -f $seqres.full + +_scratch_mkfs /dev/null 21 +_scratch_mount +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/test1 $seqres.full 21 \ + || _fail couldn't create test1 +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/test2 $seqres.full 21 \ + || _fail couldn't create test1 +mv $SCRATCH_MNT/test1 $SCRATCH_MNT/test2 || _fail Problem doing move + +echo Silence is golden +status=0 ; exit diff --git a/tests/btrfs/018.out b/tests/btrfs/018.out new file mode 100644 index 000..8849e30 --- /dev/null +++ b/tests/btrfs/018.out @@ -0,0 +1,2 @@ +QA output created by 018 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index be9476d..ed564b2 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -20,3 +20,4 @@ 015 auto quick 016 auto quick 017 auto quick +018 auto quick -- 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
[PATCH 3/8] xfstests: stat the dev we're removing to make sure its' really gone V2
I've been periodically failing btrfs/003 because my box sometimes takes a little longer to unregister the device when we remove it and so the output from btrfs dev show doesn't match what we are wanting since it still sees the device. To fix this just stat and sleep if we still see the device node and only continue once udev or whatever actually removes the device node so that we don't get random failures. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- V1-V2: Take Eric's suggestion to do this in the helper function common/rc | 9 + tests/btrfs/003 | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index b253948..253bd05 100644 --- a/common/rc +++ b/common/rc @@ -2093,7 +2093,16 @@ _require_freeze() # ls -l /sys/class/block/sdd | rev | cut -d / -f 3 | rev _devmgt_remove() { + local h=$1 + local disk=$2 + echo 1 /sys/class/scsi_device/${1}/device/delete || _fail Remove disk failed + + stat $disk /dev/null 21 + while [ $? -eq 0 ]; do + sleep 1 + stat $disk /dev/null 21 + done } # arg 1 is dev to add and is output of the below eg. diff --git a/tests/btrfs/003 b/tests/btrfs/003 index 262b1d5..15c2cc7 100755 --- a/tests/btrfs/003 +++ b/tests/btrfs/003 @@ -142,7 +142,7 @@ _test_replace() DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d / -f 3 | rev` #fail disk - _devmgt_remove ${DEVHTL} + _devmgt_remove ${DEVHTL} $ds dev_removed=1 $BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep Some devices missing $seqres.full || _fail \ -- 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
[PATCH 2/8] xfstests: add regression test for kernel bz 60673
There was a problem with send trying to overwrite a file that wasn't actually the same. This is a test to check this particular case where receive fails when it should succeed properly. I tested this to verify it fails without my fix and passes with my fix. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- tests/btrfs/015 | 110 tests/btrfs/015.out | 2 + tests/btrfs/group | 1 + 3 files changed, 113 insertions(+) create mode 100644 tests/btrfs/015 create mode 100644 tests/btrfs/015.out diff --git a/tests/btrfs/015 b/tests/btrfs/015 new file mode 100644 index 000..f35600f --- /dev/null +++ b/tests/btrfs/015 @@ -0,0 +1,110 @@ +#! /bin/bash +# FS QA Test No. btrfs/015 +# +# btrfs send ENOENT regression test, kernel bugzilla 60673 +# +#--- +# Copyright (c) 2013 Fusion IO. 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/$$ +tmp_dir=send_temp_$seq + +status=1 # failure is the default! + +_cleanup() +{ + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap1 /dev/null 21 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/snap2 /dev/null 21 + $BTRFS_UTIL_PROG subvol del $TEST_DIR/$tmp_dir/send /dev/null 21 + rm -rf $TEST_DIR/$tmp_dir + rm -f $tmp.* +} + +trap _cleanup ; exit \$status 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +_scratch_mkfs /dev/null 21 + +#receive needs to be able to setxattrs, including the selinux context, if we use +#the normal nfs context thing it screws up our ability to set the +#security.selinux xattrs so we need to disable this for this test +export SELINUX_MOUNT_OPTIONS= + +_scratch_mount + +mkdir $TEST_DIR/$tmp_dir +$BTRFS_UTIL_PROG subvol create $TEST_DIR/$tmp_dir/send \ +$seqres.full 21 || _fail failed subvol create + +cd $TEST_DIR/$tmp_dir/send + +mkdir test +touch test/baz +touch test/blah +mkdir test/foo +touch test/foo/bar + +# cd out in case any of this fails +cd / + +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap1 $seqres.full 21 || _fail failed snap1 + +$BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send1.dump \ + $TEST_DIR/$tmp_dir/snap1 $seqres.full 21 || _fail failed send + +$BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send1.dump $SCRATCH_MNT \ +$seqres.full 21 || _fail failed receive + +#recreate everything exactly the way it was exceptn in a different order so we +#get different inode numbers +cd $TEST_DIR/$tmp_dir/send +rm -rf test +mkdir test +touch test/baz +mkdir test/foo +touch test/foo/bar +touch test/blah +cd / + +$BTRFS_UTIL_PROG subvol snap -r $TEST_DIR/$tmp_dir/send \ + $TEST_DIR/$tmp_dir/snap2 $seqres.full 21 || _fail failed snap2 + +$BTRFS_UTIL_PROG send -f $TEST_DIR/$tmp_dir/send2.dump \ + $TEST_DIR/$tmp_dir/snap2 -p $TEST_DIR/$tmp_dir/snap1 \ +$seqres.full 21 || _fail failed second send + +$BTRFS_UTIL_PROG receive -f $TEST_DIR/$tmp_dir/send2.dump $SCRATCH_MNT \ +$seqres.full 21 || _fail failed second receive + +echo Silence is golden +status=0 ; exit diff --git a/tests/btrfs/015.out b/tests/btrfs/015.out new file mode 100644 index 000..fee0fcf --- /dev/null +++ b/tests/btrfs/015.out @@ -0,0 +1,2 @@ +QA output created by 015 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index 07df957..a6f1820 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -17,3 +17,4 @@ 012 auto 013 auto quick 014 auto +015 auto quick -- 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] xfstests: btrfs/014: add a regression test for snapshot creation
The test was renumbered and committed. Thanks --Rich commit 56a3959a96f1b5e046b3760778fd34b4911d0516 Author: Josef Bacik jba...@fusionio.com Date: Fri Sep 27 13:55:37 2013 + xfstests: btrfs/015: add a regression test for snapshot creation -- 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: transaction commit deadlock on current rc
On Fri, 18 Oct 2013, Chris Mason wrote: Quoting Sage Weil (2013-10-18 11:42:28) On Fri, 18 Oct 2013, Josef Bacik wrote: On Thu, Oct 17, 2013 at 12:56:14PM -0700, Sage Weil wrote: Hey, I'm seeing the deadlock below under a ceph-osd workload. There may be a subtle problem with the async transaction sequence (since nobody but ceph uses that that I know of), but not obvious to me why create_pending_snapshots would get stuck on btrfs_tree_lock... Can you do sysrq+w when this happens so I can see everybody who's blocked? Thanks, Oops, forgot to attach the bug link. It's at http://tracker.ceph.com/attachments/download/1035/a http://tracker.ceph.com/issues/6451 The machine is still hung.. if there is additional info I can gather you can ping me on irc. Thanks Sage and Josef, I've got this one queued up pending an ack from Sage. But it's obviously not harmful, so I'll probably send this afternoon either way. This is passing my initial tests! It'll be subjected to the full firehose later tonight; I'll let you know if anything comes up. Thanks! sage -- 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
[GIT PULL] Btrfs
Hi Linus, My for-linus branch has a one line fix: git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus Sage hit a deadlock with ceph on btrfs, and Josef tracked it down to a regression in our initial rc1 pull. When doing nocow writes we were sometimes starting a transaction with locks held. Josef Bacik (1) commits (+1/-0): Btrfs: release path before starting transaction in can_nocow_extent Total: (1) commits (+1/-0) fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion(+) -- 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] Btrfs: fix race condition between writting and scrubing supers
From: Wang Shilong wangsl.f...@cn.fujitsu.com Scrubing supers is not in a transaction context, when trying to write supers to disk, we should check if we are trying to scrub supers.Fix it. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 2 ++ fs/btrfs/transaction.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 419968e..0debb19 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3582,7 +3582,9 @@ int btrfs_commit_super(struct btrfs_root *root) return ret; } + btrfs_scrub_pause_super(root); ret = write_ctree_super(NULL, root, 0); + btrfs_scrub_continue_super(root); return ret; } diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 277fe81..3ebcbbd 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1892,7 +1892,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, goto cleanup_transaction; } + btrfs_scrub_pause_super(root); ret = write_ctree_super(trans, root, 0); + btrfs_scrub_continue_super(root); if (ret) { mutex_unlock(root-fs_info-tree_log_mutex); goto cleanup_transaction; -- 1.7.11.7 -- 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