All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: test timestamps before the epoch
@ 2011-09-19 18:39 Eric Sandeen
  2011-09-22 16:48 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Eric Sandeen @ 2011-09-19 18:39 UTC (permalink / raw)
  To: xfs-oss; +Cc: Christoph Hellwig

ext2/3/4 was sign-extending times before the timestamp when read
from disk on 64-bit systems.  This was fixed by:

4d7bf11d649c72621ca31b8ea12b9c94af380e63
ext2/3/4: fix file date underflow on ext2 3 filesystems on 64 bit systems

Here's a generic regression test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/257 b/257
new file mode 100644
index 0000000..e837bef
--- /dev/null
+++ b/257
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 257
+#
+# Test timestamps prior to epoch
+# On 64-bit, ext2/3/4 was sign-extending when read from disk
+# See also commit 4d7bf11d649c72621ca31b8ea12b9c94af380e63
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2011 Red Hat, Inc.  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
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=sandeen@redhat.com
+
+seq=`basename $0`
+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
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+TESTFILE=$TEST_DIR/timestamp-test.txt
+
+# Create a file with a timestamp prior to the epoch
+echo "Creating file with timestamp of Jan 1, 1960"
+touch -t 196001010101 $TESTFILE
+# Should yield -315593940 (prior to epoch)
+echo -n "Stat of file yields: "
+stat -c %X $TESTFILE
+
+# unmount, remount, and check the timestamp
+echo "Remounting to flush cache"
+umount $TEST_DEV
+mount $TEST_DEV $TEST_DIR
+
+# Should yield -315593940 (prior to epoch)
+echo -n "Stat of file yields: "
+stat -c %X $TESTFILE
+
+status=0 ; exit
diff --git a/257.out b/257.out
new file mode 100644
index 0000000..c584b70
--- /dev/null
+++ b/257.out
@@ -0,0 +1,5 @@
+QA output created by 257
+Creating file with timestamp of Jan 1, 1960
+Stat of file yields: -315593940
+Remounting to flush cache
+Stat of file yields: -315593940
diff --git a/group b/group
index 0c746c8..84c45da 100644
--- a/group
+++ b/group
@@ -370,3 +370,4 @@ deprecated
 254 auto quick
 255 auto quick prealloc
 256 auto quick
+257 auto quick


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-19 18:39 [PATCH] xfstests: test timestamps before the epoch Eric Sandeen
@ 2011-09-22 16:48 ` Christoph Hellwig
  2011-09-22 19:41 ` Alex Elder
  2011-09-26 11:27 ` Christoph Hellwig
  2 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2011-09-22 16:48 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, xfs-oss

On Mon, Sep 19, 2011 at 01:39:13PM -0500, Eric Sandeen wrote:
> ext2/3/4 was sign-extending times before the timestamp when read
> from disk on 64-bit systems.  This was fixed by:
> 
> 4d7bf11d649c72621ca31b8ea12b9c94af380e63
> ext2/3/4: fix file date underflow on ext2 3 filesystems on 64 bit systems
> 
> Here's a generic regression test.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>


Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-19 18:39 [PATCH] xfstests: test timestamps before the epoch Eric Sandeen
  2011-09-22 16:48 ` Christoph Hellwig
@ 2011-09-22 19:41 ` Alex Elder
  2011-09-26 11:27 ` Christoph Hellwig
  2 siblings, 0 replies; 8+ messages in thread
From: Alex Elder @ 2011-09-22 19:41 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, xfs-oss

On Mon, 2011-09-19 at 13:39 -0500, Eric Sandeen wrote:
> ext2/3/4 was sign-extending times before the timestamp when read
> from disk on 64-bit systems.  This was fixed by:
> 
> 4d7bf11d649c72621ca31b8ea12b9c94af380e63
> ext2/3/4: fix file date underflow on ext2 3 filesystems on 64 bit systems
> 
> Here's a generic regression test.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks good.

Reviewed-by: Alex Elder <aelder@sgi.com>


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-19 18:39 [PATCH] xfstests: test timestamps before the epoch Eric Sandeen
  2011-09-22 16:48 ` Christoph Hellwig
  2011-09-22 19:41 ` Alex Elder
@ 2011-09-26 11:27 ` Christoph Hellwig
  2011-09-26 12:27   ` Alex Elder
  2 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2011-09-26 11:27 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, xfs-oss

This one actually ends up failing on XFS for me:

@@ -1,5 +1,5 @@
 QA output created by 258
 Creating file with timestamp of Jan 1, 1960
 -Stat of file yields: -315593940
 +Stat of file yields: -315615540
  Remounting to flush cache
 -Stat of file yields: -315593940
 +Stat of file yields: -315615540

Note that we still get the same for both, it just seems XFS rounds it
a bit different.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-26 11:27 ` Christoph Hellwig
@ 2011-09-26 12:27   ` Alex Elder
  2011-09-26 16:02     ` Eric Sandeen
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Elder @ 2011-09-26 12:27 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Eric Sandeen, xfs-oss

On Mon, 2011-09-26 at 07:27 -0400, Christoph Hellwig wrote:
> This one actually ends up failing on XFS for me:
> 
> @@ -1,5 +1,5 @@
>  QA output created by 258
>  Creating file with timestamp of Jan 1, 1960
>  -Stat of file yields: -315593940
>  +Stat of file yields: -315615540
>   Remounting to flush cache
>  -Stat of file yields: -315593940
>  +Stat of file yields: -315615540
> 
> Note that we still get the same for both, it just seems XFS rounds it
> a bit different.


I haven't seen this one fail.  Must have to do with
some FS configuration options (like blocksize or
something).

					-Alex

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-26 12:27   ` Alex Elder
@ 2011-09-26 16:02     ` Eric Sandeen
  2011-09-26 17:09       ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Sandeen @ 2011-09-26 16:02 UTC (permalink / raw)
  To: aelder; +Cc: Christoph Hellwig, xfs-oss

On 9/26/11 7:27 AM, Alex Elder wrote:
> On Mon, 2011-09-26 at 07:27 -0400, Christoph Hellwig wrote:
>> This one actually ends up failing on XFS for me:
>>
>> @@ -1,5 +1,5 @@
>>  QA output created by 258
>>  Creating file with timestamp of Jan 1, 1960
>>  -Stat of file yields: -315593940
>>  +Stat of file yields: -315615540
>>   Remounting to flush cache
>>  -Stat of file yields: -315593940
>>  +Stat of file yields: -315615540
>>
>> Note that we still get the same for both, it just seems XFS rounds it
>> a bit different.

Hrm.  Should we just test to be sure the timestamp is negative?
The sign extension is the real error, so as long as it's not
positive it's probably OK.

-Eric

> 
> I haven't seen this one fail.  Must have to do with
> some FS configuration options (like blocksize or
> something).
> 
> 					-Alex
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-26 16:02     ` Eric Sandeen
@ 2011-09-26 17:09       ` Christoph Hellwig
  2011-09-26 17:11         ` Eric Sandeen
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2011-09-26 17:09 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, xfs-oss, aelder

On Mon, Sep 26, 2011 at 11:02:05AM -0500, Eric Sandeen wrote:
> On 9/26/11 7:27 AM, Alex Elder wrote:
> > On Mon, 2011-09-26 at 07:27 -0400, Christoph Hellwig wrote:
> >> This one actually ends up failing on XFS for me:
> >>
> >> @@ -1,5 +1,5 @@
> >>  QA output created by 258
> >>  Creating file with timestamp of Jan 1, 1960
> >>  -Stat of file yields: -315593940
> >>  +Stat of file yields: -315615540
> >>   Remounting to flush cache
> >>  -Stat of file yields: -315593940
> >>  +Stat of file yields: -315615540
> >>
> >> Note that we still get the same for both, it just seems XFS rounds it
> >> a bit different.
> 
> Hrm.  Should we just test to be sure the timestamp is negative?
> The sign extension is the real error, so as long as it's not
> positive it's probably OK.

Probably.  This is on a 32-bit userspae, I guess that's why I see
different results from Alex.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfstests: test timestamps before the epoch
  2011-09-26 17:09       ` Christoph Hellwig
@ 2011-09-26 17:11         ` Eric Sandeen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2011-09-26 17:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs-oss, aelder

On 9/26/11 12:09 PM, Christoph Hellwig wrote:
> On Mon, Sep 26, 2011 at 11:02:05AM -0500, Eric Sandeen wrote:
>> On 9/26/11 7:27 AM, Alex Elder wrote:
>>> On Mon, 2011-09-26 at 07:27 -0400, Christoph Hellwig wrote:
>>>> This one actually ends up failing on XFS for me:
>>>>
>>>> @@ -1,5 +1,5 @@
>>>>  QA output created by 258
>>>>  Creating file with timestamp of Jan 1, 1960
>>>>  -Stat of file yields: -315593940
>>>>  +Stat of file yields: -315615540
>>>>   Remounting to flush cache
>>>>  -Stat of file yields: -315593940
>>>>  +Stat of file yields: -315615540
>>>>
>>>> Note that we still get the same for both, it just seems XFS rounds it
>>>> a bit different.
>>
>> Hrm.  Should we just test to be sure the timestamp is negative?
>> The sign extension is the real error, so as long as it's not
>> positive it's probably OK.
> 
> Probably.  This is on a 32-bit userspae, I guess that's why I see
> different results from Alex.
> 

could it be kernel clock resolution?

Anyway, I'll see about changing it to just check for negative nrs.

-Eric

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2011-09-26 17:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 18:39 [PATCH] xfstests: test timestamps before the epoch Eric Sandeen
2011-09-22 16:48 ` Christoph Hellwig
2011-09-22 19:41 ` Alex Elder
2011-09-26 11:27 ` Christoph Hellwig
2011-09-26 12:27   ` Alex Elder
2011-09-26 16:02     ` Eric Sandeen
2011-09-26 17:09       ` Christoph Hellwig
2011-09-26 17:11         ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.