generic: test quota handling on remount ro failure
PATCH v2 1/4 generic: test quota handling on remount ro failure
Remount ro should not turn qouta off unconditionally, even remount ro failed, also kernel should not oops on the next succeeded remount ro.
---
v2:
- rebase and re-numbered to generic/082
- add comments to quotacheck and quotaon
- add comments to the first remount,ro with unknown option
- fail the test if the second remount,ro failed
tests/generic/082 | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/082.out | 3 +++ tests/generic/group | 1 + 3 files changed, 77 insertions(+) create mode 100755 tests/generic/082 create mode 100644 tests/generic/082.out
tests/generic/082 new file +73 -0
@@ -0,0 +1,73 @@ +#! /bin/bash +# FS QA Test No. 082 +# +# Test quota handling on remount ro failure +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_test +_require_scratch +_require_quota + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 +_scratch_mount "-o usrquota,grpquota" + +# xfs doesn't need these setups and quotacheck even fails on xfs, so just +# redirect the output to $seqres.full for debug purpose and ignore the results, +# as we check the quota status later anyway. +quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1 +quotaon $SCRATCH_MNT >>$seqres.full 2>&1 + +# first remount ro with a bad option, a failed remount ro should not disable +# quota, but currently xfs doesn't fail in this case, the unknown option is +# just ignored, but quota is still on. This may change in future, let's +# re-consider the case then. +_scratch_mount "-o remount,ro,nosuchopt" >>$seqres.full 2>&1 +quotaon -p $SCRATCH_MNT | _filter_scratch +# second remount should succeed, no oops or hang expected +_scratch_mount "-o remount,ro" || _fail "second remount,ro failed" + +# success, all done +status=0 +exit
tests/generic/082.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 082 +group quota on SCRATCH_MNT (SCRATCH_DEV) is on +user quota on SCRATCH_MNT (SCRATCH_DEV) is on
tests/generic/group +1 -0
@@ -84,6 +84,7 @@ 079 acl attr ioctl metadata auto quick 080 auto quick 081 auto quick +082 auto quick 083 rw auto enospc stress 088 perms auto quick 089 metadata auto
Signature · 1 line
1.8.3.1
PATCH v3 2/4 generic: test hardlink to unlinked file
Kernel commit
aae8a97 fs: Don't allow to create hardlink for deleted file
disabled hardlink to unlinked file.
Test the race between link and unlink, which could end up adding link count to an unlinked file and leading to fs corruption on xfs.
Test case was originally written by Eric Sandeen.
---
v3:
- rebase and re-numbered to generic/084
- sleep 1 before removing all files being tailed
v2:
- create different link file in each iteration in link_unlink_storm(), which is confirmed to be able to reproduce the original corruption
- remove all newly created & tail'ed files at last, out of the loop, to avoid tail & rm race
- iterate $nr_cpu times to do the link_unlink_storm, not a fixed number
- add to quick group
tests/generic/084 | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/084.out | 2 + tests/generic/group | 1 + 3 files changed, 107 insertions(+) create mode 100755 tests/generic/084 create mode 100644 tests/generic/084.out
tests/generic/084 new file +104 -0
@@ -0,0 +1,104 @@ +#! /bin/bash +# FS QA Test No. 084 +# +# Test hardlink to unlinked file. +# +# Regression test for commit: +# aae8a97 fs: Don't allow to create hardlink for deleted file +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +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 generic +_supported_os Linux +_require_scratch + +link_unlink_storm() +{ + local src=$1 + local target=$2 + local i=0 + + while true; do + ln -f $src $target.$i >/dev/null 2>&1 + rm -f $target.$i >/dev/null 2>&1 + let i=i+1 + done +} + +rm -f $seqres.full +nr_cpu=`$here/src/feature -o` +echo "Silence is golden" + +_scratch_mkfs >>$seqres.full 2>&1 +_scratch_mount + +# create, open & unlinked files so unlinked inode list is not empty +for i in `seq 1 $nr_cpu`; do + testfile=$SCRATCH_MNT/$seq.unlinked.$i + touch $testfile + tail -f $testfile & + tail_pids="$tail_pids $!" +done +# give tail some time to open the file before the file is removed +sleep 1 +rm -f $SCRATCH_MNT/$seq.unlinked.* + +# start link/unlink storm +src=$SCRATCH_MNT/$seq.target +touch $src +for i in `seq 1 $nr_cpu`; do + target=$SCRATCH_MNT/$seq.target.link.$i + link_unlink_storm $src $target & + link_pids="$link_pids $!" +done + +# remove & re-create target to race with link/unlink +while true; do + rm -f $src + touch $src +done & +sleep 5 +kill $! >/dev/null 2>&1 + +kill $tail_pids $link_pids >/dev/null 2>&1 +wait $tail_pids $link_pids + +# all done, no oops/hang expected, _check_filesystems checks SCRATCH_DEV after test +status=0 +exit
tests/generic/084.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 084 +Silence is golden
tests/generic/group +1 -0
@@ -86,6 +86,7 @@ 081 auto quick 082 auto quick 083 rw auto enospc stress +084 auto metadata quick 088 perms auto quick 089 metadata auto 091 rw auto quick
Signature · 1 line
1.8.3.1
Re: [PATCH v3 2/4] generic: test hardlink to unlinked file
Quoted 6 lines · Eryu Guan
Kernel commit
aae8a97 fs: Don't allow to create hardlink for deleted file
disabled hardlink to unlinked file.
Quoted 7 lines
Test the race between link and unlink, which could end up adding link count to an unlinked file and leading to fs corruption on xfs.
Test case was originally written by Eric Sandeen.
Signed-off-by Eryu Guan <[email protected]>---
Looks good and runs fine for me now:
Quoted 156 lines
v3:
- rebase and re-numbered to generic/084
- sleep 1 before removing all files being tailedv2:
- create different link file in each iteration inlink_unlink_storm(), which is confirmed to be able to reproduce the original corruption
- remove all newly created & tail'ed files at last, out of the loop, to avoid tail & rm race
- iterate $nr_cpu times to do thelink_unlink_storm, not a fixed number
- add to quick grouptests/generic/084 | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/084.out | 2 + tests/generic/group | 1 + 3 files changed, 107 insertions(+) create mode 100755 tests/generic/084 create mode 100644 tests/generic/084.outtests/generic/084 new file +104
-0@@ -0,0 +1,104 @@ +#! /bin/bash +# FS QA Test No. 084 +# +# Test hardlink to unlinked file. +# +# Regression test for commit: +# aae8a97 fs: Don't allow to create hardlink for deleted file +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +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 generic +_supported_os Linux +_require_scratch + +link_unlink_storm() +{ + local src=$1 + local target=$2 + local i=0 + + while true; do + ln -f $src $target.$i >/dev/null 2>&1 + rm -f $target.$i >/dev/null 2>&1 + let i=i+1 + done +} + +rm -f $seqres.full +nr_cpu=`$here/src/feature -o` +echo "Silence is golden" + +_scratch_mkfs >>$seqres.full 2>&1 +_scratch_mount + +# create, open & unlinked files so unlinked inode list is not empty +for i in `seq 1 $nr_cpu`; do + testfile=$SCRATCH_MNT/$seq.unlinked.$i + touch $testfile + tail -f $testfile & + tail_pids="$tail_pids $!" +done +# give tail some time to open the file before the file is removed +sleep 1 +rm -f $SCRATCH_MNT/$seq.unlinked.* + +# start link/unlink storm +src=$SCRATCH_MNT/$seq.target +touch $src +for i in `seq 1 $nr_cpu`; do + target=$SCRATCH_MNT/$seq.target.link.$i + link_unlink_storm $src $target & + link_pids="$link_pids $!" +done + +# remove & re-create target to race with link/unlink +while true; do + rm -f $src + touch $src +done & +sleep 5 +kill $! >/dev/null 2>&1 + +kill $tail_pids $link_pids >/dev/null 2>&1 +wait $tail_pids $link_pids + +# all done, no oops/hang expected, _check_filesystems checks SCRATCH_DEV after test +status=0 +exittests/generic/084.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 084 +Silence is goldentests/generic/group +1
-0@@ -86,6 +86,7 @@ 081 auto quick 082 auto quick 083 rw auto enospc stress +084 auto metadata quick 088 perms auto quick 089 metadata auto 091 rw auto quickSignature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 3/4 shared: test truncate orphan inodes when mounting extN
In reply to Eryu Guanext4 should hold i_mutex when truncating orhpan inodes, or a WARNING would be triggered. This commit fixed this issue.
721e3eb ext4: lock i_mutex when truncating orphan inodes
Though it's an ext4 specific issue, there's no harm to test on ext2/3 too, as debugfs is used to set orphan inode list.
This test is based on a script from Lukas Czerner.
---
v2:
- fix wrong seq number at the beginning of the test
tests/shared/001 | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/shared/001.out | 2 ++ tests/shared/group | 1 + 3 files changed, 74 insertions(+) create mode 100755 tests/shared/001 create mode 100644 tests/shared/001.out
tests/shared/001 new file +71 -0
@@ -0,0 +1,71 @@ +#! /bin/bash +# FS QA Test No. 001 +# +# Test truncate orphan inodes when mounting extN. +# ext4 used to hit WARNING, this commit fixed the issue +# +# 721e3eb ext4: lock i_mutex when truncating orphan inodes +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +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 ext2 ext3 ext4 +_supported_os Linux +_require_scratch + +rm -f $seqres.full +echo "Silence is golden" + +_scratch_mkfs_sized $((16*1024*1024)) >>$seqres.full 2>&1 +_scratch_mount + +# create a file and get its inode number, usually it's 12, but to be accurate +testfile=$SCRATCH_MNT/testfile +touch $testfile +inode=`ls -i $testfile | awk '{print $1}'` + +# add the inode in orphan inode list +_scratch_unmount +debugfs -w -R "set_super_value last_orphan $inode" $SCRATCH_DEV \ + >>$seqres.full 2>&1 + +# mount again to truncate orphan inode, _check_dmesg will catch the WARNING +_scratch_mount + +status=0 +exit
tests/shared/001.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 001 +Silence is golden
tests/shared/group +1 -0
@@ -3,6 +3,7 @@ # - do not start group names with a digit # - comment line before each group is "new" description # +001 auto quick 006 auto enospc 032 mkfs auto quick 051 acl udf auto quick
Signature · 1 line
1.8.3.1
PATCH v3 4/4 generic: test fs freeze/unfreeze and mount/umount race
In reply to Eryu GuanExercise fs freeze/unfreeze and mount/umount race, which could lead to use-after-free oops.
This commit fixed the issue:
1494583 fix get_active_super()/umount() race
This test case is based on a script from Monakhov Dmitriy.
---
v3:
- rebase and re-numbered to generic/085
- add more comments to explain why results of suspend/resume, mount/umount are ignored
v2:
- add comments to explain dmsetup is used not xfs_freeze to freeze filesystem
- detect failures in setup phase, so test exits not continus with errors
tests/generic/085 | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/085.out | 2 + tests/generic/group | 1 + 3 files changed, 109 insertions(+) create mode 100755 tests/generic/085 create mode 100644 tests/generic/085.out
tests/generic/085 new file +106 -0
@@ -0,0 +1,106 @@ +#! /bin/bash +# FS QA Test No. 085 +# +# Exercise fs freeze/unfreeze and mount/umount race, which could lead to +# use-after-free oops. +# +# This commit fixed the issue: +# 1494583 fix get_active_super()/umount() race +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* + cleanup_dmdev +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_block_device $SCRATCH_DEV +_require_command $DMSETUP_PROG +_require_freeze + +setup_dmdev() +{ + table="0 $size_in_sector linear $SCRATCH_DEV 0" + $DMSETUP_PROG create $node --table "$table" >>$seqres.full 2>&1 && \ + $DMSETUP_PROG mknodes >/dev/null 2>&1 + return $? +} + +cleanup_dmdev() +{ + # in case it's still suspended and/or mounted + $DMSETUP_PROG resume $lvdev >/dev/null 2>&1 + $UMOUNT_PROG $lvdev >/dev/null 2>&1 + + $DMSETUP_PROG remove $node >>$seqres.full 2>&1 + $DMSETUP_PROG mknodes >/dev/null 2>&1 +} + +rm -f $seqres.full +echo "Silence is golden" + +size=$((256 * 1024 * 1024)) +size_in_sector=$((size / 512)) +_scratch_mkfs_sized $size >>$seqres.full 2>&1 + +node=$seq-test +lvdev=/dev/mapper/$node +setup_dmdev || _fail "setup dm device failed" + +# take use of dmsetup suspend to freeze the fs. +# xfs_freeze/fsfreeze cannot be used in this test, because it can possibly +# freeze the root fs of the host when SCRATCH_MNT is not mounted +# +# And the results of the racing commands (suspend/resume, mount/umount) are not +# important, as long as they're racing with each other. So just throw away the +# outputs and ignore the results. +for ((i=0; i<100; i++)); do + $DMSETUP_PROG suspend $lvdev >/dev/null 2>&1 + $DMSETUP_PROG resume $lvdev >/dev/null 2>&1 +done & +pid=$! +for ((i=0; i<100; i++)); do + $MOUNT_PROG $lvdev $SCRATCH_MNT >/dev/null 2>&1 + $UMOUNT_PROG $lvdev >/dev/null 2>&1 +done & +pid="$pid $!" + +wait $pid + +status=0 +exit
tests/generic/085.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 085 +Silence is golden
tests/generic/group +1 -0
@@ -87,6 +87,7 @@ 082 auto quick 083 rw auto enospc stress 084 auto metadata quick +085 auto freeze mount 088 perms auto quick 089 metadata auto 091 rw auto quick
Signature · 1 line
1.8.3.1
Re: [PATCH v3 4/4] generic: test fs freeze/unfreeze and mount/umount race
Quoted 10 lines · Eryu Guan
Exercise fs freeze/unfreeze and mount/umount race, which could lead to use-after-free oops.
This commit fixed the issue:
1494583 fix get_active_super()/umount() raceThis test case is based on a script from Monakhov Dmitriy.
Signed-off-by Eryu Guan <[email protected]>---
Quoted 154 lines
v3:
- rebase and re-numbered to generic/085
- add more comments to explain why results of suspend/resume, mount/umount are ignoredv2:
- add comments to explain dmsetup is used notxfs_freezeto freeze filesystem
- detect failures in setup phase, so test exits not continus with errorstests/generic/085 | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/085.out | 2 + tests/generic/group | 1 + 3 files changed, 109 insertions(+) create mode 100755 tests/generic/085 create mode 100644 tests/generic/085.outtests/generic/085 new file +106
-0@@ -0,0 +1,106 @@ +#! /bin/bash +# FS QA Test No. 085 +# +# Exercise fs freeze/unfreeze and mount/umount race, which could lead to +# use-after-free oops. +# +# This commit fixed the issue: +# 1494583 fix get_active_super()/umount() race +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* + cleanup_dmdev +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_block_device $SCRATCH_DEV +_require_command $DMSETUP_PROG +_require_freeze + +setup_dmdev() +{ + table="0 $size_in_sector linear $SCRATCH_DEV 0" + $DMSETUP_PROG create $node --table "$table" >>$seqres.full 2>&1 && \ + $DMSETUP_PROG mknodes >/dev/null 2>&1 + return $? +} + +cleanup_dmdev() +{ + # in case it's still suspended and/or mounted + $DMSETUP_PROG resume $lvdev >/dev/null 2>&1 + $UMOUNT_PROG $lvdev >/dev/null 2>&1 + + $DMSETUP_PROG remove $node >>$seqres.full 2>&1 + $DMSETUP_PROG mknodes >/dev/null 2>&1 +} + +rm -f $seqres.full +echo "Silence is golden" + +size=$((256 * 1024 * 1024)) +size_in_sector=$((size / 512)) +_scratch_mkfs_sized $size >>$seqres.full 2>&1 + +node=$seq-test +lvdev=/dev/mapper/$node +setup_dmdev || _fail "setup dm device failed" + +# take use of dmsetup suspend to freeze the fs. +# xfs_freeze/fsfreeze cannot be used in this test, because it can possibly +# freeze the root fs of the host when SCRATCH_MNT is not mounted +# +# And the results of the racing commands (suspend/resume, mount/umount) are not +# important, as long as they're racing with each other. So just throw away the +# outputs and ignore the results. +for ((i=0; i<100; i++)); do + $DMSETUP_PROG suspend $lvdev >/dev/null 2>&1 + $DMSETUP_PROG resume $lvdev >/dev/null 2>&1 +done & +pid=$! +for ((i=0; i<100; i++)); do + $MOUNT_PROG $lvdev $SCRATCH_MNT >/dev/null 2>&1 + $UMOUNT_PROG $lvdev >/dev/null 2>&1 +done & +pid="$pid $!" + +wait $pid + +status=0 +exittests/generic/085.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 085 +Silence is goldentests/generic/group +1
-0@@ -87,6 +87,7 @@ 082 auto quick 083 rw auto enospc stress 084 auto metadata quick +085 auto freeze mount 088 perms auto quick 089 metadata auto 091 rw auto quickSignature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Eryu Guan
Remount ro should not turn qouta off unconditionally, even remount ro failed, also kernel should not oops on the next succeeded remount ro.
Signed-off-by Eryu Guan <[email protected]>---
Looks good to me:
Quoted 120 lines
v2:
- rebase and re-numbered to generic/082
- add comments to quotacheck and quotaon
- add comments to the first remount,ro with unknown option
- fail the test if the second remount,ro failedtests/generic/082 | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/082.out | 3 +++ tests/generic/group | 1 + 3 files changed, 77 insertions(+) create mode 100755 tests/generic/082 create mode 100644 tests/generic/082.outtests/generic/082 new file +73
-0@@ -0,0 +1,73 @@ +#! /bin/bash +# FS QA Test No. 082 +# +# Test quota handling on remount ro failure +# +#----------------------------------------------------------------------- +# 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" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_test +_require_scratch +_require_quota + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 +_scratch_mount "-o usrquota,grpquota" + +# xfs doesn't need these setups and quotacheck even fails on xfs, so just +# redirect the output to $seqres.full for debug purpose and ignore the results, +# as we check the quota status later anyway. +quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1 +quotaon $SCRATCH_MNT >>$seqres.full 2>&1 + +# first remount ro with a bad option, a failed remount ro should not disable +# quota, but currently xfs doesn't fail in this case, the unknown option is +# just ignored, but quota is still on. This may change in future, let's +# re-consider the case then. +_scratch_mount "-o remount,ro,nosuchopt" >>$seqres.full 2>&1 +quotaon -p $SCRATCH_MNT | _filter_scratch +# second remount should succeed, no oops or hang expected +_scratch_mount "-o remount,ro" || _fail "second remount,ro failed" + +# success, all done +status=0 +exittests/generic/082.out new file +3
-0@@ -0,0 +1,3 @@ +QA output created by 082 +group quota on SCRATCH_MNT (SCRATCH_DEV) is on +user quota on SCRATCH_MNT (SCRATCH_DEV) is ontests/generic/group +1
-0@@ -84,6 +84,7 @@ 079 acl attr ioctl metadata auto quick 080 auto quick 081 auto quick +082 auto quick 083 rw auto enospc stress 088 perms auto quick 089 metadata autoSignature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html