Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.kernel > #93785 > unrolled thread
| Started by | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| First post | 2026-08-19 14:00 +0200 |
| Last post | 2026-08-19 19:20 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.debian.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Vincent Lefevre <vincent@vinc17.net> - 2026-08-19 14:00 +0200
Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Vincent Lefevre <vincent@vinc17.net> - 2026-08-19 14:30 +0200
Processed: Re: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency "Debian Bug Tracking System" <owner@bugs.debian.org> - 2026-08-19 14:30 +0200
Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Salvatore Bonaccorso <carnil@debian.org> - 2026-08-19 16:00 +0200
Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Vincent Lefevre <vincent@vinc17.net> - 2026-08-19 16:30 +0200
Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Vincent Lefevre <vincent@vinc17.net> - 2026-08-19 17:20 +0200
Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Vincent Lefevre <vincent@vinc17.net> - 2026-08-19 19:20 +0200
| From | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| Date | 2026-08-19 14:00 +0200 |
| Subject | Bug#1144613: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency |
| Message-ID | <NtN7z-bSDS-1@gated-at.bofh.it> |
Here's a simple program to reproduce the issue. On my machine,
a difference is output many times every second (apparently,
when the clock is very close to an integer number of seconds).
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/stat.h>
const char fname[] = "timetest.txt";
int main(void)
{
while (1)
{
struct stat st;
FILE *f;
time_t t;
f = fopen(fname, "w");
if (f == NULL)
exit(1);
fclose(f);
t = time(NULL);
if (stat(fname, &st) != 0)
exit(1);
if (t < st.st_mtime)
printf("%ld %ld\n", (long) t, (long) st.st_mtime);
}
}
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
[toc] | [next] | [standalone]
| From | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| Date | 2026-08-19 14:30 +0200 |
| Message-ID | <NtNAB-bSXq-3@gated-at.bofh.it> |
| In reply to | #93785 |
Control: retitle -1 linux-image-7.1.6+deb14-amd64: st_mtime and time() inconsistency On 2026-08-19 13:48:48 +0200, Vincent Lefevre wrote: > Here's a simple program to reproduce the issue. On my machine, > a difference is output many times every second (apparently, > when the clock is very close to an integer number of seconds). [...] This also occurs in /dev/shm (tmpfs). And I cannot reproduce this issue under Debian 13 (trixie) with the 6.12.96+deb13-amd64 kernel. -- Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
[toc] | [prev] | [next] | [standalone]
| From | "Debian Bug Tracking System" <owner@bugs.debian.org> |
|---|---|
| Date | 2026-08-19 14:30 +0200 |
| Subject | Processed: Re: linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency |
| Message-ID | <NtNAC-bSXq-13@gated-at.bofh.it> |
| In reply to | #93787 |
Processing control commands: > retitle -1 linux-image-7.1.6+deb14-amd64: st_mtime and time() inconsistency Bug #1144613 [src:linux] linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency Changed Bug title to 'linux-image-7.1.6+deb14-amd64: st_mtime and time() inconsistency' from 'linux-image-7.1.6+deb14-amd64: ext4 st_mtime and time() inconsistency'. -- 1144613: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1144613 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
[toc] | [prev] | [next] | [standalone]
| From | Salvatore Bonaccorso <carnil@debian.org> |
|---|---|
| Date | 2026-08-19 16:00 +0200 |
| Message-ID | <NtOZH-bTCD-1@gated-at.bofh.it> |
| In reply to | #93787 |
Hi,
On Wed, Aug 19, 2026 at 02:28:51PM +0200, Vincent Lefevre wrote:
> Control: retitle -1 linux-image-7.1.6+deb14-amd64: st_mtime and time() inconsistency
>
> On 2026-08-19 13:48:48 +0200, Vincent Lefevre wrote:
> > Here's a simple program to reproduce the issue. On my machine,
> > a difference is output many times every second (apparently,
> > when the clock is very close to an integer number of seconds).
> [...]
>
> This also occurs in /dev/shm (tmpfs).
>
> And I cannot reproduce this issue under Debian 13 (trixie) with
> the 6.12.96+deb13-amd64 kernel.
I think this is a consequence of 4e40eff0b5737c ("fs: add
infrastructure for multigrain timestamps") and following in 6.13-rc1.
time(2) has only an accurancy in second, so the code might need to
use clock_gettime(2).
Regards,
Salvatore
[toc] | [prev] | [next] | [standalone]
| From | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| Date | 2026-08-19 16:30 +0200 |
| Message-ID | <NtPsJ-bTWa-9@gated-at.bofh.it> |
| In reply to | #93794 |
On 2026-08-19 15:50:16 +0200, Salvatore Bonaccorso wrote:
> I think this is a consequence of 4e40eff0b5737c ("fs: add
> infrastructure for multigrain timestamps") and following in 6.13-rc1.
>
> time(2) has only an accurancy in second, so the code might need to
> use clock_gettime(2).
The accuracy does not matter. This is a question of consistency.
If an event A occurs before an event B, one expects to have
time(A) <= time(B).
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
[toc] | [prev] | [next] | [standalone]
| From | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| Date | 2026-08-19 17:20 +0200 |
| Message-ID | <NtQf7-bUnP-7@gated-at.bofh.it> |
| In reply to | #93796 |
On 2026-08-19 16:22:53 +0200, Vincent Lefevre wrote:
> On 2026-08-19 15:50:16 +0200, Salvatore Bonaccorso wrote:
> > I think this is a consequence of 4e40eff0b5737c ("fs: add
> > infrastructure for multigrain timestamps") and following in 6.13-rc1.
Probably not (or not entirely), as there is another issue not involving
the filesystem (see below).
> > time(2) has only an accurancy in second, so the code might need to
> > use clock_gettime(2).
>
> The accuracy does not matter. This is a question of consistency.
> If an event A occurs before an event B, one expects to have
> time(A) <= time(B).
Now, comparing time(NULL) and clock_gettime(CLOCK_REALTIME, &ts):
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
while (1)
{
struct timespec ts;
time_t t;
clock_gettime(CLOCK_REALTIME, &ts);
t = time(NULL);
if (ts.tv_nsec < 0)
exit(1);
if (t < ts.tv_sec)
printf("%ld %ld\n", (long) t, (long) ts.tv_sec);
}
}
Since clock_gettime is called before time(NULL), one expects that
its time (including nanoseconds) is <= t, and since the number of
nanoseconds is non-negative (which is checked by the above code),
one should have ts.tv_sec <= t, i.e. the test t < ts.tv_sec should
be always false. But I get output at each second!
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
[toc] | [prev] | [next] | [standalone]
| From | Vincent Lefevre <vincent@vinc17.net> |
|---|---|
| Date | 2026-08-19 19:20 +0200 |
| Message-ID | <NtS7f-bVn2-7@gated-at.bofh.it> |
| In reply to | #93798 |
On 2026-08-19 17:00:45 +0200, Vincent Lefevre wrote:
> On 2026-08-19 16:22:53 +0200, Vincent Lefevre wrote:
> > On 2026-08-19 15:50:16 +0200, Salvatore Bonaccorso wrote:
> > > I think this is a consequence of 4e40eff0b5737c ("fs: add
> > > infrastructure for multigrain timestamps") and following in 6.13-rc1.
>
> Probably not (or not entirely), as there is another issue not involving
> the filesystem (see below).
With the 6.12.96+deb13-amd64 kernel, I get the inconsistency
between time(NULL) and clock_gettime(CLOCK_REALTIME, ...),
and even with 6.1.0-52-amd64 (bookworm).
This could mean that this old issue propagated to the filesystem,
probably due to 4e40eff0b5737c.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.kernel
csiph-web