Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4654977yba; Sun, 12 May 2019 18:58:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzttAP7owSB0ahkrl//1IYhUGpvUtYBDKat3KDJwUk3utbNMRv70gsp0K6GcyJ8kjID3nKV X-Received: by 2002:aa7:9e51:: with SMTP id z17mr29563122pfq.212.1557712685743; Sun, 12 May 2019 18:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557712685; cv=none; d=google.com; s=arc-20160816; b=BW8LJzjrKA8FpcGfOJrA+duyPOD2eMk9N9BvhKgoRHRDqXIKQnunWcoX1q2KEQ31L0 RMoZAecS6gvvNiUL8iHkVq8IcFCzIiydOu6E/dfabfCUbqBymbleYV6/nOEvFWLP+5hk shrgV9CL0YDEJelMrUs8X1i2LkOiZwsTrVVjLDH8WqF6dH+eVG8Q2NF27YCk3VZs5ElA l5O3/ylCk7OT7uddjhOqRrb+IXO+iywsjjfKCUaWfwJQS4P3c7y52GB/FwDl0EKU2v+B iJ9/8SXhoXP37dgYLsXEL9OzdV+AvizNBoQ+H0XPrzHeLVE0r9ZoSo63zg5VlDhd9Z8w X+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=kjUgfTtEOujT5bzRmPEp4PB8LOFjPH6npWsJ7xs28Ao=; b=LAzAiYuzIlkYbGrRDXJec1UeBpdfIUOYpjw46NE7A1irRP5caDzkylZyi13Q8Db5+k LN4G2kBLuUqDpOhZUmItNBbr+hs8/yEmf2yJes2nhKfqMcts0nA+D1nGRHLAwduSxRqR QVp8mNpxvc2gQqF1+DHGThYgdhMf9S4ABRXaXXC2DCIrYB7qIw4rv0Wb/ikkLYjXoyTs towmx/xlA++q/yf5pDL8p90XM6dUIkmz93Aw9QsOr04xHnmcwIywlUCUkyVG1s8bFR+H 3AtPbjR+ku8CmZi6OE+wrY+sEvNuJevtot1uuIqjr5eLcggTiiFQ9aBbrb4UQt4LCaAv dDeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si15186128pgh.367.2019.05.12.18.57.42; Sun, 12 May 2019 18:58:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727317AbfEMBt4 (ORCPT + 99 others); Sun, 12 May 2019 21:49:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52246 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbfEMBt4 (ORCPT ); Sun, 12 May 2019 21:49:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E505FC00C7DD; Mon, 13 May 2019 01:49:55 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-112.pek2.redhat.com [10.72.12.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CEEE60BCD; Mon, 13 May 2019 01:49:53 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH] generic: test statfs on project quota directory Date: Mon, 13 May 2019 09:49:51 +0800 Message-Id: <20190513014951.4357-1-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 13 May 2019 01:49:56 +0000 (UTC) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org There's a bug on xfs cause statfs get negative f_ffree value from a project quota directory. It's fixed by "de7243057 fs/xfs: fix f_ffree value for statfs when project quota is set". So add statfs testing on project quota block and inode count limit. For testing foreign fs quota, change _qmount() function, turn on project if quotaon support. Signed-off-by: Zorro Lang --- Hi, (Long time passed, re-send this patch again to get reviewing) There's one thing I don't understand, so CC ext4 mail list. Please feel free to reply, if anyone knows that: $ mkfs.ext4 $SCRATCH_DEV $ tune2fs -O quota,project $SCRATCH_DEV $ mount $SCRATCH_DEV $SCRATCH_MNT -o prjquota $ quotaon -P $SCRATCH_MNT $ mkdir $SCRATCH_MNT/t $ xfs_quota -f -x -c "project -p $SCRATCH_MNT/t -s 42" $SCRATCH_MNT $ xfs_quota -f -x -c "limit -p bsoft=100m answer" $SCRATCH_MNT $ df -k $SCRATCH_MNT/t Filesystem 1K-blocks Used Available Use% Mounted on SCRATCH_DEV 102400 4 102396 1% SCRATCH_MNT On XFS, the 'Used' field always shows '0'. But why ext4 always has more 4k? Is it a bug or expected. Thanks, Zorro common/quota | 4 +++ tests/generic/999 | 74 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/999.out | 3 ++ tests/generic/group | 1 + 4 files changed, 82 insertions(+) create mode 100755 tests/generic/999 create mode 100644 tests/generic/999.out diff --git a/common/quota b/common/quota index f19f81a1..315df8cb 100644 --- a/common/quota +++ b/common/quota @@ -200,6 +200,10 @@ _qmount() if [ "$FSTYP" != "xfs" ]; then quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1 quotaon -ug $SCRATCH_MNT >>$seqres.full 2>&1 + # try to turn on project quota if it's supported + if quotaon --help 2>&1 | grep -q '\-\-project'; then + quotaon --project $SCRATCH_MNT >>$seqres.full 2>&1 + fi fi chmod ugo+rwx $SCRATCH_MNT } diff --git a/tests/generic/999 b/tests/generic/999 new file mode 100755 index 00000000..555341f1 --- /dev/null +++ b/tests/generic/999 @@ -0,0 +1,74 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 999 +# +# Test statfs when project quota is set. +# Uncover de7243057 fs/xfs: fix f_ffree value for statfs when project quota is set +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + _scratch_unmount + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_quota +_require_xfs_quota_foreign + +_scratch_mkfs >/dev/null 2>&1 +_scratch_enable_pquota +_qmount_option "prjquota" +_qmount +_require_prjquota $SCRATCH_DEV + +# Create a directory to be project object, and create a file to take 64k space +mkdir $SCRATCH_MNT/t +$XFS_IO_PROG -f -c "pwrite 0 65536" -c sync $SCRATCH_MNT/t/file >>$seqres.full + +# Setup temporary replacements for /etc/projects and /etc/projid +cat >$tmp.projects <$tmp.projid </dev/null 2>&1 +$quota_cmd -x -c 'limit -p isoft=53 bsoft=100m answer' $SCRATCH_MNT + +# The itotal and size should be 53 and 102400(k), as above project quota limit. +# The isued and used should be 2 and 64(k), as this case takes. But ext4 always +# shows more 4k 'used' space than XFS, it prints 68k at here. So filter the +# 6[48] at the end. +df -k --output=file,itotal,iused,size,used $SCRATCH_MNT/t | \ + _filter_scratch | _filter_spaces | \ + sed -e "/SCRATCH_MNT/s/6[48]/N/" + +# success, all done +status=0 +exit diff --git a/tests/generic/999.out b/tests/generic/999.out new file mode 100644 index 00000000..1bebabd4 --- /dev/null +++ b/tests/generic/999.out @@ -0,0 +1,3 @@ +QA output created by 999 +File Inodes IUsed 1K-blocks Used +SCRATCH_MNT/t 53 2 102400 N diff --git a/tests/generic/group b/tests/generic/group index 9f4845c6..35da10a5 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -542,3 +542,4 @@ 537 auto quick trim 538 auto quick aio 539 auto quick punch seek +999 auto quick quota -- 2.17.2