On Mon, Dec 01, 2014 at 05:11:29PM +0000, Filipe Manana wrote: > Stress btrfs' block group allocation and deallocation while running > fstrim in parallel. Part of the goal is also to get data block groups > deallocated so that new metadata block groups, using the same physical > device space ranges, get allocated while fstrim is running. This caused > several issues ranging from invalid memory accesses, kernel crashes, > metadata or data corruption, free space cache inconsistencies, free > space leaks and memory leaks. > > Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx> > --- > > V2: Addressed Dave's comments. > > tests/generic/038 | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/generic/038.out | 2 + > tests/generic/group | 1 + > 3 files changed, 155 insertions(+) > create mode 100755 tests/generic/038 > create mode 100644 tests/generic/038.out > > diff --git a/tests/generic/038 b/tests/generic/038 > new file mode 100755 > index 0000000..217aa7a > --- /dev/null > +++ b/tests/generic/038 > @@ -0,0 +1,152 @@ > +#! /bin/bash > +# FSQA Test No. 038 > +# > +# This test was motivated by btrfs issues, but it's generic enough as it > +# doesn't use any btrfs specific features. > +# > +# Stress btrfs' block group allocation and deallocation while running fstrim in > +# parallel. Part of the goal is also to get data block groups deallocated so > +# that new metadata block groups, using the same physical device space ranges, > +# get allocated while fstrim is running. This caused several issues ranging > +# from invalid memory accesses, kernel crashes, metadata or data corruption, > +# free space cache inconsistencies, free space leaks and memory leaks. > +# > +# These issues were fixed by the following btrfs linux kernel patches: > +# > +# Btrfs: fix invalid block group rbtree access after bg is removed > +# Btrfs: fix crash caused by block group removal > +# Btrfs: fix freeing used extents after removing empty block group > +# Btrfs: fix race between fs trimming and block group remove/allocation > +# Btrfs: fix race between writing free space cache and trimming > +# Btrfs: make btrfs_abort_transaction consider existence of new block groups > +# Btrfs: fix memory leak after block remove + trimming > +# Btrfs: fix extent map leak on chunk allocation failure > +# > +# The issues were found on a qemu/kvm guest with 4 virtual CPUs, 4Gb of ram and > +# scsi-hd devices with discard support enabled (that means hole punching in the > +# disk's image file is performed by the host). > +# > +#----------------------------------------------------------------------- > +# > +# Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved. > +# Author: Filipe Manana <fdmanana@xxxxxxxx> > +# > +# 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" > + > +tmp=/tmp/$$ > +status=1 # failure is the default! > +trap "_cleanup; exit \$status" 0 1 2 3 15 > + > +_cleanup() > +{ > + rm -fr $tmp > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > + > +# real QA test starts here > +_need_to_be_root > +_supported_fs btrfs This should be "_supported_fs generic" Thanks, Eryu -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html