On Tue 17-02-09 14:07:33, Subrata Modak wrote:
> Hi Jan,
>
> I apolozise for holding this script. I had done a basic porting to LTP. Please
> see the results on executing on kernels below and above 2.6.26.
Yes, the test looks fine. Thanks for porting.
Honza
> # uname -a
> Linux 2.6.27.15-2-default #1 SMP 2009-02-09 15:38:31 +0100 x86_64 x86_64
> x86_64 GNU/Linux
>
> <<<test_start>>>
> tag=quota_remount_test01 stime=1234854977
> cmdline="quota_remount_test01.sh"
> contacts=""
> analysis=exit
> initiation_status="ok"
> <<<test_output>>>
> incrementing stop
> quota_remount_test01 0 INFO : Successfully mounted the File System
> quota_remount_test01 0 INFO : Successfully Created Quota Files
> quota_remount_test01 0 INFO : Successfully Turned on Quota
> quota_remount_test01 0 INFO : Successfully wrote to the filesystem
> quota_remount_test01 0 INFO : Successfully Remounted Read-Only FS
> quota_remount_test01 0 INFO : Successfully Remounted Read-Write FS
> quota_remount_test01 0 INFO : Usage successfully Changed after Remount
> quota_remount_test01 1 PASS : Quota on Remount Successfull
> <<<execution_status>>>
> duration=1 termination_type=exited termination_id=0 corefile=no
> cutime=2 cstime=18
> <<<test_end>>>
>
>
> $ uname -a
> Linux 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386
> GNU/Linux
>
> <<<test_start>>>
> tag=quota_remount_test01 stime=1234859369
> cmdline="quota_remount_test01.sh"
> contacts=""
> analysis=exit
> initiation_status="ok"
> <<<test_output>>>
> incrementing stop
> quota_remount_test01 1 CONF : Remounting with quotas enabled is not
> supported!
> quota_remount_test01 1 CONF : You should have kernel 2.6.26 and above
> running.....
> <<<execution_status>>>
> duration=0 termination_type=exited termination_id=0 corefile=no
> cutime=0 cstime=0
> <<<test_end>>>
>
> Thanks for contributing this test to LTP.
>
> On Thu, 2008-09-18 at 23:03 +0200, Jan Kara wrote:
> Hello Subrata,
> >
> > On Tue 26-08-08 17:26:30, Subrata Modak wrote:
> > > On Tue, 2008-08-26 at 13:40 +0200, Jan Kara wrote:
> > > > Hello,
> > > >
> > > > On Tue 26-08-08 15:38:01, Subrata Modak wrote:
> > > > > The Commit logs for 2.6.26 for quota: quota core changes for quotaon
> > > > > on
> > > > > remount says:
> > > > > .......
> > > > > Currently, we just turn quotas off on remount of filesystem to
> > > > > read-only
> > > > > state. The patch below adds necessary framework so that we can turn
> > > > > quotas
> > > > > off on remount RO but we are able to automatically reenable them
> > > > > again when
> > > > > filesystem is remounted to RW state. All we need to do is to keep
> > > > > references
> > > > > to inodes of quota files when remounting RO and using these
> > > > > references to
> > > > > reenable quotas when remounting RW.
> > > > > ..........
> > > > >
> > > > > Did you develop/write test cases to test these scenario ? Would it be
> > > > > possible for you to share those tests with LTP under GPLv2 ?
> > > > I've tested it only by hand. Something along the lines:
> > > >
> > > > mount -t ext3 -o loop,usrquota,grpquota test_image /mnt
> > > > quotaon -avug
> > > > mount -o remount,ro /mnt
> > > > mount -o remount,rw /mnt
> > > > <check that quota still works by writing to the fs and checking output
> > > > of
> > > > quota(1)>
> > > >
> > > > I can script it for you sometime next week if you'd like.
> > >
> > > That would be really great. You can send the script to the ltp mailing
> > > list. What i would like the script to have is to:
> > >
> > > 1) Mention, if the user needs to do some special setup before executing
> > > the script,
> > > 2) Script should be able to detect whether the feature it is trying to
> > > test is available in the underlying kernel, and say a good bye
> > > accordingly,
> > > 3) Return 0 on success, else any other value(s) on un-successful exit.
> > >
> > > These will be required for the LTP engine to run the script, so that it
> > > can be very easily accommodated under our Automated test run
> > > environment. Thank you very much.
> > Below is the script which should test what you want. Enjoy.
> >
>
> Signed-Off-By: Subrata Modak <[email protected]>
> ---
>
> diff -uprN ltp-intermediate-20090217.orig/runtest/fs
> ltp-intermediate-20090217/runtest/fs
> --- ltp-intermediate-20090217.orig/runtest/fs 2009-02-17 12:12:23.000000000
> +0530
> +++ ltp-intermediate-20090217/runtest/fs 2009-02-17 12:45:19.000000000
> +0530
> @@ -75,3 +75,5 @@ proc01 proc01
> #Run the File System Race Condition Check tests as well
> fs_racer fs_racer.sh -t 5
>
> +#Run the Quota Remount Test introduced in linux-2.6.26
> +quota_remount_test01 quota_remount_test01.sh
> diff -uprN ltp-intermediate-20090217.orig/testcases/kernel/fs/Makefile
> ltp-intermediate-20090217/testcases/kernel/fs/Makefile
> --- ltp-intermediate-20090217.orig/testcases/kernel/fs/Makefile
> 2009-02-17 12:12:23.000000000 +0530
> +++ ltp-intermediate-20090217/testcases/kernel/fs/Makefile 2009-02-17
> 12:57:29.000000000 +0530
> @@ -1,4 +1,4 @@
> -SUBDIRS = acls doio fs_inod fsstress fs_perms fsx-linux ftest inode lftest
> linktest openfile proc stream fs_di fs_bind racer
> +SUBDIRS = acls doio fs_inod fsstress fs_perms fsx-linux ftest inode lftest
> linktest openfile proc stream fs_di fs_bind racer quota_remount
>
> all:
> @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i ; done
> diff -uprN
> ltp-intermediate-20090217.orig/testcases/kernel/fs/quota_remount/Makefile
> ltp-intermediate-20090217/testcases/kernel/fs/quota_remount/Makefile
> --- ltp-intermediate-20090217.orig/testcases/kernel/fs/quota_remount/Makefile
> 1970-01-01 05:30:00.000000000 +0530
> +++ ltp-intermediate-20090217/testcases/kernel/fs/quota_remount/Makefile
> 2009-02-17 12:18:21.000000000 +0530
> @@ -0,0 +1,26 @@
> +################################################################################
> +##
> ##
> +## Copyright (c) International Business Machines Corp., 2009
> ##
> +##
> ##
> +## 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; either version 2 of the License, or
> ##
> +## (at your option) any later version.
> ##
> +##
> ##
> +## This program is distributed in the hope that it will 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 to the Free Software
> ##
> +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> ##
> +##
> ##
> +################################################################################
> +
> +all:
> +
> +install:
> + @ln -f quota_remount_test01.sh ../../../bin/;
> +
> +clean:
> diff -uprN
> ltp-intermediate-20090217.orig/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
>
> ltp-intermediate-20090217/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
> ---
> ltp-intermediate-20090217.orig/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
> 1970-01-01 05:30:00.000000000 +0530
> +++
> ltp-intermediate-20090217/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
> 2009-02-17 13:52:32.000000000 +0530
> @@ -0,0 +1,108 @@
> +################################################################################
> +##
> ##
> +## Copyright (c) Jan Kara <[email protected]>, 2008
> ##
> +## Copyright (c) International Business Machines Corp., 2009
> ##
> +##
> ##
> +## 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; either version 2 of the License, or
> ##
> +## (at your option) any later version.
> ##
> +##
> ##
> +## This program is distributed in the hope that it will 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 to the Free Software
> ##
> +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> ##
> +##
> ##
> +################################################################################
> +#
> ##
> +# File : quota_remount_test01.sh
> ##
> +#
> ##
> +# Description: Test whether kernel properly supports remounting read-only
> ##
> +# with quota
> ##
> +#
> ##
> +# Author: Jan Kara <[email protected]>,
> ##
> +#
> ##
> +# History: Sep 18 2008 - Created - Jan Kara <[email protected]>.
> ##
> +# Feb 17 2009 - Ported to LTP,
> ##
> +# Subrata Modak <[email protected]>
> ##
> +################################################################################
> +#!/bin/bash
> +
> +export TCID=quota_remount_test01
> +export TST_TOTAL=1
> +export TST_COUNT=0
> +
> +TMPDIR=/tmp
> +MNTDIR=$TMPDIR/mnt
> +
> +uname -r | {
> + IFS='.-'
> + read MAJOR MINOR RELEASE REST
> + if [ "$MAJOR" -lt 2 -o "$MINOR" -lt 6 -o "$RELEASE" -lt 26 ]; then
> + exit 1
> + fi
> + exit 0; }
> +if [ $? -gt 0 ]; then
> + tst_resm TCONF "Remounting with quotas enabled is not supported!"
> + tst_resm TCONF "You should have kernel 2.6.26 and above running....."
> + exit 0
> +fi
> +
> +if [ ! -d /proc/sys/fs/quota ]; then
> + tst_resm TCONF "Quota not supported in kernel!"
> + exit 0
> +fi
> +
> +function die()
> +{
> + echo >&2 $2
> + umount 2>/dev/null $MNTDIR
> + rm 2>/dev/null $IMAGE
> + rmdir 2>/dev/null $MNTDIR
> + tst_resm TFAIL "Quota on Remount Failed"
> + exit $1
> +}
> +
> +cd $TMPDIR || die 2 "Cannot cd to $TMPDIR"
> +IMAGE=ltp-$$-fs-image
> +dd if=/dev/zero of=$IMAGE bs=4096 count=8000 2>/dev/null || die 2 "Cannot
> create filesystem image"
> +mkfs.ext3 -q -F -b 4096 $IMAGE || die 2 "Could not create the filesystem"
> +mkdir $MNTDIR || die 2 "Could not create the mountpoint"
> +mount -t ext3 -o loop,usrquota,grpquota $IMAGE $MNTDIR || die 2 "Could not
> mount the filesystem"
> +tst_resm TINFO "Successfully mounted the File System"
> +
> +quotacheck -cug $MNTDIR || die 2 "Could not create quota files"
> +tst_resm TINFO "Successfully Created Quota Files"
> +
> +quotaon -ug $MNTDIR || die 2 "Could not turn quota on"
> +tst_resm TINFO "Successfully Turned on Quota"
> +
> +echo "blah" >$MNTDIR/file || die 2 "Could not write to the filesystem"
> +tst_resm TINFO "Successfully wrote to the filesystem"
> +
> +# Get current quota usage
> +BLOCKS=`quota -f $MNTDIR -v -w | tail -1 | sed -e 's/ *[^ ]* *\([0-9]*\)
> .*/\1/'`
> +mount -o remount,ro $MNTDIR || die 1 "Could not remount read-only"
> +tst_resm TINFO "Successfully Remounted Read-Only FS"
> +
> +mount -o remount,rw $MNTDIR || die 2 "Could not remount read-write"
> +tst_resm TINFO "Successfully Remounted Read-Write FS"
> +
> +rm $MNTDIR/file
> +# Get quota usage after removing the file
> +NEWBLOCKS=`quota -f $MNTDIR -v -w | tail -1 | sed -e 's/ *[^ ]* *\([0-9]*\)
> .*/\1/'`
> +# Has quota usage changed properly?
> +if [ $BLOCKS -eq $NEWBLOCKS ]; then
> + die 1 "Usage did not change after remount"
> +fi
> +tst_resm TINFO "Usage successfully Changed after Remount"
> +tst_resm TPASS "Quota on Remount Successfull"
> +
> +umount $MNTDIR || die 2 "Could not umount $MNTDIR"
> +rmdir $MNTDIR || die 2 "Could not remove $MNTDIR"
> +rm $IMAGE
> +exit 0
>
> --
> Regards--
> Subrata
>
--
Jan Kara <[email protected]>
SUSE Labs, CR
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list