linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstests, ext4: add project quota attribute tests
@ 2016-07-05  6:56 Wang Shilong
  2016-07-05  9:43 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Shilong @ 2016-07-05  6:56 UTC (permalink / raw)
  To: fstests; +Cc: linux-ext4, tytso, sihara, lixi, wshilong

From: Wang Shilong <wshilong@ddn.com>

Some basic project quota inferface tests.

1. ioctl with/without project.
2. project inherit attribute.
3. Link accross project should fail
4. change project ignores quota

Signed-off-by: Wang Shilong <wshilong@ddn.com>
---
 tests/ext4/030     | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/030.out |  11 ++++++
 tests/ext4/group   |   1 +
 3 files changed, 124 insertions(+)
 create mode 100755 tests/ext4/030
 create mode 100644 tests/ext4/030.out

diff --git a/tests/ext4/030 b/tests/ext4/030
new file mode 100755
index 0000000..06b3de8
--- /dev/null
+++ b/tests/ext4/030
@@ -0,0 +1,112 @@
+#! /bin/bash
+# FS QA Test No. 030
+#
+# Test Project quota attr function
+#
+#-----------------------------------------------------------------------
+# Copyright 2016 (C) Wang Shilong<wshilong@ddn.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seqfull=$0
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+
+_cleanup()
+{
+    rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_supported_fs ext4
+_supported_os Linux
+
+_require_scratch
+_require_chattr
+_require_attrs
+
+rm -f $seqres.full
+
+echo "+ create scratch fs"
+_scratch_mkfs_ext4 > /dev/null 2>&1
+
+echo "+ mount fs image"
+_scratch_mount
+
+function attr_test()
+{
+	#basic test with/without project
+	touch $SCRATCH_MNT/foo
+	lsattr -p $SCRATCH_MNT/foo | _filter_scratch | _filter_spaces
+	chattr -p 1 $SCRATCH_MNT/foo 2>&1 \
+				| _filter_scratch | _filter_spaces
+	mkdir $SCRATCH_MNT/dir
+	chattr +P $SCRATCH_MNT/dir | _filter_scratch | _filter_spaces
+	chattr -P $SCRATCH_MNT/dir | _filter_scratch | _filter_spaces
+
+	[ $1 -eq 0 ] && return
+
+	#default project without inherit
+	chattr -p 123456 $SCRATCH_MNT/dir | _filter_scratch | _filter_spaces
+	lsattr -p $SCRATCH_MNT/dir | _filter_scratch | _filter_spaces
+	touch $SCRATCH_MNT/dir/foo
+	lsattr -p $SCRATCH_MNT/dir/foo | _filter_scratch | _filter_spaces
+
+	#test project inherit with inherit attribute
+	chattr +P $SCRATCH_MNT/dir
+	touch $SCRATCH_MNT/dir/foo1
+	lsattr -p $SCRATCH_MNT/dir/foo1 | _filter_scratch | _filter_spaces
+
+	#Link accross project should fail
+	mkdir $SCRATCH_MNT/dir1
+	chattr +P $SCRATCH_MNT/dir1
+	chattr -p 654321 $SCRATCH_MNT/dir1 | _filter_scratch | _filter_spaces
+	ln $SCRATCH_MNT/dir/foo1 $SCRATCH_MNT/dir1/foo1 2>&1 \
+		| _filter_scratch | _filter_spaces
+
+	#mv accross different projects should work
+	mv $SCRATCH_MNT/dir/foo1 $SCRATCH_MNT/dir1/foo1
+	lsattr -p $SCRATCH_MNT/dir1/foo1 | _filter_scratch | _filter_spaces
+
+	#change project ignores quota
+	quotaon $SCRATCH_MNT
+	setquota -P 654321 0 0 0 1 $SCRATCH_MNT/
+	chattr -p 123456 $SCRATCH_MNT/dir1/foo1 | _filter_scratch | _filter_spaces
+	lsattr -p $SCRATCH_MNT/dir1/foo1 | _filter_scratch | _filter_spaces
+}
+#init without project quota enabled
+attr_test 0
+
+#enable project quota feature
+_scratch_unmount >/dev/null 2>&1
+tune2fs -O quota,project $SCRATCH_DEV >/dev/null 2>&1
+_scratch_mount
+
+rm -rf $SCRATCH_MNT/dir
+attr_test 1
diff --git a/tests/ext4/030.out b/tests/ext4/030.out
new file mode 100644
index 0000000..035d3c1
--- /dev/null
+++ b/tests/ext4/030.out
@@ -0,0 +1,11 @@
+QA output created by 030
++ create scratch fs
++ mount fs image
+ 0 --------------e---- SCRATCH_MNT/foo
+chattr: Operation not supported while setting project on SCRATCH_MNT/foo
+ 0 --------------e---- SCRATCH_MNT/foo
+ 0 --------------e---- SCRATCH_MNT/dir/foo
+123456 --------------e---P SCRATCH_MNT/dir/foo1
+ln: failed to create hard link 'SCRATCH_MNT/dir1/foo1' => 'SCRATCH_MNT/dir/foo1': Invalid cross-device link
+654321 --------------e---P SCRATCH_MNT/dir1/foo1
+123456 --------------e---P SCRATCH_MNT/dir1/foo1
diff --git a/tests/ext4/group b/tests/ext4/group
index bbdbe1d..f9c9ec3 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -24,6 +24,7 @@
 019 fuzzers
 020 auto quick ioctl rw
 021 auto quick
+030 auto quick
 271 auto rw quick
 301 aio auto ioctl rw stress
 302 aio auto ioctl rw stress
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfstests, ext4: add project quota attribute tests
  2016-07-05  6:56 [PATCH] xfstests, ext4: add project quota attribute tests Wang Shilong
@ 2016-07-05  9:43 ` Christoph Hellwig
  2016-07-05 14:35   ` Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2016-07-05  9:43 UTC (permalink / raw)
  To: Wang Shilong; +Cc: fstests, linux-ext4, tytso, sihara, lixi, wshilong

On Tue, Jul 05, 2016 at 03:56:31PM +0900, Wang Shilong wrote:
> From: Wang Shilong <wshilong@ddn.com>
> 
> Some basic project quota inferface tests.
> 
> 1. ioctl with/without project.
> 2. project inherit attribute.
> 3. Link accross project should fail
> 4. change project ignores quota

These looks pretty generic.  Aren't there any XFS tests that can be made
generic now that ext4 supports project quotas?  Even if not these new
test should be made generic and added to the generic group.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfstests, ext4: add project quota attribute tests
  2016-07-05  9:43 ` Christoph Hellwig
@ 2016-07-05 14:35   ` Theodore Ts'o
  2016-07-05 14:59     ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2016-07-05 14:35 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Wang Shilong, fstests, linux-ext4, sihara, lixi, wshilong

On Tue, Jul 05, 2016 at 02:43:04AM -0700, Christoph Hellwig wrote:
> On Tue, Jul 05, 2016 at 03:56:31PM +0900, Wang Shilong wrote:
> > From: Wang Shilong <wshilong@ddn.com>
> > 
> > Some basic project quota inferface tests.
> > 
> > 1. ioctl with/without project.
> > 2. project inherit attribute.
> > 3. Link accross project should fail
> > 4. change project ignores quota
> 
> These looks pretty generic.  Aren't there any XFS tests that can be made
> generic now that ext4 supports project quotas?  Even if not these new
> test should be made generic and added to the generic group.

Last I checked there were some patches which I thought either Eric or
you were working on to change xfsprogs so it would be willing to try
to manipulate project quotas on non-xfs file systems?

I had some *extremely* hacky patches which were just enough to test
project quotas, but then I gave up on them after quotatools learned
how to work with project quotas.  I believe the presumption though was
that it would be easier to teach xfsprogs to work with ext4 than to
change xfstests to use quotatools?

Does anyone know what the status of the "real" patches to xfsprogs
that were (hopefuly) going to be clean enough to try to push them
upstream?

					- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfstests, ext4: add project quota attribute tests
  2016-07-05 14:35   ` Theodore Ts'o
@ 2016-07-05 14:59     ` Eric Sandeen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2016-07-05 14:59 UTC (permalink / raw)
  To: Theodore Ts'o, Christoph Hellwig
  Cc: Wang Shilong, fstests, linux-ext4, sihara, lixi, wshilong



On 7/5/16 9:35 AM, Theodore Ts'o wrote:
> On Tue, Jul 05, 2016 at 02:43:04AM -0700, Christoph Hellwig wrote:
>> On Tue, Jul 05, 2016 at 03:56:31PM +0900, Wang Shilong wrote:
>>> From: Wang Shilong <wshilong@ddn.com>
>>>
>>> Some basic project quota inferface tests.
>>>
>>> 1. ioctl with/without project.
>>> 2. project inherit attribute.
>>> 3. Link accross project should fail
>>> 4. change project ignores quota
>>
>> These looks pretty generic.  Aren't there any XFS tests that can be made
>> generic now that ext4 supports project quotas?  Even if not these new
>> test should be made generic and added to the generic group.
> 
> Last I checked there were some patches which I thought either Eric or
> you were working on to change xfsprogs so it would be willing to try
> to manipulate project quotas on non-xfs file systems?

Dave had sent them, but they still need some work.  I asked Bill O'Donnell
to take a look at getting them up to snuff.

However, we also agreed long ago (I think) that we need to test both
paths at this point - using the xfs as well as the vfs interfaces.

So making xfs_quota work on non-xfs filesystems tests one path, and
dedicated tests invoking generic quota tools will test the other path.

> I had some *extremely* hacky patches which were just enough to test
> project quotas, but then I gave up on them after quotatools learned
> how to work with project quotas.  I believe the presumption though was
> that it would be easier to teach xfsprogs to work with ext4 than to
> change xfstests to use quotatools?

We need to do both to get full coverage, sadly.

(I'm glad to see movement on this again; it seems that even this much
has led to some bug disccovery and fixing already.  Without tests we
had no idea whether the merged common code really worked.)

> Does anyone know what the status of the "real" patches to xfsprogs
> that were (hopefuly) going to be clean enough to try to push them
> upstream?

They're being resurrected now.

-Eric

> 					- Ted
> --
> 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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-05 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-05  6:56 [PATCH] xfstests, ext4: add project quota attribute tests Wang Shilong
2016-07-05  9:43 ` Christoph Hellwig
2016-07-05 14:35   ` Theodore Ts'o
2016-07-05 14:59     ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).