FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Tue Nov 24, 2020 23:18



Post new topic Reply to topic  [ 9 posts ] 
ntfs-3g changes ctime and mtime on access 
Author Message

Joined: Sun Oct 11, 2015 21:26
Posts: 5
Post ntfs-3g changes ctime and mtime on access
Hi. I'm using ntfs-3g on FreeBSD. All seems to work fine except one thing: any access to any file on NTFS partition (even simple reading with cat <filename> command) modifies not only atime (access time), but also ctime (change time) and mtime (modify time).
Now I have timestamps damaged on all my photos after just watching them in thumbnails mode...

Steps to reproduce problem:
1. Minimal FreeBSD 10.2 installation.
2. Install ntfs-3g package (pkg install sysutils/fusefs-ntfs) or compile ntfs-3g from /usr/ports.
3. Load fuse module (kldload fuse or add to /boot/loader.conf)
4. ntfs-3g /dev/ada0s5 /media/D
5. stat /media/D/some-small-file.txt - shows atime, ctime, mtime
6. cat /media/D/some-small-file.txt - simple reading with cat
7. stat /media/D/some-small-file.txt - shows that ctime and mtime are updated to current time.


Sun Oct 11, 2015 21:44
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: ntfs-3g changes ctime and mtime on access
Hi,

Quote:
any access to any file on NTFS partition (even simple reading with cat <filename> command) modifies not only atime (access time), but also ctime (change time) and mtime (modify time).
Now I have timestamps damaged on all my photos after just watching them in thumbnails mode...

I could not reproduce this on OpenIndiana (I do not have FreeBSD). I however found an issue which might be related to what you reported :
Code:
[root@openindiana]# echo data > test
[root@openindiana]# stat test
  File: ‘test’
  Size: 5               Blocks: 1          IO Block: 512    regular file
Device: 4780001h/74973185d      Inode: 89          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-10-14 10:39:02.545545000 +0200
Modify: 2015-10-14 10:39:02.549629000 +0200
Change: 2015-10-14 10:39:02.549629000 +0200
Birth: -
[root@openindiana]# cat test
data
[root@openindiana]# stat test
  File: ‘test’
  Size: 5               Blocks: 1          IO Block: 512    regular file
Device: 4780001h/74973185d      Inode: 89          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-10-14 10:39:02.545545000 +0200
Modify: 2015-10-14 10:39:02.549629000 +0200
Change: 2015-10-14 10:39:02.549629000 +0200
Birth: -

Reading the file does not appear to change the access time.

Digging into this showed that the file reading is not done by ntfs-3g. The data is just fetched from cache without ntfs-3g being notified. This is a bug in the OpenIndiana fuse kernel module which is a port from the FreeBSD one.

Regards

Jean-Pierre


Wed Oct 14, 2015 11:01
Profile

Joined: Sun Oct 11, 2015 21:26
Posts: 5
Post Re: ntfs-3g changes ctime and mtime on access
Thank you for attention...
I tried to repeat the test inside virtual machine (VirtualBox 4.3.30). NTFS partition was created and formatted from Windows 7.
Nothing except FreeBSD 10.2 and ntfs-3g was installed.

Image

But if you say that it is not ntfs-3g problem, all I can is trust you :(
Thanks any way. Good luck.


Wed Oct 14, 2015 12:47
Profile

Joined: Sun Oct 11, 2015 21:26
Posts: 5
Post Re: ntfs-3g changes ctime and mtime on access
Seems like ctime and mtime are updated only on first access after reboot (or mounting partition?).
Maybe this is why you can't reproduce problem? You have to use existing file or reboot after creating file...
Sorry for bothering.


Wed Oct 14, 2015 13:19
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: ntfs-3g changes ctime and mtime on access
Hi,

Quote:
Seems like ctime and mtime are updated only on first access after reboot (or mounting partition?).

So most likely the cache management is part of the issue. On first access ntfs-3g is obviously called to get the data and feed the cache, but subsequent reads are served from the cache without ntfs-3g being notified. This does however not explain why mtime and ctime are updated instead of atime...

I will try to fix the cache issue in the fuse kernel for OpenIndiana, but I will not be able to back-port to FreeBSD. AFAIK fuse for FreeBSD is not supported any more...

Regards

Jean-Pierre


Wed Oct 14, 2015 14:06
Profile

Joined: Sun Oct 18, 2015 10:12
Posts: 2
Post Re: ntfs-3g changes ctime and mtime on access
jpa wrote:
AFAIK fuse for FreeBSD is not supported any more...


To the contrary, it is part of the base operating system:

https://svnweb.freebsd.org/base?view=re ... ion=241519


Sun Oct 18, 2015 10:19
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: ntfs-3g changes ctime and mtime on access
Hi,

Quote:
Quote:
jpa wrote:
AFAIK fuse for FreeBSD is not supported any more...

To the contrary, it is part of the base operating system:

Then you have to report to whom is supporting the fuse kernel module...

I have fixed the access time issue on OpenIndiana when data is cached following a write(), but the FreeBSD issue is different (attributes are not cached on FreeBSD).

Regards

Jean-Pierre


Sun Oct 18, 2015 14:55
Profile

Joined: Sun Oct 11, 2015 21:26
Posts: 5
Post Re: ntfs-3g changes ctime and mtime on access
No such problems with fusefs-exfat


Sat Oct 31, 2015 11:11
Profile

Joined: Sun Oct 11, 2015 21:26
Posts: 5
Post Re: ntfs-3g changes ctime and mtime on access
And even old ntfsmount works fine... Modifies atime after access, ctime/mtime only after editing file.


Sat Oct 31, 2015 12:32
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.