From: Fan H. <fh...@no...> - 2009-03-16 09:27:35
|
hi,CaiQian On Tue, 2009-03-17 at 04:28 +0800, CAI Qian wrote: > From: "Fan He" <fh...@no...> > Subject: Re: [LTP] [Patch 1/1] Patch for enabling the ftruncate04 testcase > Date: Mon, 16 Mar 2009 02:00:42 -0600 > > > hi,CaiQian: > > > > On Tue, 2009-03-17 at 02:57 +0800, CAI Qian wrote: > >> From: "Fan He" <fh...@no...> > >> Subject: Re: [LTP] [Patch 1/1] Patch for enabling the ftruncate04 > > testcase > >> Date: Sun, 15 Mar 2009 20:22:42 -0600 > >> > >> > hi,Cai Qian > >> > > >> > On Fri, 2009-03-13 at 11:57 +0800, CAI Qian wrote: > >> >> Hi, > >> >> > >> >> From: "Fan He" <fh...@no...> > >> >> Subject: [LTP] [Patch 1/1] Patch for enabling the ftruncate04 > > testcase > >> >> Date: Wed, 11 Mar 2009 23:20:10 -0600 > >> >> > >> >> > [Patch 1/1] Patch for enabling the ftruncate04 testcase > >> >> > > >> >> > -add mount mandatory option to enable test run. this test case > >> > doesn't > >> >> > work almost all the time we use it. > >> >> > -modified ftruncate04.c for the situation when the /tmp(or other > >> > test) > >> >> > directory is in a LVM filesystem where there are three output > > lines > >> >> > -modified ltp-full-20081031/runtest/syscalls and > >> >> > testcases/kernel/syscalls/ftruncate/Makefile > >> >> > to make this testcase can be started by the two new added script > >> >> > ftruncate.sh and ftruncate_64.sh > >> >> > > >> >> > > >> >> > > >> >> > signed-off-by : fredrick he <fh...@no...> > >> >> > >> >> > >> >> NACK. Please see coments below. > >> >> > >> >> > ----------------------------------------------------------- > >> >> > > >> >> > --- > >> >> > > >> > > > ltp-full-20081031.orig/testcases/kernel/syscalls/ftruncate/ftruncate04.c 2008-08-20 > >> >> > 18:55:21.000000000 +0800 > >> >> > +++ > >> >> > > >> > > > ltp-full-20081031/testcases/kernel/syscalls/ftruncate/ftruncate04.c 2008-12-26 > >> >> > 16:40:15.000000000 +0800 > >> >> > @@ -294,7 +294,7 @@ int main( int ac, char **av) > >> >> > > >> >> > local_flag = PASSED; > >> >> > tst_tmpdir(); > >> >> > - if (system("mount | grep `df . | grep -v Filesystem | > > awk > >> >> > {'print $1'}` | grep mand >/dev/null") != 0){ > >> >> > + if (system("mount | grep `df . | grep ^/ | awk {'print > > $1'}` | > >> >> > grep mand >/dev/null") != 0){ > >> >> > tst_resm(TCONF,"The filesystem where /tmp is > > mounted > >> >> > does" > >> >> > " not support mandatory locks. > > Cannot run > >> >> > this test."); > >> >> > tst_rmdir(); > >> >> > --- ltp-full-20081031.orig/runtest/syscalls 2008-10-23 > >> >> > 18:38:34.000000000 +0800 > >> >> > +++ ltp-full-20081031/runtest/syscalls 2008-12-26 > >> > 17:25:20.000000000 > >> >> > +0800 > >> >> > @@ -241,8 +241,8 @@ ftruncate02 ftruncate02 > >> >> > ftruncate02_64 ftruncate02_64 > >> >> > ftruncate03 ftruncate03 > >> >> > ftruncate03_64 ftruncate03_64 > >> >> > -ftruncate04 ftruncate04 > >> >> > -ftruncate04_64 ftruncate04_64 > >> >> > +ftruncate04 ftruncate.sh > >> >> > +ftruncate04_64 ftruncate_64.sh > >> >> > > >> >> > #futimesat test cases > >> >> > futimesat01 futimesat01 > >> >> > --- > >> >> > > >> > > > ltp-full-20081031.orig/testcases/kernel/syscalls/ftruncate/Makefile 2008-08-25 > >> >> > 22:10:01.000000000 +0800 > >> >> > +++ > >> >> > > >> > > > ltp-full-20081031/testcases/kernel/syscalls/ftruncate/Makefile 2008-12-29 > >> >> > 16:00:45.000000000 +0800 > >> >> > @@ -29,7 +29,10 @@ TARGETS += $(patsubst %.c,%,$(SRCS)) > >> >> > all: $(TARGETS) > >> >> > > >> >> > install: > >> >> > - @set -e; for i in $(TARGETS); do ln -f $$i > > ../../../bin/$$i ; > >> >> > done > >> >> > + @set -e; \ > >> >> > + ln -f ftruncate.sh ../../../bin/ftruncate.sh; \ > >> >> > + ln -f ftruncate_64.sh ../../../bin/ftruncate_64.sh; \ > >> >> > + for i in $(TARGETS); do install -m 755 $$i > > ../../../bin/$$i ; > >> >> > done > >> >> > > >> >> > clean: > >> >> > rm -f $(TARGETS) > >> >> > --- /dev/null 2008-06-07 03:39:59.000000000 +0800 > >> >> > +++ > >> >> > > >> > > > ltp-full-20081031/testcases/kernel/syscalls/ftruncate/ftruncate.sh 2009-03-12 > >> >> > 10:24:28.000000000 +0800 > >> >> > @@ -0,0 +1,9 @@ > >> >> > +#!/bin/sh > >> >> > + > >> >> > +cd /tmp > >> >> > +DEV=`df . |grep ^/|awk '{print $1}'` > >> >> > +mount ${DEV} -o remount,mand || exit 2 > >> >> > >> >> I suggest the test itself to print some messages out to tell users > > why > >> >> it failed. > >> >> > >> >> > +ftruncate04 > >> >> > +ret=$? > >> >> > +mount ${DEV} -o remount || exit 2 > >> >> > >> >> The command here can't restore the previous mount options. From now > >> > on, > >> >> all filesystems mounted on the system are using mandatory locking. > >> >> > >> >> # mount /dev/sda5 -o remount,mand > >> >> # mount > >> >> ... > >> >> /dev/sda5 on / type ext3 (rw,mand) > >> >> ... > >> >> # mount /dev/sda5 -o remount > >> >> # mount > >> >> ... > >> >> /dev/sda5 on / type ext3 (rw,mand) > >> >> ... > >> > does the /dev/sda5 is mount original with mand or not in your test > >> > situation? > >> > >> Not. Here is the entry in fstab, > >> > >> ... > >> /dev/sda5 / ext3 defaults 1 1 > >> ... > > > > in this case ,can the following command > > > > #mount -o remount,rw > > > > makes the mount status /dev/sda5 changed into (rw) and without mand? > > > > No, it still have "mand". > > > please help me with having a try on your test machine! > > if it works, then we can figure it out:) > > if it doesn't work,, i don't think there is any way we can change the > > flag back as before.maybe it's just a bug in the old version of mount. > > > > Why is it a bug? It looks fine according to the manpage, > > mount -o remount,rw /dir > > After this call mount reads fstab (or mtab) and merges these options > with options from command line ( -o ). > > It has merged with the options in mtab (rw,mand) in the case. Well, > there is still a way to restore original mount options if you look at > this part of manpage, > > It means the mount command doesn't read fstab (or mtab) only when a > device and dir are fully specified. > > mount -o remount,rw /dev/foo /dir > > After this call all old mount options are replaced and arbitrary stuff > from fstab is ignored, except the loop=option which is internally > generated and maintained by the mount command. > > How about doing the following in the test, > > Find out where /tmp resides > -> save the original mount options of that filesystem from mtab > -> remount by appending "mand" option > -> restore the original mount options by specifying both device > and mount point. For example, > mount -o remout,${origOptions} /dev/sda5 / > > CAI Qian oh, i do misunderstand the usage of this option. it's cool:) i rewrite the two scripts like this ----------------ftruncate.sh------------------------------------ #!/usr/bin/sh cd /tmp DEV=`df . |grep ^/|awk '{print $1}'` MOUNT_POINT=`df .| tail -1 |awk '{print $NF}'` FLAG=`mount| grep ${DEV} | sed 's/.*(\(.*\)).*/\1/g'` mount ${DEV} -o remount,mand || { echo "the ${DEV} remount,mand failed" ; exit 2;} ftruncate04 ret=$? mount ${DEV} -o remount,${FLAG} ${DEV} ${MOUNT_POINT} || { echo "the ${DEV} remount,${FLAG} failed" ; exit 2; } exit $ret ----------------------------------------------------------------- ----------------ftruncate_64.sh---------------------------------- #!/usr/bin/sh cd /tmp DEV=`df . |grep ^/|awk '{print $1}'` MOUNT_POINT=`df .| tail -1 |awk '{print $NF}'` FLAG=`mount| grep ${DEV} | sed 's/.*(\(.*\)).*/\1/g'` mount ${DEV} -o remount,mand || { echo "the ${DEV} remount,mand failed" ; exit 2;} ftruncate04_64 ret=$? mount ${DEV} -o remount,${FLAG} ${DEV} ${MOUNT_POINT} || { echo "the ${DEV} remount,${FLAG} failed" ; exit 2; } exit $ret --------------------------------> >> > the -o remount option just make the partition mounted as default > >> > and in my test machine the performance is just like the following: > >> > > >> > # mount > >> > ... > >> > /dev/sda5 on / type ext3 (rw,acl,user_xattr) > >> > ... > >> > > >> > # mount /dev/sda5 -o remount,mand > >> > # mount > >> > ... > >> > /dev/sda5 on / type ext3 (rw,mand,acl,user_xattr) > >> > ... > >> > > >> > # mount /dev/sda5 -o remount > >> > # mount > >> > ... > >> > /dev/sda5 on / type ext3 (rw,acl,user_xattr) > >> > ... > >> > > >> > >> Interesting. That is different from the behavior I have seen. I can > > see > >> that different versions of "mount" behave differently, > >> > >> "mount" from util-linux-ng-2.14.1-3.fc10 does clear "mand". The same > >> behavior as yours. > >> > >> "mount" from util-linux-2.13-0.49.el5 does not. > >> > >> Looks like we are exercising un-specified behavior using an emtpy > > optin > >> with "remount". From mount (util-linux-ng-2.14.1-3.fc10) manpage, > >> > >> remount > >> Attempt to remount an already-mounted file system. This is > >> commonly used to change the mount flags for a file system, > >> especially to make a readonly file system writeable. It does > >> not change device or mount point. > >> > >> The remount functionality follows the standard way how the > >> mount command works with options from fstab. It means the > >> mount command doesn't read fstab (or mtab) only when a device > >> and dir are fully specified. > >> > >> mount -o remount,rw /dev/foo /dir > >> > >> After this call all old mount options are replaced and > >> arbitrary stuff from fstab is ignored, except the loop= > > option > >> which is internally generated and maintained by the mount > >> command. > >> > >> mount -o remount,rw /dir > >> > >> After this call mount reads fstab (or mtab) and merges these > >> options with options from command line ( -o ). > >> > >> I can't see anything obvious to define the behavior of "remount" with > > an > >> empty option. Do you know if it has been defined somewhere else? If it > >> turns out to be a bug for the old version of "mount", I'd be happy to > >> try to fix "mount" command instead. Otherwise, I guess we'll need to > > use > >> a better approach to save the old mount options at the beginning of > > the > >> test, and restore it back at the end. > >> > >> CAI Qian > >> > >> >> > >> >> > +exit $ret > >> >> > --- /dev/null 2008-06-07 03:39:59.000000000 +0800 > >> >> > +++ > >> >> > > >> > > > ltp-full-20081031/testcases/kernel/syscalls/ftruncate/ftruncate_64.sh 2009-03-12 > >> >> > 10:24:38.000000000 +0800 > >> >> > @@ -0,0 +1,9 @@ > >> >> > +#!/bin/sh > >> >> > + > >> >> > +cd /tmp > >> >> > +DEV=`df . |grep ^/|awk '{print $1}'` > >> >> > +mount ${DEV} -o remount,mand || exit 2 > >> >> > +ftruncate04_64 > >> >> > +ret=$? > >> >> > +mount ${DEV} -o remount || exit 2 > >> >> > +exit $ret > >> >> > > >> >> > >> >> The above two comments apply to this script as well. > >> >> > >> >> CAI Qian > >> >> > >> >> > > >> >> > > >> >> > -- > >> >> > > >> >> > Fan Fredrick He (Fred) > >> >> > R&D OPS QA Beijing PRC > >> >> > Room 3603, Beijing Fortune Pl> >> > SUSE LINUX Products > >> >> > fh...@no... > >> >> > Mainland-Mobile (86) 13661278596 > >> >> > > >> >> > > >> >> > > >> > > > ------------------------------------------------------------------------------ > >> >> > Apps built with the Adobe(R) Flex(R) framework and Flex > > Builder(TM) > >> > are > >> >> > powering Web 2.0 with engaging, cross-platform capabilities. > > Quickly > >> > and > >> >> > easily build your RIAs with Flex Builder, the Eclipse(TM)based > >> > development > >> >> > software that enables intelligent coding and step-through > > debugging. > >> >> > Download the free 60 day trial. http://p.sf.> >> >> > Ltp...@li...urceforge net > >> >> > https://lists.sourceforge.net/lists/listinfo/ltp-list > >> > -- > >> > > >> > Fan Fredrick He (Fred) > >> > R&D OPS QA Beijing PRC > >> > Room 3603, Beijing Fortune Plaza, Office Tower A, No.7 Dongsanhuan > >> > Zhonglu, Chaoyang District, Beijing, P.R., 100020 > >> > SUSE LINUX Products > >> > fh...@no... > >> > Mainland-Mobile (86) 13661278596 > >> > > > -- > > > > Fan Fredrick He (Fred) > > R&D OPS QA Beijing PRC > > Room 3603, Beijing Fortune Plaza, Office Tower A, No.7 Dongsanhuan > > Zhonglu, Chaoyang District, Beijing, P.R., 100020 > > SUSE LINUX Products > > fh...@no... > > Mainland-Mobile (86) 13661278596 > > -- Fan Fredrick He (Fred) R&D OPS QA Beijing PRC Room 3603, Beijing Fortune Plaza, Office Tower A, No.7 Dongsanhuan Zhonglu, Chaoyang District, Beijing, P.R., 100020 SUSE LINUX Products fh...@no... Mainland-Mobile (86) 13661278596 |