public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph/005: verify correct statfs behaviour with quotas
@ 2022-04-27 14:34 Luís Henriques
  2022-05-24 22:11 ` David Disseldorp
  2022-05-25 10:19 ` Zorro Lang
  0 siblings, 2 replies; 7+ messages in thread
From: Luís Henriques @ 2022-04-27 14:34 UTC (permalink / raw)
  To: Jeff Layton, Xiubo Li, Ilya Dryomov
  Cc: ceph-devel, fstests, Luís Henriques

When using a directory with 'max_bytes' quota as a base for a mount,
statfs shall use that 'max_bytes' value as the total disk size.  That
value shall be used even when using subdirectory as base for the mount.

A bug was found where, when this subdirectory also had a 'max_files'
quota, the real filesystem size would be returned instead of the parent
'max_bytes' quota value.  This test case verifies this bug is fixed.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
---
 tests/ceph/005     | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/ceph/005.out |  2 ++
 2 files changed, 42 insertions(+)
 create mode 100755 tests/ceph/005
 create mode 100644 tests/ceph/005.out

diff --git a/tests/ceph/005 b/tests/ceph/005
new file mode 100755
index 000000000000..0763a235a677
--- /dev/null
+++ b/tests/ceph/005
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2022 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# FS QA Test 005
+#
+# Make sure statfs reports correct total size when:
+# 1. using a directory with 'max_byte' quota as base for a mount
+# 2. using a subdirectory of the above directory with 'max_files' quota
+#
+. ./common/preamble
+_begin_fstest auto quick quota
+
+_supported_fs generic
+_require_scratch
+
+_scratch_mount
+mkdir -p $SCRATCH_MNT/quota-dir/subdir
+
+# set quotas
+quota=$((1024*10000))
+$SETFATTR_PROG -n ceph.quota.max_bytes -v $quota $SCRATCH_MNT/quota-dir
+$SETFATTR_PROG -n ceph.quota.max_files -v $quota $SCRATCH_MNT/quota-dir/subdir
+_scratch_unmount
+
+SCRATCH_DEV=$SCRATCH_DEV/quota-dir _scratch_mount
+total=`df -kP $SCRATCH_MNT | grep -v Filesystem | awk '{print $2}'`
+SCRATCH_DEV=$SCRATCH_DEV/quota-dir _scratch_unmount
+[ $total -eq 8192 ] || _fail "Incorrect statfs for quota-dir: $total"
+
+SCRATCH_DEV=$SCRATCH_DEV/quota-dir/subdir _scratch_mount
+total=`df -kP $SCRATCH_MNT | grep -v Filesystem | awk '{print $2}'`
+SCRATCH_DEV=$SCRATCH_DEV/quota-dir/subdir _scratch_unmount
+[ $total -eq 8192 ] || _fail "Incorrect statfs for quota-dir/subdir: $total"
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
diff --git a/tests/ceph/005.out b/tests/ceph/005.out
new file mode 100644
index 000000000000..a5027f127cf0
--- /dev/null
+++ b/tests/ceph/005.out
@@ -0,0 +1,2 @@
+QA output created by 005
+Silence is golden

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

end of thread, other threads:[~2022-05-25 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-27 14:34 [PATCH] ceph/005: verify correct statfs behaviour with quotas Luís Henriques
2022-05-24 22:11 ` David Disseldorp
2022-05-25  8:53   ` Luís Henriques
2022-05-25 10:36     ` David Disseldorp
2022-05-25 14:26       ` Luís Henriques
2022-05-25 10:19 ` Zorro Lang
2022-05-25 14:47   ` Luís Henriques

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox