diff mbox

xfs/133 134 262: limit xfs_quota report to report on specific project quota id

Message ID 1459494050-28330-1-git-send-email-eguan@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eryu Guan April 1, 2016, 7 a.m. UTC
With GETNEXTQUOTA support, xfs_quota -c "report" now outputs more quota
info than before, and this breaks xfs/133 xfs/134 and xfs/262, e.g.
xfs/133 fails as

     Filesystem Blocks Quota Limit Warn/Time Mounted on
     SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
     === report command output ===
    +(null) 0 0 0 00 [--------]
     123456-project 0 102400 204800 00 [--------]

Fix it by limiting xfs_quota to report on specific project quota number
using -L & -U option, so only the project quota being tested is
reported.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---

I'm not sure if kernel should be fixed, but limiting the quota report on
project number being tested seems something worth doing to me anyway. It avoids
breakage of future changes of quota report output.

 tests/xfs/133     |  8 +++++---
 tests/xfs/133.out |  2 +-
 tests/xfs/134     | 22 +++++++++++++++-------
 tests/xfs/262     |  6 ++++--
 4 files changed, 25 insertions(+), 13 deletions(-)

Comments

Zorro Lang April 1, 2016, 7:28 a.m. UTC | #1
On Fri, Apr 01, 2016 at 03:00:50PM +0800, Eryu Guan wrote:
> With GETNEXTQUOTA support, xfs_quota -c "report" now outputs more quota
> info than before, and this breaks xfs/133 xfs/134 and xfs/262, e.g.
> xfs/133 fails as
> 
>      Filesystem Blocks Quota Limit Warn/Time Mounted on
>      SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
>      === report command output ===
>     +(null) 0 0 0 00 [--------]
>      123456-project 0 102400 204800 00 [--------]
> 
> Fix it by limiting xfs_quota to report on specific project quota number
> using -L & -U option, so only the project quota being tested is
> reported.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
> 
> I'm not sure if kernel should be fixed, but limiting the quota report on
> project number being tested seems something worth doing to me anyway. It avoids
> breakage of future changes of quota report output.

Hi,

FYI:
About "+(null) 0 0 0 00 [--------]"problem, it has been talked in:
http://thread.gmane.org/gmane.comp.file-systems.fstests/1852/focus=1968

I think:
1) If we consider that this's a bug, the original test cases can
be the reproducer of this bug, so we shouldn't change the cases.

2) If we think print "(null) 0 0 0 00 [--------]" is right(or not
wrong), then this patch is good.

Thanks,
Zorro

> 
>  tests/xfs/133     |  8 +++++---
>  tests/xfs/133.out |  2 +-
>  tests/xfs/134     | 22 +++++++++++++++-------
>  tests/xfs/262     |  6 ++++--
>  4 files changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/xfs/133 b/tests/xfs/133
> index 82c38b1..7a0e55e 100755
> --- a/tests/xfs/133
> +++ b/tests/xfs/133
> @@ -57,16 +57,17 @@ do_project_test()
>  {
>  	local qa_project=123456-project
>  	local dir=$SCRATCH_MNT/project
> +	local proj_num=10
>  
>  	mkdir $dir 2>/dev/null
>  
>  	#project quota files
>  	cat >$tmp.projects <<EOF
> -10:$dir
> +$proj_num:$dir
>  EOF
>  
>  	cat >$tmp.projid <<EOF
> -$qa_project:10
> +$qa_project:$proj_num
>  EOF
>  
>  	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
> @@ -81,7 +82,8 @@ EOF
>  
>  	echo "=== report command output ==="
>  	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
> -		-c "report -p -N -b" $SCRATCH_MNT | _filter_quota
> +		-c "report -p -N -b -L $proj_num -U $proj_num" \
> +		$SCRATCH_MNT | _filter_quota
>  }
>  
>  # Test project
> diff --git a/tests/xfs/133.out b/tests/xfs/133.out
> index 21cfd0d..8c747bf 100644
> --- a/tests/xfs/133.out
> +++ b/tests/xfs/133.out
> @@ -4,5 +4,5 @@ Disk quotas for Project 123456-project (10)
>  Filesystem Blocks Quota Limit Warn/Time Mounted on
>  SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
>  === report command output ===
> -123456-project 0 102400 204800 00 [--------]
> +#10 0 102400 204800 00 [--------]
>  
> diff --git a/tests/xfs/134 b/tests/xfs/134
> index be18ee8..5ba275c 100755
> --- a/tests/xfs/134
> +++ b/tests/xfs/134
> @@ -54,12 +54,13 @@ _require_xfs_quota
>  dir=$SCRATCH_MNT/project
>  
>  #project quota files
> +proj_num=1
>  cat >$tmp.projects <<EOF
> -1:$dir
> +$proj_num:$dir
>  EOF
>  
>  cat >$tmp.projid <<EOF
> -test:1
> +test:$proj_num
>  EOF
>  
>  cp /dev/null $seqres.full
> @@ -87,17 +88,24 @@ fi
>  src/feature -p $SCRATCH_DEV
>  [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
>  
> +report_quota()
> +{
> +	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
> +		-c "repquota -inN -p -L $proj_num -U $proj_num" $SCRATCH_DEV | \
> +		tr -s '[:space:]'
> +}
> +
>  mkdir $dir
>  $XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
>  
> -xfs_quota -D $tmp.projects -P $tmp.projid -x \
> +$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
>      -c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
> -xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
> +report_quota
>  touch $dir/1
>  touch $dir/2
>  cp $dir/2 $dir/3
>  
> -xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
> +report_quota
>  
>  if [ "$HOSTOS" == "IRIX" ] ; then
>      mkfile 1M $TEST_DIR/6
> @@ -107,12 +115,12 @@ fi
>  
>  #try cp to dir
>  cp $TEST_DIR/6 $dir/6
> -xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
> +report_quota
>  
>  #try mv to dir
>  mv $TEST_DIR/6 $dir/7
>  
> -xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
> +report_quota
>  
>  # success, all done
>  status=0
> diff --git a/tests/xfs/262 b/tests/xfs/262
> index 9d8b838..d3a352c 100755
> --- a/tests/xfs/262
> +++ b/tests/xfs/262
> @@ -138,11 +138,13 @@ _quota_cmd "limit -p bhard=${qlimit_meg}m bsoft=${qlimit_meg}m ${proj_name}" \
>  							2>> "$seqres.full" 1>&2
>  
>  # See what gets reported
> -_quota_cmd "report"		| _filter_quota_rpt	2>> "$seqres.full"
> +_quota_cmd "report -U $proj_num -L $proj_num" | _filter_quota_rpt \
> +							2>> $seqres.full
>  _quota_cmd "df"			| _filter_quota_rpt	2>> "$seqres.full"
>  
>  # This time using "human readable" output
> -_quota_cmd "report -h"		| _filter_quota_rpt	2>> "$seqres.full"
> +_quota_cmd "report -h $proj_num -L $proj_num" | _filter_quota_rpt \
> +							2>> "$seqres.full"
>  _quota_cmd "df -h"		| _filter_quota_rpt	2>> "$seqres.full"
>  
>  # Clean up
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen April 1, 2016, 5:24 p.m. UTC | #2
On 4/1/16 2:28 AM, Zorro Lang wrote:
> On Fri, Apr 01, 2016 at 03:00:50PM +0800, Eryu Guan wrote:
>> With GETNEXTQUOTA support, xfs_quota -c "report" now outputs more quota
>> info than before, and this breaks xfs/133 xfs/134 and xfs/262, e.g.
>> xfs/133 fails as
>>
>>      Filesystem Blocks Quota Limit Warn/Time Mounted on
>>      SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
>>      === report command output ===
>>     +(null) 0 0 0 00 [--------]
>>      123456-project 0 102400 204800 00 [--------]
>>
>> Fix it by limiting xfs_quota to report on specific project quota number
>> using -L & -U option, so only the project quota being tested is
>> reported.
>>
>> Signed-off-by: Eryu Guan <eguan@redhat.com>
>> ---
>>
>> I'm not sure if kernel should be fixed, but limiting the quota report on
>> project number being tested seems something worth doing to me anyway. It avoids
>> breakage of future changes of quota report output.
> 
> Hi,
> 
> FYI:
> About "+(null) 0 0 0 00 [--------]"problem, it has been talked in:
> http://thread.gmane.org/gmane.comp.file-systems.fstests/1852/focus=1968
> 
> I think:
> 1) If we consider that this's a bug, the original test cases can
> be the reproducer of this bug, so we shouldn't change the cases.
> 
> 2) If we think print "(null) 0 0 0 00 [--------]" is right(or not
> wrong), then this patch is good.

yes, I'm sorry I didn't take care of this sooner.

I don't think there's value in printing the "(null)" line; I think maybe my
suggestion from that old thread might be best:

> We could explicitly look up id 0 and not show it if it's not in the
> projects file.

Or now that I think about it - projid 0 is the default project quota, right?

Assuming that's correct, perhaps we should conditionally print the line,
changing "(null)" to "default", printing it only if a default quota is 
set (i.e. not all zeros).

-Eric
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Chinner April 1, 2016, 9:50 p.m. UTC | #3
On Fri, Apr 01, 2016 at 12:24:40PM -0500, Eric Sandeen wrote:
> 
> 
> On 4/1/16 2:28 AM, Zorro Lang wrote:
> > On Fri, Apr 01, 2016 at 03:00:50PM +0800, Eryu Guan wrote:
> >> With GETNEXTQUOTA support, xfs_quota -c "report" now outputs more quota
> >> info than before, and this breaks xfs/133 xfs/134 and xfs/262, e.g.
> >> xfs/133 fails as
> >>
> >>      Filesystem Blocks Quota Limit Warn/Time Mounted on
> >>      SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
> >>      === report command output ===
> >>     +(null) 0 0 0 00 [--------]
> >>      123456-project 0 102400 204800 00 [--------]
> >>
> >> Fix it by limiting xfs_quota to report on specific project quota number
> >> using -L & -U option, so only the project quota being tested is
> >> reported.
> >>
> >> Signed-off-by: Eryu Guan <eguan@redhat.com>
> >> ---
> >>
> >> I'm not sure if kernel should be fixed, but limiting the quota report on
> >> project number being tested seems something worth doing to me anyway. It avoids
> >> breakage of future changes of quota report output.
> > 
> > Hi,
> > 
> > FYI:
> > About "+(null) 0 0 0 00 [--------]"problem, it has been talked in:
> > http://thread.gmane.org/gmane.comp.file-systems.fstests/1852/focus=1968
> > 
> > I think:
> > 1) If we consider that this's a bug, the original test cases can
> > be the reproducer of this bug, so we shouldn't change the cases.
> > 
> > 2) If we think print "(null) 0 0 0 00 [--------]" is right(or not
> > wrong), then this patch is good.
> 
> yes, I'm sorry I didn't take care of this sooner.
> 
> I don't think there's value in printing the "(null)" line; I think maybe my
> suggestion from that old thread might be best:
> 
> > We could explicitly look up id 0 and not show it if it's not in the
> > projects file.
> 
> Or now that I think about it - projid 0 is the default project quota, right?

"default" as in "project quota not enabled on this inode". i.e. if
an inode has projid == 0 then it is not tracked by project quotas.

> Assuming that's correct, perhaps we should conditionally print the line,
> changing "(null)" to "default", printing it only if a default quota is 
> set (i.e. not all zeros).

Right, the only thing that the dquot for projid 0 holds is default
quota limits. We probably shouldn't ever print it out, except when
the default limits are queried or set directly...

Cheers,

Dave.
diff mbox

Patch

diff --git a/tests/xfs/133 b/tests/xfs/133
index 82c38b1..7a0e55e 100755
--- a/tests/xfs/133
+++ b/tests/xfs/133
@@ -57,16 +57,17 @@  do_project_test()
 {
 	local qa_project=123456-project
 	local dir=$SCRATCH_MNT/project
+	local proj_num=10
 
 	mkdir $dir 2>/dev/null
 
 	#project quota files
 	cat >$tmp.projects <<EOF
-10:$dir
+$proj_num:$dir
 EOF
 
 	cat >$tmp.projid <<EOF
-$qa_project:10
+$qa_project:$proj_num
 EOF
 
 	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
@@ -81,7 +82,8 @@  EOF
 
 	echo "=== report command output ==="
 	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
-		-c "report -p -N -b" $SCRATCH_MNT | _filter_quota
+		-c "report -p -N -b -L $proj_num -U $proj_num" \
+		$SCRATCH_MNT | _filter_quota
 }
 
 # Test project
diff --git a/tests/xfs/133.out b/tests/xfs/133.out
index 21cfd0d..8c747bf 100644
--- a/tests/xfs/133.out
+++ b/tests/xfs/133.out
@@ -4,5 +4,5 @@  Disk quotas for Project 123456-project (10)
 Filesystem Blocks Quota Limit Warn/Time Mounted on
 SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
 === report command output ===
-123456-project 0 102400 204800 00 [--------]
+#10 0 102400 204800 00 [--------]
 
diff --git a/tests/xfs/134 b/tests/xfs/134
index be18ee8..5ba275c 100755
--- a/tests/xfs/134
+++ b/tests/xfs/134
@@ -54,12 +54,13 @@  _require_xfs_quota
 dir=$SCRATCH_MNT/project
 
 #project quota files
+proj_num=1
 cat >$tmp.projects <<EOF
-1:$dir
+$proj_num:$dir
 EOF
 
 cat >$tmp.projid <<EOF
-test:1
+test:$proj_num
 EOF
 
 cp /dev/null $seqres.full
@@ -87,17 +88,24 @@  fi
 src/feature -p $SCRATCH_DEV
 [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas"
 
+report_quota()
+{
+	$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
+		-c "repquota -inN -p -L $proj_num -U $proj_num" $SCRATCH_DEV | \
+		tr -s '[:space:]'
+}
+
 mkdir $dir
 $XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
 
-xfs_quota -D $tmp.projects -P $tmp.projid -x \
+$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
     -c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 touch $dir/1
 touch $dir/2
 cp $dir/2 $dir/3
 
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 
 if [ "$HOSTOS" == "IRIX" ] ; then
     mkfile 1M $TEST_DIR/6
@@ -107,12 +115,12 @@  fi
 
 #try cp to dir
 cp $TEST_DIR/6 $dir/6
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 
 #try mv to dir
 mv $TEST_DIR/6 $dir/7
 
-xfs_quota -D $tmp.projects -P $tmp.projid -x -c "repquota -inN -p" $SCRATCH_DEV | tr -s '[:space:]'
+report_quota
 
 # success, all done
 status=0
diff --git a/tests/xfs/262 b/tests/xfs/262
index 9d8b838..d3a352c 100755
--- a/tests/xfs/262
+++ b/tests/xfs/262
@@ -138,11 +138,13 @@  _quota_cmd "limit -p bhard=${qlimit_meg}m bsoft=${qlimit_meg}m ${proj_name}" \
 							2>> "$seqres.full" 1>&2
 
 # See what gets reported
-_quota_cmd "report"		| _filter_quota_rpt	2>> "$seqres.full"
+_quota_cmd "report -U $proj_num -L $proj_num" | _filter_quota_rpt \
+							2>> $seqres.full
 _quota_cmd "df"			| _filter_quota_rpt	2>> "$seqres.full"
 
 # This time using "human readable" output
-_quota_cmd "report -h"		| _filter_quota_rpt	2>> "$seqres.full"
+_quota_cmd "report -h $proj_num -L $proj_num" | _filter_quota_rpt \
+							2>> "$seqres.full"
 _quota_cmd "df -h"		| _filter_quota_rpt	2>> "$seqres.full"
 
 # Clean up