From patchwork Tue Jul 5 06:56:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 9213735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CCA8160572 for ; Tue, 5 Jul 2016 07:55:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF15A28942 for ; Tue, 5 Jul 2016 07:55:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3AFF28944; Tue, 5 Jul 2016 07:55:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, LOTS_OF_MONEY, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E83DD28942 for ; Tue, 5 Jul 2016 07:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886AbcGEHzi (ORCPT ); Tue, 5 Jul 2016 03:55:38 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36272 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbcGEHzh (ORCPT ); Tue, 5 Jul 2016 03:55:37 -0400 Received: by mail-pf0-f193.google.com with SMTP id i123so18371544pfg.3; Tue, 05 Jul 2016 00:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=CS6Kl6GNA+DImHuhefiBRA5q4EciCOYRg1xQ0k8fwMc=; b=NG+uVxV1yEnR/rb9TtwVECrmljlRTQ7vZwDrVh76rHQSfP15lN9RkdTLetmUBYijJG COa7rJeJpT5ZbEGoc4kqw9C7qnIGeRXafjx+4UjBwW9NOdNCejBSoQ/CPI4jqem3jpaN yMYZOk9k3mM97wkltGmINe6SmFU7c6PPc0mtqZrh93ZsFuHBlP2j/9qt1uOMviN6Q0vx k/3UV61aUd4w0UUtjNTU0PMPdzq7o/UeGHZEMnctJi7970mmvheP77YHe6EJH18O6Zw/ q9UrcrA66AIrYm+TmYL014zkwx76/kn3prNPqrJFsvaQagIn0H2KIhrNNO7c8ADsIi0v sr1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CS6Kl6GNA+DImHuhefiBRA5q4EciCOYRg1xQ0k8fwMc=; b=Sb17duit+/t1lveXg+IGuDaFwMpgitZI+devZ5ybOp77qPbz9klIdu8yr9b7ZkcqO1 W+Jgs0WIlqKoHRnEjzx9mhg1SL3Q9twM8yigBQcwXS2Rj7Gtic4PzUaDNhgfChVy+581 q6tmBTH45Ezc0JeEtT5QuNn63gkuPNa9JYmpTl5dnjMMOfYxsPWWB1sO2EQM5n7YH6p8 8Y21GgCs1v3fOjsbVgrWQFvaHMdkF9RwuT/2/jRMAoT+6JuCw/SS2jD81iV2GGg3m412 W0l93EZUm2+ERzCwBW2cwgsJi6/39rHbVy7MBSGcAf7OaInZz5V2V9fDeDBPXX4S0W05 dYHg== X-Gm-Message-State: ALyK8tIq+Smk1/+4hGUy3ZEgEs9KwbJ/KUoQQRL+lHB/2KMjakpH9YkcOXdzeqQrZzhKTg== X-Received: by 10.98.10.25 with SMTP id s25mr29631376pfi.44.1467705336349; Tue, 05 Jul 2016 00:55:36 -0700 (PDT) Received: from localhost.localdomain ([45.32.49.168]) by smtp.gmail.com with ESMTPSA id 81sm2737598pfo.74.2016.07.05.00.55.31 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 05 Jul 2016 00:55:35 -0700 (PDT) From: Wang Shilong To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, sihara@ddn.com, lixi@ddn.com, wshilong@ddn.com Subject: [PATCH] xfstests, ext4: add project quota attribute tests Date: Tue, 5 Jul 2016 15:56:31 +0900 Message-Id: <1467701791-14626-1-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wang Shilong 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 --- 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 +# +# 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