Skip to contentSkip to conversation

xfstests: xfs directory unbalance assert test

PATCH In review Mark Tinguely 4 participants 9 messages Sep 17, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 xfstests: xfs directory unbalance assert test

This tests triggers an assert in the XFS directory unbalance code. This test originally written by Brian Foster and suggestions from Micheal Semon.

---
 tests/generic/319     |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/319.out |    2 +
 tests/generic/group   |    1 
 3 files changed, 65 insertions(+)
tests/generic/319 new file +62 -0
Index: b/tests/generic/319
===================================================================
@@ -0,0 +1,62 @@
+#! /bin/bash
+# FS QA Test No. 319
+#
+# Test directory code correctly handles fsstress filling the filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 SGI.  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!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+_require_scratch
+
+# real QA test starts here
+
+_supported_fs generic
+_supported_os IRIX Linux
+
+_scratch_unmount > /dev/null 2>&1
+_scratch_mkfs_sized 11g >> $seqres.full 2>&1
+_scratch_mount > /dev/null 2>&1
+
+# Fill the filesystem.
+FSSTRESS_ARGS="-z -s 1378390208 -fsymlink=1 -n7500000 -p4 -d $SCRATCH_MNT"
+$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1
+
+cd $SCRATCH_MNT >> $seqres.full 2>&1
+sync
+# A debug XFS may assert in the remove due to a directory bug.
+rm -rf *
+echo "--- silence is golden ---"
+status=0
+exit
tests/generic/319.out new file +2 -0
Index: b/tests/generic/319.out
===================================================================
@@ -0,0 +1,2 @@
+QA output created by 319
+--- silence is golden ---
tests/generic/group +1 -0
Index: b/tests/generic/group
===================================================================
@@ -121,3 +121,4 @@
 316 auto quick
 317 auto metadata quick
 318 acl attr auto quick
+319 stress

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 54 lines · Mark Tinguely

This tests triggers an assert in the XFS directory unbalance code. This test originally written by Brian Foster and suggestions from Micheal Semon.

---
 tests/generic/319     |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/319.out |    2 +
 tests/generic/group   |    1 
 3 files changed, 65 insertions(+)

Index: b/tests/generic/319
===================================================================

tests/generic/319 new file +38 -0
@@ -0,0 +1,62 @@
+#! /bin/bash
+# FS QA Test No. 319
+#
+# Test directory code correctly handles fsstress filling the filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 SGI.  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!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+}
+
+# get standard environment, filters and checks

tests/generic/319 line 48

Quoted 10 lines
tests/generic/319 new file +10 -0
+. ./common/rc
+. ./common/filter
+_require_scratch
+
+# real QA test starts here
+
+_supported_fs generic
+_supported_os IRIX Linux
+
+_scratch_unmount > /dev/null 2>&1

This is not necessary, _require_scratch has done the unmount work.

tests/generic/319 line 49

Quoted 1 line
tests/generic/319 new file +1 -0
+_scratch_mkfs_sized 11g >> $seqres.full 2>&1

_scratch_mkfs_sized expects fssize in bytes, 11g is not a valid value The comments in common/rc about _scratch_mkfs_sized say

# _scratch_mkfs_sized <size in bytes> [optional blocksize]

Quoted 25 lines
tests/generic/319 new file +13 -0
+_scratch_mount > /dev/null 2>&1
+
+# Fill the filesystem.
+FSSTRESS_ARGS="-z -s 1378390208 -fsymlink=1 -n7500000 -p4 -d $SCRATCH_MNT"
+$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1
+
+cd $SCRATCH_MNT >> $seqres.full 2>&1
+sync
+# A debug XFS may assert in the remove due to a directory bug.
+rm -rf *
+echo "--- silence is golden ---"
+status=0
+exit

Index: b/tests/generic/319.out
===================================================================

tests/generic/319.out new file +2 -0
@@ -0,0 +1,2 @@
+QA output created by 319
+--- silence is golden ---

Index: b/tests/generic/group
===================================================================

tests/generic/group line 124

Quoted 4 lines
tests/generic/group +1 -0
@@ -121,3 +121,4 @@
 316 auto quick
 317 auto metadata quick
 318 acl attr auto quick
+319 stress

Should be in auto group too I guess.

Thanks,
Eryu Guan

Quoted 6 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 1 line · Eryu Guan

On Tue, Sep 17, 2013 at 09:59:47AM -0500, Mark Tinguely wrote:

...

Quoted 3 lines
Quoted 1 line

+_scratch_unmount> /dev/null 2>&1

This is not necessary, _require_scratch has done the unmount work.

okay, stole that from other tests.

Quoted 7 lines
Quoted 2 lines

+_scratch_mkfs_sized 11g>> $seqres.full 2>&1

_scratch_mkfs_sized expects fssize in bytes, 11g is not a valid value The comments in common/rc about _scratch_mkfs_sized say

# _scratch_mkfs_sized<size in bytes> [optional blocksize]

That was a shortcut for xfs. Looking in common/rc. I see that it breaks the other filesystems that need the size in blocks.

...

Quoted 6 lines
Quoted 6 lines
tests/generic/319.out new file +2 -0
@@ -0,0 +1,2 @@
+QA output created by 319
+--- silence is golden ---

Index: b/tests/generic/group
===================================================================
--- a/tests/generic/group

Quoted 8 lines

tests/generic/group line 124

Quoted 6 lines

+++ b/tests/generic/group

tests/generic/group +1 -0
@@ -121,3 +121,4 @@
  316 auto quick
  317 auto metadata quick
  318 acl attr auto quick
+319 stress

Should be in auto group too I guess.

It takes a very long time to run to completion, don't know if people want this in the auto run.

Quoted 2 lines

Thanks,
Eryu Guan

Thanks for the feedback

--Mark.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 11 lines · Mark Tinguely
Quoted 1 line · Eryu Guan

On Tue, Sep 17, 2013 at 09:59:47AM -0500, Mark Tinguely wrote:

...

Quoted 3 lines
Quoted 1 line

+_scratch_unmount> /dev/null 2>&1

This is not necessary, _require_scratch has done the unmount work.

okay, stole that from other tests.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

+_scratch_mkfs_sized 11g>> $seqres.full 2>&1

_scratch_mkfs_sized expects fssize in bytes, 11g is not a valid value The comments in common/rc about _scratch_mkfs_sized say

# _scratch_mkfs_sized<size in bytes> [optional blocksize]

That was a shortcut for xfs. Looking in common/rc. I see that it breaks the other filesystems that need the size in blocks.

at least mkfs.extN also understands "11g" but the helper does not, because it causes a failure in the device size check, (for any fs):

        [ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
Quoted 17 lines

...

Quoted 6 lines
Quoted 6 lines
tests/generic/319.out new file +2 -0
@@ -0,0 +1,2 @@
+QA output created by 319
+--- silence is golden ---

Index: b/tests/generic/group
===================================================================
--- a/tests/generic/group

Quoted 8 lines

tests/generic/group line 124

Quoted 6 lines

+++ b/tests/generic/group

tests/generic/group +1 -0
@@ -121,3 +121,4 @@
  316 auto quick
  317 auto metadata quick
  318 acl attr auto quick
+319 stress

Should be in auto group too I guess.

Quoted 1 line

It takes a very long time to run to completion, don't know if people want this in the auto run.

how long is long? We do have "quick" for people who want quick. I think auto is probably ok. Maybe we should add a "slow" group, and you can "-x slow" :)

-Eric

Quoted 12 lines
Quoted 2 lines

Thanks,
Eryu Guan

Thanks for the feedback

--Mark.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw
Quoted 42 lines · Eric Sandeen
Quoted 11 lines · Mark Tinguely
Quoted 1 line · Eryu Guan

On Tue, Sep 17, 2013 at 09:59:47AM -0500, Mark Tinguely wrote:

...

Quoted 3 lines
Quoted 1 line

+_scratch_unmount> /dev/null 2>&1

This is not necessary, _require_scratch has done the unmount work.

okay, stole that from other tests.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

+_scratch_mkfs_sized 11g>> $seqres.full 2>&1

_scratch_mkfs_sized expects fssize in bytes, 11g is not a valid value The comments in common/rc about _scratch_mkfs_sized say

# _scratch_mkfs_sized<size in bytes> [optional blocksize]

That was a shortcut for xfs. Looking in common/rc. I see that it breaks the other filesystems that need the size in blocks.

at least mkfs.extN also understands "11g" but the helper does not, because it causes a failure in the device size check, (for any fs):

         [ "$fssize" -gt "$devsize" ]&&  _notrun "Scratch device too small"
Quoted 17 lines

...

Quoted 14 lines

tests/generic/group line 124

Quoted 12 lines
tests/generic/319.out new file +2 -0
@@ -0,0 +1,2 @@
+QA output created by 319
+--- silence is golden ---

Index: b/tests/generic/group
===================================================================

tests/generic/group +1 -0
@@ -121,3 +121,4 @@
   316 auto quick
   317 auto metadata quick
   318 acl attr auto quick
+319 stress

Should be in auto group too I guess.

Quoted 13 lines
Quoted 1 line

It takes a very long time to run to completion, don't know if people want this in the auto run.

how long is long? We do have "quick" for people who want quick. I think auto is probably ok. Maybe we should add a "slow" group, and you can "-x slow" :)

-Eric

Quoted 6 lines
Quoted 2 lines

Thanks,
Eryu Guan

Thanks for the feedback

--Mark.

About 45 minutes.

--Mark.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw
In reply to Mark Tinguely
Quoted 3 lines · Mark Tinguely

This tests triggers an assert in the XFS directory unbalance code. This test originally written by Brian Foster and suggestions from Micheal Semon.

cool, thanks. Comments below.

Quoted 38 lines
---
 tests/generic/319     |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/319.out |    2 +
 tests/generic/group   |    1 
 3 files changed, 65 insertions(+)

Index: b/tests/generic/319
===================================================================

tests/generic/319 new file +26 -0
@@ -0,0 +1,62 @@
+#! /bin/bash
+# FS QA Test No. 319
+#
+# Test directory code correctly handles fsstress filling the filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 SGI.  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"

tests/generic/319 line 36

Quoted 10 lines
tests/generic/319 new file +10 -0
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+}

That seems pointless; usually it's done w/ rm -f $tmp.* right after, but we have no tmpfile, so...

tests/generic/319 line 48

Quoted 12 lines
tests/generic/319 new file +12 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+_require_scratch
+
+# real QA test starts here
+
+_supported_fs generic
+_supported_os IRIX Linux
+
+_scratch_unmount > /dev/null 2>&1

Aside:

I see this done both ways - is it required to unmount scratch at the beginning of a test? I don't think so (I know it's done in many tests, though, but again, C&P & cargo cult? Or not? I'm not sure :( )

I guess it doesn't hurt, but at some point I'd like to get it straight about who's required to umount scratch, and when (if at all).

tests/generic/319 line 49

Quoted 1 line
tests/generic/319 new file +1 -0
+_scratch_mkfs_sized 11g >> $seqres.full 2>&1

_scratch_mkfs_sized doesn't take units like this ('g'), so the above fails to actually make an 11g fs:

# Create fs of certain size on scratch device
# _scratch_mkfs_sized <size in bytes> [optional blocksize] _scratch_mkfs_sized()

so we get this in 319.full:

expr: non-numeric argument
./common/rc: line 576: [: 11g: integer expression expected

but then it seems like mkfs carries on anyway w/ defaults. :(

Apparently the mkfs 11g part isn't actually critical? ;)

maybe _scratch_mkfs_sized needs something like this at the top:

re='^[0-9]+$'
if ! [[ $fssize =~ $re ]] ; then
_notrun "error: _scratch_mkfs_sized: $fssize not a number of bytes"
fi

tests/generic/319 line 50

Quoted 1 line
tests/generic/319 new file +1 -0
+_scratch_mount > /dev/null 2>&1

is ignore-all-output really the right thing to do? When does _scratch_mount emit anything? (more cargo cult)? :)

tests/generic/319 line 56

Quoted 5 lines
tests/generic/319 new file +5 -0
+# Fill the filesystem.
+FSSTRESS_ARGS="-z -s 1378390208 -fsymlink=1 -n7500000 -p4 -d $SCRATCH_MNT"
+$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1
+
+cd $SCRATCH_MNT >> $seqres.full 2>&1

cd doesn't emit anything except on error, right, and if there's an error we'd better stop the test right here!

tests/generic/319 line 59

Quoted 3 lines
tests/generic/319 new file +3 -0
+sync
+# A debug XFS may assert in the remove due to a directory bug.
+rm -rf *

I'd feel a whole lot better if you did rm -rf $SCRATCH_MNT/* just in case we somehow ended up in the wrong place here.

Or even better if you pointed fsstress at $SCRATCH_MNT/$seq.dir, and then did rm -rf $SCRATCH_MNT/$seq.dir - just to avoid that nasty should-never-happen-still-scary "rm -rf /*"

-Eric

Quoted 21 lines
tests/generic/319 new file +3 -0
+echo "--- silence is golden ---"
+status=0
+exit

Index: b/tests/generic/319.out
===================================================================

tests/generic/319.out new file +2 -0
@@ -0,0 +1,2 @@
+QA output created by 319
+--- silence is golden ---

Index: b/tests/generic/group
===================================================================

tests/generic/group +1 -0
@@ -121,3 +121,4 @@
 316 auto quick
 317 auto metadata quick
 318 acl attr auto quick
+319 stress
Quoted 5 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#7 lore raw
Quoted 50 lines · Eric Sandeen
Quoted 3 lines · Mark Tinguely

This tests triggers an assert in the XFS directory unbalance code. This test originally written by Brian Foster and suggestions from Micheal Semon.

cool, thanks. Comments below.

Quoted 43 lines
---
  tests/generic/319     |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++
  tests/generic/319.out |    2 +
  tests/generic/group   |    1
  3 files changed, 65 insertions(+)

Index: b/tests/generic/319
===================================================================

tests/generic/319 new file +31 -0
@@ -0,0 +1,62 @@
+#! /bin/bash
+# FS QA Test No. 319
+#
+# Test directory code correctly handles fsstress filling the filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 SGI.  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!
+trap "_cleanup; exit \$status" 0 1 2 3 15
Quoted 8 lines

tests/generic/319 line 36

Quoted 5 lines
tests/generic/319 new file +5 -0
+
+_cleanup()
+{
+    cd /
+}

That seems pointless; usually it's done w/ rm -f $tmp.* right after, but we have no tmpfile, so...

Yeah, no cleanup is needed.

Quoted 15 lines

tests/generic/319

Quoted 12 lines
tests/generic/319 new file +12 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+_require_scratch
+
+# real QA test starts here
+
+_supported_fs generic
+_supported_os IRIX Linux
+
+_scratch_unmount>  /dev/null 2>&1

Aside:

Quoted 6 lines

I see this done both ways - is it required to unmount scratch at the beginning of a test? I don't think so (I know it's done in many tests, though, but again, C&P& cargo cult? Or not? I'm not sure :( )

I guess it doesn't hurt, but at some point I'd like to get it straight about who's required to umount scratch, and when (if at all).

Have to unmount for the mkfs, as noted by Eryu, it is already done. I would rather manually unmount it than be surprised when someone changes the common files.

Quoted 10 lines

tests/generic/319 line 49

Quoted 2 lines
tests/generic/319 new file +1 -0
+_scratch_mkfs_sized 11g>>  $seqres.full 2>&1

_scratch_mkfs_sized doesn't take units like this ('g'), so the above fails to actually make an 11g fs:

# Create fs of certain size on scratch device
# _scratch_mkfs_sized<size in bytes> [optional blocksize] _scratch_mkfs_sized()

Quoted 8 lines

so we get this in 319.full:

expr: non-numeric argument
./common/rc: line 576: [: 11g: integer expression expected

but then it seems like mkfs carries on anyway w/ defaults. :(

Apparently the mkfs 11g part isn't actually critical? ;)

it works on xfs because mkfs.xfs size can take those values, but yes it breaks on other filesystem. my bad.

Quoted 29 lines

maybe _scratch_mkfs_sized needs something like this at the top:

re='^[0-9]+$'
if ! [[ $fssize =~ $re ]] ; then
_notrun "error: _scratch_mkfs_sized: $fssize not a number of bytes"
fi

tests/generic/319 line 50

Quoted 1 line
tests/generic/319 new file +1 -0
+_scratch_mount>  /dev/null 2>&1

is ignore-all-output really the right thing to do? When does _scratch_mount emit anything? (more cargo cult)? :)

tests/generic/319

Quoted 5 lines
tests/generic/319 new file +5 -0
+# Fill the filesystem.
+FSSTRESS_ARGS="-z -s 1378390208 -fsymlink=1 -n7500000 -p4 -d $SCRATCH_MNT"
+$FSSTRESS_PROG $FSSTRESS_ARGS>>  $seqres.full 2>&1
+
+cd $SCRATCH_MNT>>  $seqres.full 2>&1

cd doesn't emit anything except on error, right, and if there's an error we'd better stop the test right here!

tests/generic/319 line 59

Quoted 3 lines
tests/generic/319 new file +3 -0
+sync
+# A debug XFS may assert in the remove due to a directory bug.
+rm -rf *

I'd feel a whole lot better if you did rm -rf $SCRATCH_MNT/* just in case we somehow ended up in the wrong place here.

Quoted 4 lines

Or even better if you pointed fsstress at $SCRATCH_MNT/$seq.dir, and then did rm -rf $SCRATCH_MNT/$seq.dir - just to avoid that nasty should-never-happen-still-scary "rm -rf /*"

Makes a lot of sense.

Quoted 1 line

-Eric

Thanks Eric.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#8 lore raw
Quoted 81 lines · Mark Tinguely
Quoted 50 lines · Eric Sandeen
Quoted 3 lines · Mark Tinguely

This tests triggers an assert in the XFS directory unbalance code. This test originally written by Brian Foster and suggestions from Micheal Semon.

cool, thanks. Comments below.

Quoted 43 lines
---
  tests/generic/319     |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++
  tests/generic/319.out |    2 +
  tests/generic/group   |    1
  3 files changed, 65 insertions(+)

Index: b/tests/generic/319
===================================================================

tests/generic/319 new file +31 -0
@@ -0,0 +1,62 @@
+#! /bin/bash
+# FS QA Test No. 319
+#
+# Test directory code correctly handles fsstress filling the filesystem
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 SGI.  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!
+trap "_cleanup; exit \$status" 0 1 2 3 15
Quoted 8 lines

tests/generic/319 line 36

Quoted 5 lines
tests/generic/319 new file +5 -0
+
+_cleanup()
+{
+    cd /
+}

That seems pointless; usually it's done w/ rm -f $tmp.* right after, but we have no tmpfile, so...

Yeah, no cleanup is needed.

Quoted 19 lines

tests/generic/319

Quoted 12 lines
tests/generic/319 new file +12 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+_require_scratch
+
+# real QA test starts here
+
+_supported_fs generic
+_supported_os IRIX Linux
+
+_scratch_unmount>  /dev/null 2>&1

Aside:

I see this done both ways - is it required to unmount scratch at the beginning of a test? I don't think so (I know it's done in many tests, though, but again, C&P& cargo cult? Or not? I'm not sure :( )

Quoted 6 lines
Quoted 2 lines

I guess it doesn't hurt, but at some point I'd like to get it straight about who's required to umount scratch, and when (if at all).

Have to unmount for the mkfs, as noted by Eryu, it is already done. I would rather manually unmount it than be surprised when someone changes the common files.

If that happens, tons of tests will break. I'd really just remove it for clarity, but *shrug*

Quoted 12 lines
Quoted 12 lines

tests/generic/319 line 49

Quoted 2 lines
tests/generic/319 new file +1 -0
+_scratch_mkfs_sized 11g>>  $seqres.full 2>&1

_scratch_mkfs_sized doesn't take units like this ('g'), so the above fails to actually make an 11g fs:

# Create fs of certain size on scratch device
# _scratch_mkfs_sized<size in bytes> [optional blocksize] _scratch_mkfs_sized()

so we get this in 319.full:

Quoted 8 lines
Quoted 6 lines

expr: non-numeric argument
./common/rc: line 576: [: 11g: integer expression expected

but then it seems like mkfs carries on anyway w/ defaults. :(

Apparently the mkfs 11g part isn't actually critical? ;)

it works on xfs because mkfs.xfs size can take those values, but yes it breaks on other filesystem. my bad.

One other nitpick in this area, please remove $seqres.full before you start so it doesn't grow each time the test is run.

(hm maybe we should add that to ./check or something; so many tests miss this)

But - no, it doesn't work for xfs either, at least not in all cases, because it doesn't do the device size check. Here's xfs output on a < 11G device:

expr: non-numeric argument
./common/rc: line 582: [: 11g: integer expression expected
** mkfs failed with extra mkfs options added to "-bsize=4096" by test 319 ** ** attempting to mkfs using only test 319 options: -d size=11g -b size=4096 ** size 11g specified for data subvolume is too large, maximum is 1048241 blocks
Usage: mkfs.xfs
/* blocksize */ [-b log=n|size=num]
...

and w/o error checking (2>&1 and no || _fail) the test just carries on w/o a fresh mkfs, on whatever size it happens to be.

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#9 lore raw
In reply to Mark Tinguely

tests/generic/319 line 59

Quoted 8 lines · Mark Tinguely
tests/generic/319 new file +8 -0
+# Fill the filesystem.
+FSSTRESS_ARGS="-z -s 1378390208 -fsymlink=1 -n7500000 -p4 -d $SCRATCH_MNT"
+$FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1
+
+cd $SCRATCH_MNT >> $seqres.full 2>&1
+sync
+# A debug XFS may assert in the remove due to a directory bug.
+rm -rf *

Wouldn't this be better:

sync
rm -rf $SCRATCH_MNT/*

Remember, xfstests runs as root and so having a "rm -rf *" anywhere in a test is a disaster just waiting to happen....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs