All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: idank <idank@tonian.com>
Cc: linux-btrfs@vger.kernel.org,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: btrfs truncate() does not change inode times
Date: Fri, 06 Jan 2012 11:32:13 +0800	[thread overview]
Message-ID: <4F066B3D.6000402@cn.fujitsu.com> (raw)
In-Reply-To: <4F05A821.8090202@tonian.com>

idank wrote:
> Hi all,
> I was running fstest (http://www.tuxera.com/community/posix-test-suit=
e/) on btrfs. Only one test failed, and I believe it to be a bug in btr=
fs. The scenario is as follows:
> * crate a file.
> * note its times with stat.
> * sleep a few seconds
> * call truncate() on the file (not ftruncate(). ftruncate() works).
> * sync
> * note the file's times again with stat.
> expected result: ctime and mtime are greater.
> actual result: ctime and mtime remain unchanged.
>=20
> Example:

I followed your example, but got the expected result:

[root@lizf pjd-fstest-20090130-RC]# stat ctime_test=20
  File: "ctime_test"
  Size: 0               Blocks: 0          IO Block: 4096   =E6=99=AE=E9=
=80=9A=E7=A9=BA=E6=96=87=E4=BB=B6
Device: 1bh/27d Inode: 1589980     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root=
)
Access: 2012-01-06 10:27:53.900570365 +0800
Modify: 2012-01-06 10:27:53.900570365 +0800
Change: 2012-01-06 10:27:53.900570365 +0800
[root@lizf pjd-fstest-20090130-RC]# ./fstest truncate ctime_test 200
0
[root@lizf pjd-fstest-20090130-RC]# sleep 2
[root@lizf pjd-fstest-20090130-RC]# stat ctime_test=20
  File: "ctime_test"
  Size: 200             Blocks: 0          IO Block: 4096   =E6=99=AE=E9=
=80=9A=E6=96=87=E4=BB=B6
Device: 1bh/27d Inode: 1589980     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root=
)
Access: 2012-01-06 10:27:53.900570365 +0800
Modify: 2012-01-06 10:28:12.238569720 +0800
Change: 2012-01-06 10:28:12.238569720 +0800
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel=
" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: idank <idank@tonian.com>
Cc: linux-btrfs@vger.kernel.org,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: btrfs truncate() does not change inode times
Date: Fri, 06 Jan 2012 11:32:13 +0800	[thread overview]
Message-ID: <4F066B3D.6000402@cn.fujitsu.com> (raw)
In-Reply-To: <4F05A821.8090202@tonian.com>

idank wrote:
> Hi all,
> I was running fstest (http://www.tuxera.com/community/posix-test-suite/) on btrfs. Only one test failed, and I believe it to be a bug in btrfs. The scenario is as follows:
> * crate a file.
> * note its times with stat.
> * sleep a few seconds
> * call truncate() on the file (not ftruncate(). ftruncate() works).
> * sync
> * note the file's times again with stat.
> expected result: ctime and mtime are greater.
> actual result: ctime and mtime remain unchanged.
> 
> Example:

I followed your example, but got the expected result:

[root@lizf pjd-fstest-20090130-RC]# stat ctime_test 
  File: "ctime_test"
  Size: 0               Blocks: 0          IO Block: 4096   普通空文件
Device: 1bh/27d Inode: 1589980     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-01-06 10:27:53.900570365 +0800
Modify: 2012-01-06 10:27:53.900570365 +0800
Change: 2012-01-06 10:27:53.900570365 +0800
[root@lizf pjd-fstest-20090130-RC]# ./fstest truncate ctime_test 200
0
[root@lizf pjd-fstest-20090130-RC]# sleep 2
[root@lizf pjd-fstest-20090130-RC]# stat ctime_test 
  File: "ctime_test"
  Size: 200             Blocks: 0          IO Block: 4096   普通文件
Device: 1bh/27d Inode: 1589980     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-01-06 10:27:53.900570365 +0800
Modify: 2012-01-06 10:28:12.238569720 +0800
Change: 2012-01-06 10:28:12.238569720 +0800
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-01-06  3:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 13:39 btrfs truncate() does not change inode times idank
2012-01-06  3:32 ` Li Zefan [this message]
2012-01-06  3:32   ` Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F066B3D.6000402@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=idank@tonian.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.