* [PATCH v2] ceph/005: verify correct statfs behaviour with quotas
@ 2022-06-15 15:14 Luís Henriques
2022-06-25 15:06 ` Zorro Lang
2022-06-27 0:35 ` Xiubo Li
0 siblings, 2 replies; 6+ messages in thread
From: Luís Henriques @ 2022-06-15 15:14 UTC (permalink / raw)
To: fstests
Cc: David Disseldorp, Zorro Lang, Jeff Layton, Xiubo Li, ceph-devel,
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>
---
Finally, I've managed to come back to this test. The major changes since
v1 are:
- creation of an helper for getting total mount space using 'df'
- now the test sends quota size to stdout
common/rc | 13 +++++++++++++
tests/ceph/005 | 38 ++++++++++++++++++++++++++++++++++++++
tests/ceph/005.out | 4 ++++
3 files changed, 55 insertions(+)
create mode 100755 tests/ceph/005
create mode 100644 tests/ceph/005.out
diff --git a/common/rc b/common/rc
index 2f31ca464621..72eabb7a428c 100644
--- a/common/rc
+++ b/common/rc
@@ -4254,6 +4254,19 @@ _get_available_space()
echo $((avail_kb * 1024))
}
+# get the total space in bytes
+#
+_get_total_space()
+{
+ if [ -z "$1" ]; then
+ echo "Usage: _get_total_space <mnt>"
+ exit 1
+ fi
+ local total_kb;
+ total_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $3 }'`
+ echo $(($total_kb * 1024))
+}
+
# return device size in kb
_get_device_size()
{
diff --git a/tests/ceph/005 b/tests/ceph/005
new file mode 100755
index 000000000000..7eb687e8a092
--- /dev/null
+++ b/tests/ceph/005
@@ -0,0 +1,38 @@
+#! /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 ceph
+_require_scratch
+
+_scratch_mount
+mkdir -p "$SCRATCH_MNT/quota-dir/subdir"
+
+# set quota
+quota=$((2 ** 30)) # 1G
+$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
+echo ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
+SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
+
+SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_mount
+echo subdir ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
+SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_unmount
+
+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..47798b1fcd6f
--- /dev/null
+++ b/tests/ceph/005.out
@@ -0,0 +1,4 @@
+QA output created by 005
+ceph quota size is 1073741824 bytes
+subdir ceph quota size is 1073741824 bytes
+Silence is golden
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ceph/005: verify correct statfs behaviour with quotas
2022-06-15 15:14 [PATCH v2] ceph/005: verify correct statfs behaviour with quotas Luís Henriques
@ 2022-06-25 15:06 ` Zorro Lang
2022-06-27 0:35 ` Xiubo Li
1 sibling, 0 replies; 6+ messages in thread
From: Zorro Lang @ 2022-06-25 15:06 UTC (permalink / raw)
To: Luís Henriques
Cc: fstests, David Disseldorp, Jeff Layton, Xiubo Li, ceph-devel
On Wed, Jun 15, 2022 at 04:14:18PM +0100, Luís Henriques wrote:
> 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>
> ---
> Finally, I've managed to come back to this test. The major changes since
> v1 are:
> - creation of an helper for getting total mount space using 'df'
> - now the test sends quota size to stdout
>
> common/rc | 13 +++++++++++++
> tests/ceph/005 | 38 ++++++++++++++++++++++++++++++++++++++
> tests/ceph/005.out | 4 ++++
> 3 files changed, 55 insertions(+)
> create mode 100755 tests/ceph/005
> create mode 100644 tests/ceph/005.out
>
> diff --git a/common/rc b/common/rc
> index 2f31ca464621..72eabb7a428c 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4254,6 +4254,19 @@ _get_available_space()
> echo $((avail_kb * 1024))
> }
>
> +# get the total space in bytes
> +#
> +_get_total_space()
> +{
> + if [ -z "$1" ]; then
> + echo "Usage: _get_total_space <mnt>"
> + exit 1
> + fi
> + local total_kb;
> + total_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $3 }'`
> + echo $(($total_kb * 1024))
> +}
> +
> # return device size in kb
> _get_device_size()
> {
> diff --git a/tests/ceph/005 b/tests/ceph/005
> new file mode 100755
> index 000000000000..7eb687e8a092
> --- /dev/null
> +++ b/tests/ceph/005
> @@ -0,0 +1,38 @@
> +#! /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 ceph
> +_require_scratch
> +
> +_scratch_mount
> +mkdir -p "$SCRATCH_MNT/quota-dir/subdir"
> +
> +# set quota
> +quota=$((2 ** 30)) # 1G
> +$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
> +echo ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
One week past, I hope to get some reviewing points from ceph mail list, due to I
am really not familiar with cephfs, especially about the SCRATCH_DEV change as
above.
I tried to ask if we can use a directory under TEST_DIR to do that, but Luís
said he need the "SCRATCH_DEV=$SCRATCH_DEV/xxxx" things. Is it always a good
usage for cephfs?
Hope to get review from ceph forks, Thanks!
Thanks,
Zorro
> +
> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_mount
> +echo subdir ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_unmount
> +
> +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..47798b1fcd6f
> --- /dev/null
> +++ b/tests/ceph/005.out
> @@ -0,0 +1,4 @@
> +QA output created by 005
> +ceph quota size is 1073741824 bytes
> +subdir ceph quota size is 1073741824 bytes
> +Silence is golden
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ceph/005: verify correct statfs behaviour with quotas
2022-06-15 15:14 [PATCH v2] ceph/005: verify correct statfs behaviour with quotas Luís Henriques
2022-06-25 15:06 ` Zorro Lang
@ 2022-06-27 0:35 ` Xiubo Li
2022-06-27 9:20 ` Luís Henriques
1 sibling, 1 reply; 6+ messages in thread
From: Xiubo Li @ 2022-06-27 0:35 UTC (permalink / raw)
To: Luís Henriques, fstests
Cc: David Disseldorp, Zorro Lang, Jeff Layton, ceph-devel
Hi Luis,
Sorry for late.
On 6/15/22 11:14 PM, Luís Henriques wrote:
> 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>
> ---
> Finally, I've managed to come back to this test. The major changes since
> v1 are:
> - creation of an helper for getting total mount space using 'df'
> - now the test sends quota size to stdout
>
> common/rc | 13 +++++++++++++
> tests/ceph/005 | 38 ++++++++++++++++++++++++++++++++++++++
> tests/ceph/005.out | 4 ++++
> 3 files changed, 55 insertions(+)
> create mode 100755 tests/ceph/005
> create mode 100644 tests/ceph/005.out
>
> diff --git a/common/rc b/common/rc
> index 2f31ca464621..72eabb7a428c 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4254,6 +4254,19 @@ _get_available_space()
> echo $((avail_kb * 1024))
> }
>
> +# get the total space in bytes
> +#
> +_get_total_space()
> +{
> + if [ -z "$1" ]; then
> + echo "Usage: _get_total_space <mnt>"
> + exit 1
> + fi
> + local total_kb;
> + total_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $3 }'`
> + echo $(($total_kb * 1024))
> +}
> +
> # return device size in kb
> _get_device_size()
> {
> diff --git a/tests/ceph/005 b/tests/ceph/005
> new file mode 100755
> index 000000000000..7eb687e8a092
> --- /dev/null
> +++ b/tests/ceph/005
> @@ -0,0 +1,38 @@
> +#! /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 ceph
> +_require_scratch
> +
> +_scratch_mount
> +mkdir -p "$SCRATCH_MNT/quota-dir/subdir"
> +
> +# set quota
> +quota=$((2 ** 30)) # 1G
> +$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
> +echo ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
> +
For the 'SCRATCH_DEV' here, if you do:
SCRATCH_DEV="$SCRATCH_DEV/quota-dir"
twice, won't it be "${ceph_scratch_dev}/quota-dir/quota-dir" at last ?
Shouldn't it be:
SCRATCH_DEV="$TEST_DIR/quota-dir" ?
-- Xiubo
> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_mount
> +echo subdir ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_unmount
> +
> +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..47798b1fcd6f
> --- /dev/null
> +++ b/tests/ceph/005.out
> @@ -0,0 +1,4 @@
> +QA output created by 005
> +ceph quota size is 1073741824 bytes
> +subdir ceph quota size is 1073741824 bytes
> +Silence is golden
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ceph/005: verify correct statfs behaviour with quotas
2022-06-27 0:35 ` Xiubo Li
@ 2022-06-27 9:20 ` Luís Henriques
2022-06-27 9:35 ` Xiubo Li
0 siblings, 1 reply; 6+ messages in thread
From: Luís Henriques @ 2022-06-27 9:20 UTC (permalink / raw)
To: Xiubo Li; +Cc: fstests, David Disseldorp, Zorro Lang, Jeff Layton, ceph-devel
On Mon, Jun 27, 2022 at 08:35:14AM +0800, Xiubo Li wrote:
> Hi Luis,
>
> Sorry for late.
>
> On 6/15/22 11:14 PM, Luís Henriques wrote:
> > 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>
> > ---
> > Finally, I've managed to come back to this test. The major changes since
> > v1 are:
> > - creation of an helper for getting total mount space using 'df'
> > - now the test sends quota size to stdout
> >
> > common/rc | 13 +++++++++++++
> > tests/ceph/005 | 38 ++++++++++++++++++++++++++++++++++++++
> > tests/ceph/005.out | 4 ++++
> > 3 files changed, 55 insertions(+)
> > create mode 100755 tests/ceph/005
> > create mode 100644 tests/ceph/005.out
> >
> > diff --git a/common/rc b/common/rc
> > index 2f31ca464621..72eabb7a428c 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -4254,6 +4254,19 @@ _get_available_space()
> > echo $((avail_kb * 1024))
> > }
> > +# get the total space in bytes
> > +#
> > +_get_total_space()
> > +{
> > + if [ -z "$1" ]; then
> > + echo "Usage: _get_total_space <mnt>"
> > + exit 1
> > + fi
> > + local total_kb;
> > + total_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $3 }'`
> > + echo $(($total_kb * 1024))
> > +}
> > +
> > # return device size in kb
> > _get_device_size()
> > {
> > diff --git a/tests/ceph/005 b/tests/ceph/005
> > new file mode 100755
> > index 000000000000..7eb687e8a092
> > --- /dev/null
> > +++ b/tests/ceph/005
> > @@ -0,0 +1,38 @@
> > +#! /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 ceph
> > +_require_scratch
> > +
> > +_scratch_mount
> > +mkdir -p "$SCRATCH_MNT/quota-dir/subdir"
> > +
> > +# set quota
> > +quota=$((2 ** 30)) # 1G
> > +$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
> > +echo ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
> > +SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
> > +
>
> For the 'SCRATCH_DEV' here, if you do:
>
> SCRATCH_DEV="$SCRATCH_DEV/quota-dir"
>
> twice, won't it be "${ceph_scratch_dev}/quota-dir/quota-dir" at last ?
>
> Shouldn't it be:
>
> SCRATCH_DEV="$TEST_DIR/quota-dir" ?
No, actually we do really need to have $SCRATCH_DEV and not $TEST_DIR
here, because we want to have SCRATCH_DEV set to something like:
<mon-ip-addr>:<port>:/quota-dir
so that we will use that directory (with quotas) as base for the mount.
Regarding the second attribution using the already modifed $SCRATCH_DEV
variable, that's not really what is happening (and I had to go
double-check myself, as you got me confused too :-).
So, if you do:
SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_mount
SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
the SCRATCH_DEV value is changed *only* for the _scratch_[un]mount
functions, but SCRATCH_DEV value isn't really changed after these
attributions. This is probably a bashism (I'm not really sure), but you
can see a similar pattern in other places (see, for example, test
xfs/234).
Anyway, if you prefer, I'm fine sending v3 of this test doing something
like:
SCRATCH_DEV_ORIG="$SCRATCH_DEV"
SCRATCH_DEV="$SCRATCH_DEV_ORIG/quota-dir" _scratch_mount
...
Cheers,
--
Luís
>
> -- Xiubo
>
> > +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_mount
> > +echo subdir ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
> > +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_unmount
> > +
> > +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..47798b1fcd6f
> > --- /dev/null
> > +++ b/tests/ceph/005.out
> > @@ -0,0 +1,4 @@
> > +QA output created by 005
> > +ceph quota size is 1073741824 bytes
> > +subdir ceph quota size is 1073741824 bytes
> > +Silence is golden
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ceph/005: verify correct statfs behaviour with quotas
2022-06-27 9:20 ` Luís Henriques
@ 2022-06-27 9:35 ` Xiubo Li
2022-06-27 10:25 ` Luís Henriques
0 siblings, 1 reply; 6+ messages in thread
From: Xiubo Li @ 2022-06-27 9:35 UTC (permalink / raw)
To: Luís Henriques
Cc: fstests, David Disseldorp, Zorro Lang, Jeff Layton, ceph-devel
On 6/27/22 5:20 PM, Luís Henriques wrote:
> On Mon, Jun 27, 2022 at 08:35:14AM +0800, Xiubo Li wrote:
>> Hi Luis,
>>
>> Sorry for late.
>>
>> On 6/15/22 11:14 PM, Luís Henriques wrote:
>>> 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>
>>> ---
>>> Finally, I've managed to come back to this test. The major changes since
>>> v1 are:
>>> - creation of an helper for getting total mount space using 'df'
>>> - now the test sends quota size to stdout
>>>
>>> common/rc | 13 +++++++++++++
>>> tests/ceph/005 | 38 ++++++++++++++++++++++++++++++++++++++
>>> tests/ceph/005.out | 4 ++++
>>> 3 files changed, 55 insertions(+)
>>> create mode 100755 tests/ceph/005
>>> create mode 100644 tests/ceph/005.out
>>>
>>> diff --git a/common/rc b/common/rc
>>> index 2f31ca464621..72eabb7a428c 100644
>>> --- a/common/rc
>>> +++ b/common/rc
>>> @@ -4254,6 +4254,19 @@ _get_available_space()
>>> echo $((avail_kb * 1024))
>>> }
>>> +# get the total space in bytes
>>> +#
>>> +_get_total_space()
>>> +{
>>> + if [ -z "$1" ]; then
>>> + echo "Usage: _get_total_space <mnt>"
>>> + exit 1
>>> + fi
>>> + local total_kb;
>>> + total_kb=`$DF_PROG $1 | tail -n1 | awk '{ print $3 }'`
>>> + echo $(($total_kb * 1024))
>>> +}
>>> +
>>> # return device size in kb
>>> _get_device_size()
>>> {
>>> diff --git a/tests/ceph/005 b/tests/ceph/005
>>> new file mode 100755
>>> index 000000000000..7eb687e8a092
>>> --- /dev/null
>>> +++ b/tests/ceph/005
>>> @@ -0,0 +1,38 @@
>>> +#! /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 ceph
>>> +_require_scratch
>>> +
>>> +_scratch_mount
>>> +mkdir -p "$SCRATCH_MNT/quota-dir/subdir"
>>> +
>>> +# set quota
>>> +quota=$((2 ** 30)) # 1G
>>> +$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
>>> +echo ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
>>> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
>>> +
>> For the 'SCRATCH_DEV' here, if you do:
>>
>> SCRATCH_DEV="$SCRATCH_DEV/quota-dir"
>>
>> twice, won't it be "${ceph_scratch_dev}/quota-dir/quota-dir" at last ?
>>
>> Shouldn't it be:
>>
>> SCRATCH_DEV="$TEST_DIR/quota-dir" ?
> No, actually we do really need to have $SCRATCH_DEV and not $TEST_DIR
> here, because we want to have SCRATCH_DEV set to something like:
>
> <mon-ip-addr>:<port>:/quota-dir
>
> so that we will use that directory (with quotas) as base for the mount.
>
> Regarding the second attribution using the already modifed $SCRATCH_DEV
> variable, that's not really what is happening (and I had to go
> double-check myself, as you got me confused too :-).
>
> So, if you do:
>
> SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_mount
> SCRATCH_DEV="$SCRATCH_DEV/quota-dir" _scratch_unmount
>
> the SCRATCH_DEV value is changed *only* for the _scratch_[un]mount
> functions, but SCRATCH_DEV value isn't really changed after these
> attributions. This is probably a bashism (I'm not really sure), but you
> can see a similar pattern in other places (see, for example, test
> xfs/234).
Sorry, could you give the link about this ?
Checked the xfs/234, I didn't find any place is using the similar pattern.
This is what I see:
53 # Now restore the obfuscated one back and take a look around
54 echo "Restore metadump"
55 xfs_mdrestore $metadump_file $TEST_DIR/image
56 SCRATCH_DEV=$TEST_DIR/image _scratch_mount
57 SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
58
59 echo "Check restored fs"
60 _check_generic_filesystem $metadump_file
> Anyway, if you prefer, I'm fine sending v3 of this test doing something
> like:
Locally I just test this use case, it seems working as my guess.
-- Xiubo
>
> SCRATCH_DEV_ORIG="$SCRATCH_DEV"
> SCRATCH_DEV="$SCRATCH_DEV_ORIG/quota-dir" _scratch_mount
> ...
>
> Cheers,
> --
> Luís
>
>> -- Xiubo
>>
>>> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_mount
>>> +echo subdir ceph quota size is $(_get_total_space "$SCRATCH_MNT") bytes
>>> +SCRATCH_DEV="$SCRATCH_DEV/quota-dir/subdir" _scratch_unmount
>>> +
>>> +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..47798b1fcd6f
>>> --- /dev/null
>>> +++ b/tests/ceph/005.out
>>> @@ -0,0 +1,4 @@
>>> +QA output created by 005
>>> +ceph quota size is 1073741824 bytes
>>> +subdir ceph quota size is 1073741824 bytes
>>> +Silence is golden
>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ceph/005: verify correct statfs behaviour with quotas
2022-06-27 9:35 ` Xiubo Li
@ 2022-06-27 10:25 ` Luís Henriques
0 siblings, 0 replies; 6+ messages in thread
From: Luís Henriques @ 2022-06-27 10:25 UTC (permalink / raw)
To: Xiubo Li; +Cc: fstests, David Disseldorp, Zorro Lang, Jeff Layton, ceph-devel
On Mon, Jun 27, 2022 at 05:35:32PM +0800, Xiubo Li wrote:
<...>
> Sorry, could you give the link about this ?
>
> Checked the xfs/234, I didn't find any place is using the similar pattern.
>
> This is what I see:
>
> 53 # Now restore the obfuscated one back and take a look around
> 54 echo "Restore metadump"
> 55 xfs_mdrestore $metadump_file $TEST_DIR/image
> 56 SCRATCH_DEV=$TEST_DIR/image _scratch_mount
> 57 SCRATCH_DEV=$TEST_DIR/image _scratch_unmount
> 58
> 59 echo "Check restored fs"
> 60 _check_generic_filesystem $metadump_file
>
Doh! OK, you're right, looks like I'll need to change my glasses
graduation again.
>
> > Anyway, if you prefer, I'm fine sending v3 of this test doing something
> > like:
>
> Locally I just test this use case, it seems working as my guess.
That's odd. Here's the test I've used locally to confirm it works:
8<----------------------------------------------------------------
#!/bin/bash
MYVAR="HELLO"
myfunc()
{
echo "in function: $MYVAR"
}
MYVAR="$MYVAR WORLD" myfunc
MYVAR="$MYVAR WORLD" myfunc
myfunc
echo "$MYVAR"
8<----------------------------------------------------------------
When I run this in my laptop I see:
in function: HELLO WORLD
in function: HELLO WORLD
in function: HELLO
HELLO
Anyway, I think it's better to make this behaviour explicit in the test.
I'll send out v3 shortly. Thanks Xiubo.
Cheers,
--
Luís
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-06-27 10:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 15:14 [PATCH v2] ceph/005: verify correct statfs behaviour with quotas Luís Henriques
2022-06-25 15:06 ` Zorro Lang
2022-06-27 0:35 ` Xiubo Li
2022-06-27 9:20 ` Luís Henriques
2022-06-27 9:35 ` Xiubo Li
2022-06-27 10:25 ` 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