NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60800: tmpfs: missing ctime updates



>Number:         60800
>Category:       kern
>Synopsis:       tmpfs: missing ctime updates
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 26 14:35:00 +0000 2026
>Originator:     Thomas Klausner
>Release:        NetBSD 11.99.8
>Organization:
	
>Environment:
	
	
Architecture: x86_64
Machine: amd64
>Description:
While testing coreutils 9.12 on -current we noticed that 'touch'
doesn't change the ctime on tmpfs, but does change it on ffs.

The script:

#!/bin/sh
touch a || fail=1
btime=$(stat -f %B a) || fail=1
atime=$(stat -f %a a) || fail=1
ctime=$(stat -f %c a) || fail=1
mtime=$(stat -f %m a) || fail=1
echo $btime $atime $ctime $mtime

Running this twice on tmpfs gives:

# ~/nbtest.sh
1790414618 1790414618 1790414618 1790414618
# ~/nbtest.sh
1790414618 1790414620 1790414618 1790414620

Same ctime.

It's different on ffs:

# ./nbtest.sh
1790414514 1790414604 1790414604 1790414604
# ./nbtest.sh
1790414514 1790414611 1790414611 1790414611

Different ctime.

https://pubs.opengroup.org/onlinepubs/9799919799/functions/futimens.html

has

"Upon successful completion, futimens() and utimensat() shall mark the
last file status change timestamp for update, with the exception that
if both tv_nsec fields are set to UTIME_OMIT, the file status change
timestamp need not be marked for update."

where I think that 'last file status change timestamp' refers to
ctime, and so I think this reads as 'it should be updated as well'.

Either way, it should be consistent between tmpfs and ffs.
>How-To-Repeat:
See above.
>Fix:
gdt said in the thread on current-users:

> I think updating ctime is missing in
> 
>   src/sys/fs/tmpfs_subr.c:tmpfs_chtimes()
> 
> and probably needs
> 
>   tmpfs_update(vp, TMPFS_UPDATE_CTIME);

>Unformatted:
 	
 	



Home | Main Index | Thread Index | Old Index