* [PATCH] generic/407: check that destination timestamps are updated on clone
@ 2017-02-02 16:27 Christoph Hellwig
2017-02-02 19:43 ` Amir Goldstein
2017-02-02 20:17 ` Darrick J. Wong
0 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2017-02-02 16:27 UTC (permalink / raw)
To: fstests
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/generic/407 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/407.out | 2 ++
tests/generic/group | 1 +
3 files changed, 88 insertions(+)
create mode 100755 tests/generic/407
create mode 100644 tests/generic/407.out
diff --git a/tests/generic/407 b/tests/generic/407
new file mode 100755
index 00000000..94d8af5f
--- /dev/null
+++ b/tests/generic/407
@@ -0,0 +1,85 @@
+#! /bin/bash
+# FS QA Test No. 407
+#
+# Verify that mtime is updated when cloning files
+#
+#-----------------------------------------------------------------------
+#
+# Copyright (c) 2014 Christoph Hellwig. All Rights Reserved.
+# 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
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=0
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+ rm -f $destfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. common/reflink
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+_require_cp_reflink
+_require_test
+
+echo "Silence is golden."
+rm -f $seqres.full
+
+# pattern the file.
+sourcefile=$TEST_DIR/clone_mtime_sourcefile
+$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
+
+destfile=$TEST_DIR/clone_mtime_destfile
+touch $destfile >> $seqres.full
+
+# sample timestamps.
+mtime1=`stat -c %Y $destfile`
+ctime1=`stat -c %Z $destfile`
+echo "before clone: $mtime1 $ctime1" >> $seqres.full
+
+# clone to trigger timestamp change
+sleep 2
+$XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
+
+# sample and verify that timestamps have changed.
+mtime2=`stat -c %Y $destfile`
+ctime2=`stat -c %Z $destfile`
+echo "after clone : $mtime2 $ctime2" >> $seqres.full
+
+if [ "$mtime1" == "$mtime2" ]; then
+ echo "mtime not updated"
+ let status=$status+1
+fi
+if [ "$ctime1" == "$ctime2" ]; then
+ echo "ctime not updated"
+ let status=$status+1
+fi
+
+exit
diff --git a/tests/generic/407.out b/tests/generic/407.out
new file mode 100644
index 00000000..e29fe156
--- /dev/null
+++ b/tests/generic/407.out
@@ -0,0 +1,2 @@
+QA output created by 407
+Silence is golden.
diff --git a/tests/generic/group b/tests/generic/group
index 159d691b..72d6b3cb 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -409,3 +409,4 @@
404 auto quick insert
405 auto mkfs
406 auto quick dangerous
+407 auto quick clone metadata
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] generic/407: check that destination timestamps are updated on clone
2017-02-02 16:27 [PATCH] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
@ 2017-02-02 19:43 ` Amir Goldstein
2017-02-02 19:46 ` Amir Goldstein
2017-02-03 9:56 ` Christoph Hellwig
2017-02-02 20:17 ` Darrick J. Wong
1 sibling, 2 replies; 7+ messages in thread
From: Amir Goldstein @ 2017-02-02 19:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: fstests
On Thu, Feb 2, 2017 at 6:27 PM, Christoph Hellwig <hch@lst.de> wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/generic/407 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/407.out | 2 ++
> tests/generic/group | 1 +
> 3 files changed, 88 insertions(+)
> create mode 100755 tests/generic/407
> create mode 100644 tests/generic/407.out
>
> diff --git a/tests/generic/407 b/tests/generic/407
> new file mode 100755
> index 00000000..94d8af5f
> --- /dev/null
> +++ b/tests/generic/407
> @@ -0,0 +1,85 @@
> +#! /bin/bash
> +# FS QA Test No. 407
> +#
> +# Verify that mtime is updated when cloning files
> +#
> +#-----------------------------------------------------------------------
> +#
> +# Copyright (c) 2014 Christoph Hellwig. All Rights Reserved.
> +# 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
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=0
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.*
> + rm -f $destfile
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. common/reflink
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_cp_reflink
> +_require_test
> +
> +echo "Silence is golden."
> +rm -f $seqres.full
> +
> +# pattern the file.
> +sourcefile=$TEST_DIR/clone_mtime_sourcefile
> +$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
> +
> +destfile=$TEST_DIR/clone_mtime_destfile
> +touch $destfile >> $seqres.full
> +
> +# sample timestamps.
> +mtime1=`stat -c %Y $destfile`
> +ctime1=`stat -c %Z $destfile`
> +echo "before clone: $mtime1 $ctime1" >> $seqres.full
> +
> +# clone to trigger timestamp change
> +sleep 2
I am thinking about starting a myth about an angel dying on every sleep 1 ;-)
Although this may be nit picking, why 2 seconds?
I see there are several tests that use sleep 1 for the same sort of test
and then there is generic/368, which uses a much more elegant
touch -d '1 hour ago'
Please consider.
> +$XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
> +
> +# sample and verify that timestamps have changed.
> +mtime2=`stat -c %Y $destfile`
> +ctime2=`stat -c %Z $destfile`
> +echo "after clone : $mtime2 $ctime2" >> $seqres.full
> +
> +if [ "$mtime1" == "$mtime2" ]; then
> + echo "mtime not updated"
> + let status=$status+1
> +fi
> +if [ "$ctime1" == "$ctime2" ]; then
> + echo "ctime not updated"
> + let status=$status+1
> +fi
> +
> +exit
> diff --git a/tests/generic/407.out b/tests/generic/407.out
> new file mode 100644
> index 00000000..e29fe156
> --- /dev/null
> +++ b/tests/generic/407.out
> @@ -0,0 +1,2 @@
> +QA output created by 407
> +Silence is golden.
> diff --git a/tests/generic/group b/tests/generic/group
> index 159d691b..72d6b3cb 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -409,3 +409,4 @@
> 404 auto quick insert
> 405 auto mkfs
> 406 auto quick dangerous
> +407 auto quick clone metadata
> --
> 2.11.0
>
> --
> 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] 7+ messages in thread
* Re: [PATCH] generic/407: check that destination timestamps are updated on clone
2017-02-02 19:43 ` Amir Goldstein
@ 2017-02-02 19:46 ` Amir Goldstein
2017-02-03 9:56 ` Christoph Hellwig
1 sibling, 0 replies; 7+ messages in thread
From: Amir Goldstein @ 2017-02-02 19:46 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: fstests
On Thu, Feb 2, 2017 at 9:43 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Thu, Feb 2, 2017 at 6:27 PM, Christoph Hellwig <hch@lst.de> wrote:
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> ---
>> tests/generic/407 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
>> tests/generic/407.out | 2 ++
>> tests/generic/group | 1 +
>> 3 files changed, 88 insertions(+)
>> create mode 100755 tests/generic/407
>> create mode 100644 tests/generic/407.out
>>
>> diff --git a/tests/generic/407 b/tests/generic/407
>> new file mode 100755
>> index 00000000..94d8af5f
>> --- /dev/null
>> +++ b/tests/generic/407
>> @@ -0,0 +1,85 @@
>> +#! /bin/bash
>> +# FS QA Test No. 407
>> +#
>> +# Verify that mtime is updated when cloning files
>> +#
>> +#-----------------------------------------------------------------------
>> +#
>> +# Copyright (c) 2014 Christoph Hellwig. All Rights Reserved.
>> +# 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
>> +#-----------------------------------------------------------------------
>> +#
>> +
>> +seq=`basename $0`
>> +seqres=$RESULT_DIR/$seq
>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
>> +tmp=/tmp/$$
>> +status=0
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> + cd /
>> + rm -f $tmp.*
>> + rm -f $destfile
>> +}
>> +
>> +# get standard environment, filters and checks
>> +. ./common/rc
>> +. ./common/filter
>> +. common/reflink
>> +
>> +# real QA test starts here
>> +_supported_fs generic
>> +_supported_os Linux
>> +
>> +_require_cp_reflink
>> +_require_test
>> +
>> +echo "Silence is golden."
>> +rm -f $seqres.full
>> +
>> +# pattern the file.
>> +sourcefile=$TEST_DIR/clone_mtime_sourcefile
>> +$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
>> +
>> +destfile=$TEST_DIR/clone_mtime_destfile
>> +touch $destfile >> $seqres.full
>> +
>> +# sample timestamps.
>> +mtime1=`stat -c %Y $destfile`
>> +ctime1=`stat -c %Z $destfile`
>> +echo "before clone: $mtime1 $ctime1" >> $seqres.full
>> +
>> +# clone to trigger timestamp change
>> +sleep 2
>
> I am thinking about starting a myth about an angel dying on every sleep 1 ;-)
>
> Although this may be nit picking, why 2 seconds?
> I see there are several tests that use sleep 1 for the same sort of test
> and then there is generic/368, which uses a much more elegant
> touch -d '1 hour ago'
>
Sorry, that's no good for ctime.
Question about sleep 2 still stands.
> Please consider.
>
>> +$XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
>> +
>> +# sample and verify that timestamps have changed.
>> +mtime2=`stat -c %Y $destfile`
>> +ctime2=`stat -c %Z $destfile`
>> +echo "after clone : $mtime2 $ctime2" >> $seqres.full
>> +
>> +if [ "$mtime1" == "$mtime2" ]; then
>> + echo "mtime not updated"
>> + let status=$status+1
>> +fi
>> +if [ "$ctime1" == "$ctime2" ]; then
>> + echo "ctime not updated"
>> + let status=$status+1
>> +fi
>> +
>> +exit
>> diff --git a/tests/generic/407.out b/tests/generic/407.out
>> new file mode 100644
>> index 00000000..e29fe156
>> --- /dev/null
>> +++ b/tests/generic/407.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 407
>> +Silence is golden.
>> diff --git a/tests/generic/group b/tests/generic/group
>> index 159d691b..72d6b3cb 100644
>> --- a/tests/generic/group
>> +++ b/tests/generic/group
>> @@ -409,3 +409,4 @@
>> 404 auto quick insert
>> 405 auto mkfs
>> 406 auto quick dangerous
>> +407 auto quick clone metadata
>> --
>> 2.11.0
>>
>> --
>> 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] 7+ messages in thread
* Re: [PATCH] generic/407: check that destination timestamps are updated on clone
2017-02-02 16:27 [PATCH] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
2017-02-02 19:43 ` Amir Goldstein
@ 2017-02-02 20:17 ` Darrick J. Wong
1 sibling, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2017-02-02 20:17 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: fstests
On Thu, Feb 02, 2017 at 05:27:55PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> tests/generic/407 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/407.out | 2 ++
> tests/generic/group | 1 +
> 3 files changed, 88 insertions(+)
> create mode 100755 tests/generic/407
> create mode 100644 tests/generic/407.out
>
> diff --git a/tests/generic/407 b/tests/generic/407
> new file mode 100755
> index 00000000..94d8af5f
> --- /dev/null
> +++ b/tests/generic/407
> @@ -0,0 +1,85 @@
> +#! /bin/bash
> +# FS QA Test No. 407
> +#
> +# Verify that mtime is updated when cloning files
> +#
> +#-----------------------------------------------------------------------
> +#
> +# Copyright (c) 2014 Christoph Hellwig. All Rights Reserved.
> +# 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
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=0
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.*
> + rm -f $destfile
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. common/reflink
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_cp_reflink
> +_require_test
> +
> +echo "Silence is golden."
> +rm -f $seqres.full
> +
> +# pattern the file.
> +sourcefile=$TEST_DIR/clone_mtime_sourcefile
> +$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
> +
> +destfile=$TEST_DIR/clone_mtime_destfile
> +touch $destfile >> $seqres.full
> +
> +# sample timestamps.
> +mtime1=`stat -c %Y $destfile`
> +ctime1=`stat -c %Z $destfile`
> +echo "before clone: $mtime1 $ctime1" >> $seqres.full
> +
> +# clone to trigger timestamp change
> +sleep 2
> +$XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
This follow from the discussion of "xfs: update ctime and mtime on clone
destinatation inodes" -- there ought to be a second test that dedupe
doesn't modify mtime.
--D
> +
> +# sample and verify that timestamps have changed.
> +mtime2=`stat -c %Y $destfile`
> +ctime2=`stat -c %Z $destfile`
> +echo "after clone : $mtime2 $ctime2" >> $seqres.full
> +
> +if [ "$mtime1" == "$mtime2" ]; then
> + echo "mtime not updated"
> + let status=$status+1
> +fi
> +if [ "$ctime1" == "$ctime2" ]; then
> + echo "ctime not updated"
> + let status=$status+1
> +fi
> +
> +exit
> diff --git a/tests/generic/407.out b/tests/generic/407.out
> new file mode 100644
> index 00000000..e29fe156
> --- /dev/null
> +++ b/tests/generic/407.out
> @@ -0,0 +1,2 @@
> +QA output created by 407
> +Silence is golden.
> diff --git a/tests/generic/group b/tests/generic/group
> index 159d691b..72d6b3cb 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -409,3 +409,4 @@
> 404 auto quick insert
> 405 auto mkfs
> 406 auto quick dangerous
> +407 auto quick clone metadata
> --
> 2.11.0
>
> --
> 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] 7+ messages in thread
* Re: [PATCH] generic/407: check that destination timestamps are updated on clone
2017-02-02 19:43 ` Amir Goldstein
2017-02-02 19:46 ` Amir Goldstein
@ 2017-02-03 9:56 ` Christoph Hellwig
2017-02-03 10:32 ` Amir Goldstein
1 sibling, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2017-02-03 9:56 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Christoph Hellwig, fstests
> Although this may be nit picking, why 2 seconds?
Copied from a test that did it, 1 is enough though.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] generic/407: check that destination timestamps are updated on clone
2017-02-03 9:56 ` Christoph Hellwig
@ 2017-02-03 10:32 ` Amir Goldstein
2017-02-03 10:34 ` Christoph Hellwig
0 siblings, 1 reply; 7+ messages in thread
From: Amir Goldstein @ 2017-02-03 10:32 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: fstests
On Fri, Feb 3, 2017 at 11:56 AM, Christoph Hellwig <hch@lst.de> wrote:
>> Although this may be nit picking, why 2 seconds?
>
> Copied from a test that did it, 1 is enough though.
Yes, I saw that, generic/215 which was copied from generic/080 I guess
someone should clean up those 2 some time.
And while we are busy saving more angels lives, do 407 and 408 really need
to be separate tests?
How about consolidating them into a single test that works with 2 sets of files?
Sorry again for nit picking on those lost seconds.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] generic/407: check that destination timestamps are updated on clone
2017-02-03 10:32 ` Amir Goldstein
@ 2017-02-03 10:34 ` Christoph Hellwig
0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2017-02-03 10:34 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Christoph Hellwig, fstests
On Fri, Feb 03, 2017 at 12:32:21PM +0200, Amir Goldstein wrote:
> Yes, I saw that, generic/215 which was copied from generic/080 I guess
> someone should clean up those 2 some time.
>
> And while we are busy saving more angels lives, do 407 and 408 really need
> to be separate tests?
> How about consolidating them into a single test that works with 2 sets of files?
> Sorry again for nit picking on those lost seconds.
We can't do that as there are file systems that support clone but not
dedup (e.g. NFS).
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-03 10:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-02 16:27 [PATCH] generic/407: check that destination timestamps are updated on clone Christoph Hellwig
2017-02-02 19:43 ` Amir Goldstein
2017-02-02 19:46 ` Amir Goldstein
2017-02-03 9:56 ` Christoph Hellwig
2017-02-03 10:32 ` Amir Goldstein
2017-02-03 10:34 ` Christoph Hellwig
2017-02-02 20:17 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox