fix truncate test so it checks for chattr ability after mounting the union
authorErez_Zadok <ezk@cs.sunysb.edu>
Thu, 12 Jul 2007 01:58:50 +0000 (21:58 -0400)
committerErez_Zadok <ezk@cs.sunysb.edu>
Thu, 12 Jul 2007 01:58:50 +0000 (21:58 -0400)
Also recheck chattr ability after each union mount.  This is because the
mount_union routine may have changed the underlying mounts to
cramfs/squashfs.

t-truncate-all.sh

index e09399c12886aea4cb5c54bdc04f8eb1e0180cec..411faa2d4618f535c170ac1e64775fc67128d3aa 100755 (executable)
@@ -51,14 +51,17 @@ dd if=/dev/zero of=$LOWER_DIR2/d1/d2/d3/d4/e bs=4000 count=2 2>/dev/null
 
 dd if=/dev/zero of=$LOWER_DIR2/d1/d2/d3/d4/f bs=4000 count=2 2>/dev/null
 
+# mount unionfs
+mount_union "" $LOWER_DIR0 $LOWER_DIR1 $LOWER_DIR2
+
+# check for chattr support after mount_union, because it may have changed
+# the underlying mounts to cramfs/squashfs.
+CHATTR=""
 if havechattr $LOWER_DIR2 ; then
        CHATTR=1
        chattr +i $LOWER_DIR2/d1/d2/d3/d4/f
 fi
 
-# mount unionfs
-mount_union "" $LOWER_DIR0 $LOWER_DIR1 $LOWER_DIR2
-
 ./progs/truncate -f $MOUNTPOINT/a 0
 
 ./progs/truncate -f $MOUNTPOINT/b 5000
@@ -92,13 +95,18 @@ dd if=/dev/zero of=$LOWER_DIR2/d bs=4000 count=2 2>/dev/null
 dd if=/dev/zero of=$LOWER_DIR2/d1/d2/d3/d4/e bs=4000 count=2 2>/dev/null
 
 dd if=/dev/zero of=$LOWER_DIR2/d1/d2/d3/d4/f bs=4000 count=2 2>/dev/null
-if [ ! -z "$CHATTR" ] ; then
-       chattr +i $LOWER_DIR2/d1/d2/d3/d4/f
-fi
 
 
 mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro $LOWER_DIR2=ro
 
+# recheck for chattr support after mount_union, because it may have changed
+# the underlying mounts to cramfs/squashfs.
+CHATTR=""
+if havechattr $LOWER_DIR2 ; then
+       CHATTR=1
+       chattr +i $LOWER_DIR2/d1/d2/d3/d4/f
+fi
+
 ./progs/truncate -f $MOUNTPOINT/a 0
 
 ./progs/truncate -f $MOUNTPOINT/b 5000