The test covers several areas including enabling projid32bit functionality dynamically by xfs_admin, dumping, restoring, quota reporting and xfs_db projid values reporting.<br> At the time of creation, the test hit two bugs: one for broken xfsdump/xfsrestore functionality and one for enabling projid32bit functionality with xfs_admin on a LVM device (SCRATCH_DEV must be an LVM device to hit this).<br>
<br>Signed-off-by: Boris Ranto <<a href="mailto:ranto.boris@gmail.com">ranto.boris@gmail.com</a>><br>---<br> 285 | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<br> 285.out | 27 +++++++++++<br>
group | 1 +<br> 3 files changed, 179 insertions(+), 0 deletions(-)<br> create mode 100644 285<br> create mode 100644 285.out<br><br>diff --git a/285 b/285<br>new file mode 100644<br>index 0000000..c700bdf<br>--- /dev/null<br>
+++ b/285<br>@@ -0,0 +1,151 @@<br>+#! /bin/bash<br>+# FS QA Test No. 285<br>+#<br>+# Test to verify project quota xfs_admin, xfsdump/xfsrestore and<br>+# xfs_db functionality<br>+#<br>+#-----------------------------------------------------------------------<br>
+# Copyright (c) 2012 Boris Ranto. All Rights Reserved.<br>+#<br>+# This program is free software; you can redistribute it and/or<br>+# modify it under the terms of the GNU General Public License as<br>+# published by the Free Software Foundation.<br>
+#<br>+# This program is distributed in the hope that it would be useful,<br>+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>+# GNU General Public License for more details.<br>
+#<br>+# You should have received a copy of the GNU General Public License<br>+# along with this program; if not, write the Free Software Foundation,<br>+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>
+#<br>+#-----------------------------------------------------------------------<br>+#<br>+# creator<br>+owner=<a href="mailto:borix60@gnamil.com">borix60@gnamil.com</a><br>+<br>+seq=`basename $0`<br>+echo "QA output created by $seq"<br>
+tmp=/tmp/$$<br>+here=`pwd`<br>+status=1 # failure is the default!<br>+trap "_cleanup; exit \$status" 0 1 2 3 15<br>+<br>+# get standard environment, filters and checks<br>+. ./common.rc<br>+. ./common.quota<br>
+<br>+_cleanup()<br>+{<br>+ cd /<br>+ umount $SCRATCH_MNT 2>/dev/null<br>+ losetup -d $lo_dev >/dev/null 2>&1<br>+ rm -rf $tmp.*<br>+}<br>+<br>+# real QA test starts here<br>+_supported_fs xfs<br>
+_require_xfs_quota<br>+_require_scratch<br>+_require_projid32bit<br>+<br>+export MOUNT_OPTIONS="-opquota"<br>+<br>+# create xfs fs without projid32bit ability, will be gained by xfs_admin<br>+_scratch_mkfs_xfs -i projid32bit=0 -d size=200m >> $seq.full || _fail "mkfs failed"<br>
+_qmount<br>+# require project quotas<br>+_require_prjquota $SCRATCH_DEV<br>+<br>+dir=$SCRATCH_MNT/pquota<br>+<br>+status=1<br>+<br>+mkdir -p $dir<br>+touch $dir/{16,32}less<br>+inode16a=$(ls -i $dir/16less|cut -d ' ' -f 1)<br>
+inode32a=$(ls -i $dir/32less|cut -d ' ' -f 1)<br>+$XFS_QUOTA_PROG -x -c "project -s -p $dir/16less 1234" $SCRATCH_DEV \<br>+ >> $seq.full<br>+$XFS_QUOTA_PROG -x -c "project -s -p $dir/32less 2123456789" $SCRATCH_DEV \<br>
+ >> $seq.full 2>&1<br>+# These will be checked by $seq.out<br>+echo "No 32bit project quotas:"<br>+$XFS_IO_PROG -r -c "lsproj" $dir/16less<br>+$XFS_IO_PROG -r -c "lsproj" $dir/32less<br>
+<br>+umount $SCRATCH_MNT<br>+<br>+# Now, enable projid32bit support by xfs_admin<br>+xfs_admin -p $SCRATCH_DEV > /dev/null 2>&1<br>+echo "xfs_admin returned $?"<br>+<br>+# Now mount the fs, 32bit project quotas shall be supported, now<br>
+_qmount<br>+$XFS_QUOTA_PROG -x -c "project -s -p $dir/32less 2123456789" $SCRATCH_DEV \<br>+ >> $seq.full<br>+<br>+# These will be checked by $seq.out<br>+echo "With 32bit project quota support:"<br>
+$XFS_IO_PROG -r -c "lsproj" $dir/16less<br>+$XFS_IO_PROG -r -c "lsproj" $dir/32less<br>+<br>+# Dump the fs to a temporary file<br>+rm -f $tmp.dump.img<br>+$XFSDUMP_PROG -f $tmp.dump -L label -M media -l 0 $SCRATCH_MNT >> $seq.full || _fail "dump failed"<br>
+echo "xfsdump returned $?"<br>+<br>+# Prepare the device to restore the dumped file system<br>+lo_dev=$(losetup -f)<br>+lo_img=$tmp.img<br>+lo_mnt=$tmp.dir<br>+lo_dir=$lo_mnt/pquota<br>+<br>+rm -f $lo_img<br>+mkdir -p $lo_mnt<br>
+<br>+# Now, create the filesystem with projid32bit feature<br>+$XFS_IO_PROG -f -c 'truncate 1g' $lo_img<br>+losetup $lo_dev $lo_img<br>+$MKFS_XFS_PROG $lo_dev -i projid32bit=1 >> $seq.full<br>+mount $lo_dev $lo_mnt -opquota<br>
+<br>+# Restore<br>+$XFSRESTORE_PROG -f $tmp.dump $lo_mnt > /dev/null 2>&1<br>+echo "xfsrestore returned $?"<br>+<br>+# Check that they are the same<br>+diff -urpN $SCRATCH_MNT $lo_mnt<br>+echo "diff returned $?"<br>
+touch $lo_dir/32lessv2<br>+inode16b=$(ls -i $lo_dir/16less|cut -d ' ' -f 1)<br>+inode32b=$(ls -i $lo_dir/32less|cut -d ' ' -f 1)<br>+inode32v2=$(ls -i $lo_dir/32lessv2|cut -d ' ' -f 1)<br>+$XFS_QUOTA_PROG -x -c "project -s -p $lo_dir/32lessv2 2123456789" $lo_mnt \<br>
+ >> $seq.full<br>+echo "The restored file system + one additional file:"<br>+$XFS_IO_PROG -r -c "lsproj" $lo_dir/16less<br>+$XFS_IO_PROG -r -c "lsproj" $lo_dir/32less<br>+$XFS_IO_PROG -r -c "lsproj" $lo_dir/32lessv2<br>
+<br>+umount $SCRATCH_MNT<br>+umount $lo_mnt<br>+<br>+# Now, we can examine the file systems with xfs_db<br>+# These two should report the same values<br>+echo "These two values of 16bit project quota ids shall be the same"<br>
+$XFS_DB_PROG -c "inode $inode16a" -c "print core.projid_lo" -c "print core.projid_hi" $SCRATCH_DEV<br>+$XFS_DB_PROG -c "inode $inode16b" -c "print core.projid_lo" -c "print core.projid_hi" $lo_dev<br>
+<br>+# These three should report the same values<br>+echo "These three values of 32bit project quota ids shall be the same"<br>+$XFS_DB_PROG -c "inode $inode32a" -c "print core.projid_lo" -c "print core.projid_hi" $SCRATCH_DEV<br>
+$XFS_DB_PROG -c "inode $inode32b" -c "print core.projid_lo" -c "print core.projid_hi" $lo_dev<br>+$XFS_DB_PROG -c "inode $inode32v2" -c "print core.projid_lo" -c "print core.projid_hi" $lo_dev<br>
+<br>+losetup -d $lo_dev<br>+rm -f $lo_img<br>+<br>+status=0<br>+exit<br>diff --git a/285.out b/285.out<br>new file mode 100644<br>index 0000000..a601452<br>--- /dev/null<br>+++ b/285.out<br>@@ -0,0 +1,27 @@<br>+QA output created by 285<br>
+No 32bit project quotas:<br>+projid = 1234<br>+projid = 0<br>+xfs_admin returned 0<br>+With 32bit project quota support:<br>+projid = 1234<br>+projid = 2123456789<br>+xfsdump returned 0<br>+xfsrestore returned 0<br>+diff returned 0<br>
+The restored file system + one additional file:<br>+projid = 1234<br>+projid = 2123456789<br>+projid = 2123456789<br>+These two values of 16bit project quota ids shall be the same<br>+core.projid_lo = 1234<br>+core.projid_hi = 0<br>
+core.projid_lo = 1234<br>+core.projid_hi = 0<br>+These three values of 32bit project quota ids shall be the same<br>+core.projid_lo = 24853<br>+core.projid_hi = 32401<br>+core.projid_lo = 24853<br>+core.projid_hi = 32401<br>
+core.projid_lo = 24853<br>+core.projid_hi = 32401<br>diff --git a/group b/group<br>index 104ed35..bbc74fe 100644<br>--- a/group<br>+++ b/group<br>@@ -403,3 +403,4 @@ deprecated<br> 282 dump ioctl auto quick<br> 283 dump ioctl auto quick<br>
284 auto<br>+285 auto dump quota<br>-- <br>1.7.1<br><br>