From: Subrata <sub...@us...> - 2009-02-18 07:36:55
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs/quota_remount In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1616/ltp/testcases/kernel/fs/quota_remount Added Files: Makefile quota_remount_test01.sh Log Message: Linux-2.6.26 introduced a new feature for Quota on Remount for RO Fs. This test cases will test that feature. For more info, please see: http://kernelnewbies.org/Linux_2_6_26, and, http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ff5af8340aa6be44220d7237ef4a654314cf795. Signed-Off-By: Jan Kara <ja...@su...>. Ported-To-Ltp-By: Subrata Modak <su...@li...>. --- NEW FILE: Makefile --- ################################################################################ ## ## ## 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: --- NEW FILE: quota_remount_test01.sh --- ################################################################################ ## ## ## Copyright (c) Jan Kara <ja...@su...>, 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. This feature was added in kernel 2.6.26. Please ## # see: http://kernelnewbies.org/Linux_2_6_26, and ## # http://git.kernel.org/git/?p=linux/kernel/git/torvalds/ ## # linux-2.6.git;a=commit; ## # h=0ff5af8340aa6be44220d7237ef4a654314cf795 ## # for more info. ## # ## # Author: Jan Kara <ja...@su...>, ## # ## # History: Sep 18 2008 - Created - Jan Kara <ja...@su...>. ## # Feb 17 2009 - Ported to LTP, ## # Subrata Modak <su...@li...> ## ################################################################################ #!/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 |