From patchwork Tue Jun 23 16:47:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 6662491 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C06219F39B for ; Tue, 23 Jun 2015 16:47:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C480320657 for ; Tue, 23 Jun 2015 16:47:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9261020652 for ; Tue, 23 Jun 2015 16:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932824AbbFWQr1 (ORCPT ); Tue, 23 Jun 2015 12:47:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47340 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932420AbbFWQr0 (ORCPT ); Tue, 23 Jun 2015 12:47:26 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 4BFEC36B188; Tue, 23 Jun 2015 16:47:26 +0000 (UTC) Received: from bfoster.bfoster (dhcp-41-237.bos.redhat.com [10.18.41.237]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5NGlPo7008533; Tue, 23 Jun 2015 12:47:26 -0400 Received: by bfoster.bfoster (Postfix, from userid 1000) id 976B712426D; Tue, 23 Jun 2015 12:47:24 -0400 (EDT) From: Brian Foster To: fstests@vger.kernel.org Cc: xfs@oss.sgi.com Subject: [PATCH] xfstests: generic xattr enospc cleanup test Date: Tue, 23 Jun 2015 12:47:24 -0400 Message-Id: <1435078044-21679-1-git-send-email-bfoster@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP XFS had a regression where inode reclaim in the unlink codepath would not correctly tear down extended attribute forks where no xattr extents are present. Add a generic test to create this condition. The test sets extended attributes on a series of files under ENOSPC conditions and then verifies that the files can be removed without syslog warnings or errors. Signed-off-by: Brian Foster --- tests/generic/103 | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/103.out | 2 ++ tests/generic/group | 1 + 3 files changed, 94 insertions(+) create mode 100755 tests/generic/103 create mode 100644 tests/generic/103.out diff --git a/tests/generic/103 b/tests/generic/103 new file mode 100755 index 0000000..373cd9d --- /dev/null +++ b/tests/generic/103 @@ -0,0 +1,91 @@ +#! /bin/bash +# FSQA Test No. 103 +# +# Test attribute fork teardown. This test is inspired by a regression in XFS +# that resulted in problematic removal of inodes with remote attribute forks +# without attribute extents. The attribute fork condition is created by +# attempting to set larger attribute values on a filesystem that is at or near +# ENOSPC. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 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" + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 25 + +# get standard environment, filters and checks +. ./common/rc +. ./common/attr + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_attrs + +rm -f $seqres.full + +_consume_freesp() +{ + file=$1 + + # consume nearly all available space (leave ~512kB) + avail=`_get_available_space $SCRATCH_MNT` + filesizekb=$((avail / 1024 - 512)) + $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file +} + +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +for i in $(seq 0 63); do + touch $SCRATCH_MNT/$seq.$i +done + +# Generate a large attribute value and consume the rest of the space in the +# filesystem. +$XFS_IO_PROG -fc "pwrite 0 64k" $SCRATCH_MNT/attrval > /dev/null 2>&1 +_consume_freesp $SCRATCH_MNT/spc + +# Set attributes on the test files. These should start to hit ENOSPC. +for i in $(seq 0 63); do + $SETFATTR_PROG -n user.test -v "`cat $SCRATCH_MNT/attrval`" \ + $SCRATCH_MNT/$seq.$i >> $seqres.full 2>&1 +done + +# Remove the files with attributes to test attribute fork teardown. Problems +# result in dmesg output. +rm -f $SCRATCH_MNT/$seq.* + +echo Silence is golden. + +status=0 +exit diff --git a/tests/generic/103.out b/tests/generic/103.out new file mode 100644 index 0000000..ce229bf --- /dev/null +++ b/tests/generic/103.out @@ -0,0 +1,2 @@ +QA output created by 103 +Silence is golden. diff --git a/tests/generic/group b/tests/generic/group index 0c8964c..41f3039 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -98,6 +98,7 @@ 097 udf auto 099 udf auto 100 udf auto +103 auto enospc quick 105 acl auto quick 112 rw aio auto quick 113 rw aio auto quick