* [PATCH] New testcase to check if fallocate respects RLIMIT_FSIZE or not [not found] ` <20100501101846.GA3769@infradead.org> @ 2010-05-03 8:31 ` Amit K. Arora 2010-05-04 20:44 ` Eric Sandeen 0 siblings, 1 reply; 4+ messages in thread From: Amit K. Arora @ 2010-05-03 8:31 UTC (permalink / raw) To: Christoph Hellwig Cc: Nick Piggin, Andreas Dilger, Eelis, Theodore Ts'o, Nikanth Karthikesan, coly.li, Amit Arora, xfs, Alexander Viro, linux-fsdevel, Andrew Morton, linux-ext4 On Sat, May 01, 2010 at 06:18:46AM -0400, Christoph Hellwig wrote: > On Sat, May 01, 2010 at 12:34:26PM +0530, Amit K. Arora wrote: > > Agreed. How about doing this check in the filesystem specific fallocate > > inode routines instead ? For example, in ext4 we could do : > > That looks okay - in fact XFS should already have this check because > it re-uses the setattr implementation to set the size. > > Can you submit an xfstests testcase to verify this behaviour on all > filesystems? Here is the new testcase. I have run this test on a x86_64 box on XFS and ext4 on 2.6.34-rc6. It passes on XFS, but fails on ext4. Below is the snapshot of results followed by the testcase itself. -- Regards, Amit Arora Test results: ------------ # ./check 228 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 elm9m93 2.6.34-rc6 228 0s ... Ran: 228 Passed all 1 tests # # umount /mnt # mkfs.ext4 /dev/sda4 >/dev/null mke2fs 1.41.10 (10-Feb-2009) # ./check 228 FSTYP -- ext4 PLATFORM -- Linux/x86_64 elm9m93 2.6.34-rc6 228 0s ... - output mismatch (see 228.out.bad) --- 228.out 2010-05-03 02:51:24.000000000 -0400 +++ 228.out.bad 2010-05-03 04:27:33.000000000 -0400 @@ -1,2 +1 @@ QA output created by 228 -File size limit exceeded (core dumped) Ran: 228 Failures: 228 Failed 1 of 1 tests # Here is the test: ---------------- Add a new testcase to the xfstests suite to check if fallocate respects the limit imposed by RLIMIT_FSIZE (can be set by "ulimit -f XXX") or not, on a particular filesystem. Signed-off-by: Amit Arora <aarora@in.ibm.com> diff -Nuarp xfstests-dev.org/228 xfstests-dev/228 --- xfstests-dev.org/228 1969-12-31 19:00:00.000000000 -0500 +++ xfstests-dev/228 2010-05-03 02:45:10.000000000 -0400 @@ -0,0 +1,79 @@ +#! /bin/bash +# FS QA Test No. 228 +# +# Check if fallocate respects RLIMIT_FSIZE +# +#----------------------------------------------------------------------- +# Copyright (c) 2010 IBM Corporation. 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 +# +#----------------------------------------------------------------------- +# +# creator +owner=aarora@in.ibm.com + +seq=`basename $0` +echo "QA output created by $seq" + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +here=`pwd` +tmp=$TEST_DIR/$$ +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.filter + +# real QA test starts here +# generic, but xfs_io's fallocate must work +_supported_fs generic +# only Linux supports fallocate +_supported_os Linux + +[ -n "$XFS_IO_PROG" ] || _notrun "xfs_io executable not found" + +rm -f $seq.full + +# Sanity check to see if fallocate works +_require_xfs_io_falloc + +# Check if we have good enough space available +avail=`df -P $TEST_DIR | awk 'END {print $4}'` +[ "$avail" -ge 104000 ] || _notrun "Test device is too small ($avail KiB)" + +# Set the FSIZE ulimit to 100MB and check +ulimit -f 102400 +flim=`ulimit -f` +[ "$flim" != "unlimited" ] || _notrun "Unable to set FSIZE ulimit" +[ "$flim" -eq 102400 ] || _notrun "FSIZE ulimit is not correct (100 MB)" + +# FSIZE limit is now set to 100 MB. +# Lets try to preallocate 101 MB. This should fail. +$XFS_IO_PROG -F -f -c 'falloc 0 101m' $TEST_DIR/ouch +rm -f $TEST_DIR/ouch + +# Lets now try to preallocate 50 MB. This should succeed. +$XFS_IO_PROG -F -f -c 'falloc 0 50m' $TEST_DIR/ouch +rm -f $TEST_DIR/ouch + +# success, all done +status=0 +exit diff -Nuarp xfstests-dev.org/group xfstests-dev/group --- xfstests-dev.org/group 2010-05-03 02:35:09.000000000 -0400 +++ xfstests-dev/group 2010-05-03 02:45:21.000000000 -0400 @@ -341,3 +341,4 @@ deprecated 225 auto quick 226 auto enospc 227 auto fsr +228 rw auto prealloc quick _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] New testcase to check if fallocate respects RLIMIT_FSIZE or not 2010-05-03 8:31 ` [PATCH] New testcase to check if fallocate respects RLIMIT_FSIZE or not Amit K. Arora @ 2010-05-04 20:44 ` Eric Sandeen 2010-05-05 7:55 ` [PATCH v2] " Amit K. Arora 0 siblings, 1 reply; 4+ messages in thread From: Eric Sandeen @ 2010-05-04 20:44 UTC (permalink / raw) To: Amit K. Arora Cc: Nick Piggin, Andreas Dilger, Eelis, Theodore Ts'o, Nikanth Karthikesan, coly.li, Amit Arora, xfs, Christoph Hellwig, Alexander Viro, linux-fsdevel, Andrew Morton, linux-ext4 Amit K. Arora wrote: > On Sat, May 01, 2010 at 06:18:46AM -0400, Christoph Hellwig wrote: >> On Sat, May 01, 2010 at 12:34:26PM +0530, Amit K. Arora wrote: >>> Agreed. How about doing this check in the filesystem specific fallocate >>> inode routines instead ? For example, in ext4 we could do : >> That looks okay - in fact XFS should already have this check because >> it re-uses the setattr implementation to set the size. >> >> Can you submit an xfstests testcase to verify this behaviour on all >> filesystems? > > Here is the new testcase. Thanks! A few comments... > I have run this test on a x86_64 box on XFS and ext4 on 2.6.34-rc6. It > passes on XFS, but fails on ext4. Below is the snapshot of results > followed by the testcase itself. > > -- > Regards, > Amit Arora > > Test results: > ------------ > # ./check 228 > FSTYP -- xfs (non-debug) > PLATFORM -- Linux/x86_64 elm9m93 2.6.34-rc6 > > 228 0s ... > Ran: 228 > Passed all 1 tests > # > # umount /mnt > # mkfs.ext4 /dev/sda4 >/dev/null > mke2fs 1.41.10 (10-Feb-2009) > # ./check 228 > FSTYP -- ext4 > PLATFORM -- Linux/x86_64 elm9m93 2.6.34-rc6 > > 228 0s ... - output mismatch (see 228.out.bad) > --- 228.out 2010-05-03 02:51:24.000000000 -0400 > +++ 228.out.bad 2010-05-03 04:27:33.000000000 -0400 > @@ -1,2 +1 @@ > QA output created by 228 > -File size limit exceeded (core dumped) > Ran: 228 > Failures: 228 > Failed 1 of 1 tests > # 228.out is missing from the patch Also on my fedora box I don't get a coredump by default; can you either make that explicit, or filter out the core message? > > Here is the test: > ---------------- > Add a new testcase to the xfstests suite to check if fallocate respects > the limit imposed by RLIMIT_FSIZE (can be set by "ulimit -f XXX") or > not, on a particular filesystem. ... > +# get standard environment, filters and checks > +. ./common.rc > +. ./common.filter Nitpick, I don't think you need common.filter, doesn't look like you are using it. > +# FSIZE limit is now set to 100 MB. > +# Lets try to preallocate 101 MB. This should fail. > +$XFS_IO_PROG -F -f -c 'falloc 0 101m' $TEST_DIR/ouch > +rm -f $TEST_DIR/ouch > + > +# Lets now try to preallocate 50 MB. This should succeed. > +$XFS_IO_PROG -F -f -c 'falloc 0 50m' $TEST_DIR/ouch > +rm -f $TEST_DIR/ouch Even more nitpicky, but sometimes I think it's nice to have the .out file be a bit more descriptive in and of itself so when you see a failing diff you have a better idea what's gone wrong. Changing the comments to echos, like: +# FSIZE limit is now set to 100 MB. +# echo "Lets try to preallocate 101 MB. This should fail." +$XFS_IO_PROG -F -f -c 'falloc 0 101m' $TEST_DIR/ouch +rm -f $TEST_DIR/ouch etc ... would make a failure look like: --- 228.out 2010-05-04 15:42:31.924278768 -0500 +++ 228.out.bad 2010-05-04 15:42:36.961278392 -0500 @@ -1,3 +1,2 @@ QA output created by 228 Lets try to preallocate 101 MB. This should fail. -File size limit exceeded Lets now try to preallocate 50 MB. This should succeed. ... just a thought. Thanks, -Eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] New testcase to check if fallocate respects RLIMIT_FSIZE or not 2010-05-04 20:44 ` Eric Sandeen @ 2010-05-05 7:55 ` Amit K. Arora 2010-05-05 15:50 ` Eric Sandeen 0 siblings, 1 reply; 4+ messages in thread From: Amit K. Arora @ 2010-05-05 7:55 UTC (permalink / raw) To: Eric Sandeen Cc: Nick Piggin, Andreas Dilger, Eelis, Theodore Ts'o, Nikanth Karthikesan, coly.li, Amit Arora, xfs, Christoph Hellwig, Alexander Viro, linux-fsdevel, Andrew Morton, linux-ext4 On Tue, May 04, 2010 at 03:44:08PM -0500, Eric Sandeen wrote: > Amit K. Arora wrote: > > Here is the new testcase. > Thanks! A few comments... Thanks for the review! > 228.out is missing from the patch Ok, added it in the new patch. > Also on my fedora box I don't get a coredump by default; can > you either make that explicit, or filter out the core message? Hmm.. for some strange reason I am no longer seeing this message. Tried on the same system as last time and couple of others also. > > > > Here is the test: > > ---------------- > > Add a new testcase to the xfstests suite to check if fallocate respects > > the limit imposed by RLIMIT_FSIZE (can be set by "ulimit -f XXX") or > > not, on a particular filesystem. > > ... > > > +# get standard environment, filters and checks > > +. ./common.rc > > +. ./common.filter > > Nitpick, I don't think you need common.filter, doesn't look like you are > using it. Right. Removed it.. > > +# FSIZE limit is now set to 100 MB. > > +# Lets try to preallocate 101 MB. This should fail. > > +$XFS_IO_PROG -F -f -c 'falloc 0 101m' $TEST_DIR/ouch > > +rm -f $TEST_DIR/ouch > > + > > +# Lets now try to preallocate 50 MB. This should succeed. > > +$XFS_IO_PROG -F -f -c 'falloc 0 50m' $TEST_DIR/ouch > > +rm -f $TEST_DIR/ouch > > Even more nitpicky, but sometimes I think it's nice to have the .out > file be a bit more descriptive in and of itself so when you see a > failing diff you have a better idea what's gone wrong. Agreed. Done. Here is the new patch with the changes: Add a new testcase to the xfstests suite to check if fallocate respects the limit imposed by RLIMIT_FSIZE (can be set by "ulimit -f XXX") or not, on a particular filesystem. Signed-off-by: Amit Arora <aarora@in.ibm.com> diff -Nuarp xfstests-dev.org/228 xfstests-dev/228 --- xfstests-dev.org/228 1969-12-31 19:00:00.000000000 -0500 +++ xfstests-dev/228 2010-05-05 02:37:48.000000000 -0400 @@ -0,0 +1,79 @@ +#! /bin/bash +# FS QA Test No. 228 +# +# Check if fallocate respects RLIMIT_FSIZE +# +#----------------------------------------------------------------------- +# Copyright (c) 2010 IBM Corporation. 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 +# +#----------------------------------------------------------------------- +# +# creator +owner=aarora@in.ibm.com + +seq=`basename $0` +echo "QA output created by $seq" + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +here=`pwd` +tmp=$TEST_DIR/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 25 + +# get standard environment, filters and checks +. ./common.rc + +# real QA test starts here +# generic, but xfs_io's fallocate must work +_supported_fs generic +# only Linux supports fallocate +_supported_os Linux + +[ -n "$XFS_IO_PROG" ] || _notrun "xfs_io executable not found" + +rm -f $seq.full + +# Sanity check to see if fallocate works +_require_xfs_io_falloc + +# Check if we have good enough space available +avail=`df -P $TEST_DIR | awk 'END {print $4}'` +[ "$avail" -ge 104000 ] || _notrun "Test device is too small ($avail KiB)" + +# Set the FSIZE ulimit to 100MB and check +ulimit -f 102400 +flim=`ulimit -f` +[ "$flim" != "unlimited" ] || _notrun "Unable to set FSIZE ulimit" +[ "$flim" -eq 102400 ] || _notrun "FSIZE ulimit is not correct (100 MB)" + +echo "File size limit is now set to 100 MB." +echo "Let us try to preallocate 101 MB. This should fail." +$XFS_IO_PROG -F -f -c 'falloc 0 101m' $TEST_DIR/ouch +rm -f $TEST_DIR/ouch + +echo "Let us now try to preallocate 50 MB. This should succeed." +$XFS_IO_PROG -F -f -c 'falloc 0 50m' $TEST_DIR/ouch +rm -f $TEST_DIR/ouch + +echo "Test over." +# success, all done +status=0 +exit diff -Nuarp xfstests-dev.org/228.out xfstests-dev/228.out --- xfstests-dev.org/228.out 1969-12-31 19:00:00.000000000 -0500 +++ xfstests-dev/228.out 2010-05-05 02:38:30.000000000 -0400 @@ -0,0 +1,6 @@ +QA output created by 228 +File size limit is now set to 100 MB. +Let us try to preallocate 101 MB. This should fail. +File size limit exceeded +Let us now try to preallocate 50 MB. This should succeed. +Test over. diff -Nuarp xfstests-dev.org/group xfstests-dev/group --- xfstests-dev.org/group 2010-05-03 02:35:09.000000000 -0400 +++ xfstests-dev/group 2010-05-05 02:38:00.000000000 -0400 @@ -341,3 +341,4 @@ deprecated 225 auto quick 226 auto enospc 227 auto fsr +228 rw auto prealloc quick _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] New testcase to check if fallocate respects RLIMIT_FSIZE or not 2010-05-05 7:55 ` [PATCH v2] " Amit K. Arora @ 2010-05-05 15:50 ` Eric Sandeen 0 siblings, 0 replies; 4+ messages in thread From: Eric Sandeen @ 2010-05-05 15:50 UTC (permalink / raw) To: Amit K. Arora Cc: Nick Piggin, Andreas Dilger, Eelis, Theodore Ts'o, Nikanth Karthikesan, coly.li, Amit Arora, xfs, Christoph Hellwig, Alexander Viro, linux-fsdevel, Andrew Morton, linux-ext4 On 05/05/2010 02:55 AM, Amit K. Arora wrote: > On Tue, May 04, 2010 at 03:44:08PM -0500, Eric Sandeen wrote: >> Amit K. Arora wrote: >>> Here is the new testcase. >> Thanks! A few comments... > Thanks for the review! Sure thing - looks good, I'll merge it after a retest if it all goes well. :) -Eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-05 15:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201004281854.49730.knikanth@suse.de>
[not found] ` <4BD85F1F.7030100@suse.de>
[not found] ` <201004291014.07194.knikanth@suse.de>
[not found] ` <20100430143319.d51d6d77.akpm@linux-foundation.org>
[not found] ` <20100501070426.GA9562@amitarora.in.ibm.com>
[not found] ` <20100501101846.GA3769@infradead.org>
2010-05-03 8:31 ` [PATCH] New testcase to check if fallocate respects RLIMIT_FSIZE or not Amit K. Arora
2010-05-04 20:44 ` Eric Sandeen
2010-05-05 7:55 ` [PATCH v2] " Amit K. Arora
2010-05-05 15:50 ` Eric Sandeen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox