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 &lt;<a href="mailto:ranto.boris@gmail.com">ranto.boris@gmail.com</a>&gt;<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 &quot;QA output created by $seq&quot;<br>
+tmp=/tmp/$$<br>+here=`pwd`<br>+status=1    # failure is the default!<br>+trap &quot;_cleanup; exit \$status&quot; 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&gt;/dev/null<br>+    losetup -d $lo_dev &gt;/dev/null 2&gt;&amp;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=&quot;-opquota&quot;<br>+<br>+# create xfs fs without projid32bit ability, will be gained by xfs_admin<br>+_scratch_mkfs_xfs -i projid32bit=0 -d size=200m &gt;&gt; $seq.full || _fail &quot;mkfs failed&quot;<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 &#39; &#39; -f 1)<br>
+inode32a=$(ls -i $dir/32less|cut -d &#39; &#39; -f 1)<br>+$XFS_QUOTA_PROG -x -c &quot;project -s -p $dir/16less 1234&quot; $SCRATCH_DEV \<br>+        &gt;&gt; $seq.full<br>+$XFS_QUOTA_PROG -x -c &quot;project -s -p $dir/32less 2123456789&quot; $SCRATCH_DEV \<br>
+        &gt;&gt; $seq.full 2&gt;&amp;1<br>+# These will be checked by $seq.out<br>+echo &quot;No 32bit project quotas:&quot;<br>+$XFS_IO_PROG -r -c &quot;lsproj&quot; $dir/16less<br>+$XFS_IO_PROG -r -c &quot;lsproj&quot; $dir/32less<br>
+<br>+umount $SCRATCH_MNT<br>+<br>+# Now, enable projid32bit support by xfs_admin<br>+xfs_admin -p $SCRATCH_DEV &gt; /dev/null 2&gt;&amp;1<br>+echo &quot;xfs_admin returned $?&quot;<br>+<br>+# Now mount the fs, 32bit project quotas shall be supported, now<br>
+_qmount<br>+$XFS_QUOTA_PROG -x -c &quot;project -s -p $dir/32less 2123456789&quot; $SCRATCH_DEV \<br>+        &gt;&gt; $seq.full<br>+<br>+# These will be checked by $seq.out<br>+echo &quot;With 32bit project quota support:&quot;<br>
+$XFS_IO_PROG -r -c &quot;lsproj&quot; $dir/16less<br>+$XFS_IO_PROG -r -c &quot;lsproj&quot; $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 &gt;&gt; $seq.full  || _fail &quot;dump failed&quot;<br>
+echo &quot;xfsdump returned $?&quot;<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 &#39;truncate 1g&#39; $lo_img<br>+losetup $lo_dev $lo_img<br>+$MKFS_XFS_PROG $lo_dev -i projid32bit=1 &gt;&gt; $seq.full<br>+mount $lo_dev $lo_mnt -opquota<br>
+<br>+# Restore<br>+$XFSRESTORE_PROG -f $tmp.dump $lo_mnt &gt; /dev/null 2&gt;&amp;1<br>+echo &quot;xfsrestore returned $?&quot;<br>+<br>+# Check that they are the same<br>+diff -urpN $SCRATCH_MNT $lo_mnt<br>+echo &quot;diff returned $?&quot;<br>
+touch $lo_dir/32lessv2<br>+inode16b=$(ls -i $lo_dir/16less|cut -d &#39; &#39; -f 1)<br>+inode32b=$(ls -i $lo_dir/32less|cut -d &#39; &#39; -f 1)<br>+inode32v2=$(ls -i $lo_dir/32lessv2|cut -d &#39; &#39; -f 1)<br>+$XFS_QUOTA_PROG -x -c &quot;project -s -p $lo_dir/32lessv2 2123456789&quot; $lo_mnt \<br>
+        &gt;&gt; $seq.full<br>+echo &quot;The restored file system + one additional file:&quot;<br>+$XFS_IO_PROG -r -c &quot;lsproj&quot; $lo_dir/16less<br>+$XFS_IO_PROG -r -c &quot;lsproj&quot; $lo_dir/32less<br>+$XFS_IO_PROG -r -c &quot;lsproj&quot; $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 &quot;These two values of 16bit project quota ids shall be the same&quot;<br>
+$XFS_DB_PROG -c &quot;inode $inode16a&quot; -c &quot;print core.projid_lo&quot; -c &quot;print core.projid_hi&quot; $SCRATCH_DEV<br>+$XFS_DB_PROG -c &quot;inode $inode16b&quot; -c &quot;print core.projid_lo&quot; -c &quot;print core.projid_hi&quot; $lo_dev<br>
+<br>+# These three should report the same values<br>+echo &quot;These three values of 32bit project quota ids shall be the same&quot;<br>+$XFS_DB_PROG -c &quot;inode $inode32a&quot; -c &quot;print core.projid_lo&quot; -c &quot;print core.projid_hi&quot; $SCRATCH_DEV<br>
+$XFS_DB_PROG -c &quot;inode $inode32b&quot; -c &quot;print core.projid_lo&quot; -c &quot;print core.projid_hi&quot; $lo_dev<br>+$XFS_DB_PROG -c &quot;inode $inode32v2&quot; -c &quot;print core.projid_lo&quot; -c &quot;print core.projid_hi&quot; $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>