# Files are created belonging to each user on the original mount of the ext4
# filesystem. They should show up as different users on the id mapped mount and
# also on the wrapfs mount if wrapfs correctly supports idmapped mounts on the
-# lower fs.
+# lower fs. This script confirms that ls -l returns the same output on wrapfs
+# and the lower fs.
SCRATCH_DEV=/dev/sdb
SCRATCH_DIR=/n/scratch
dirs="$TMP_DIR $LOWER_DIR $SCRATCH_DIR"
for d in $dirs; do
- echo checking dir $d
- if cat /proc/mounts | grep $d; then
+ if cat /proc/mounts | grep $d >/dev/null; then
runcmd umount $d
fi
done
runcmd chown ubuntu $SCRATCH_DIR/ubuntu
runcmd touch $SCRATCH_DIR/luser
runcmd chown luser $SCRATCH_DIR/luser
-ls1=$(ls -l $SCRATCH_DIR)
ubuntu=$(id -u ubuntu)
luser=$(id -u luser)
runcmd ./mount-idmapped --map-mount b:0:$ubuntu:1 --map-mount b:$ubuntu:$luser:1 --map-mount b:$luser:0:1 $SCRATCH_DIR $LOWER_DIR
runcmd mount -t wrapfs $LOWER_DIR $TMP_DIR
-if test $ret != 32; then
- echo wrapfs returned unexpected error: $ret
+
+ls1=$(ls -l $LOWER_DIR)
+ls2=$(ls -l $TMP_DIR)
+if test "$ls1" != "$ls2"; then
+ echo "$0: ERROR Wrapfs mount not respecting idmap of lower fs"
+ exit 1
else
- echo wrapfs returned correct error attempting to mount on idmapped mount
+ echo "$0: Success"
fi
-
-#ls2=$(ls -l $TMP_DIR)
-#echo $ls1
-#echo $ls2