Bug 90192 - ConditionNeedsUpdate should ignore milliseconds
Summary: ConditionNeedsUpdate should ignore milliseconds
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-27 12:44 UTC by qqqqqqqqq9
Modified: 2015-04-27 15:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
strace /usr/lib/systemd/systemd-update-done as root (3.99 KB, text/plain)
2015-04-27 14:36 UTC, qqqqqqqqq9
Details
dumpe2fs /dev/mapper/etc (first half) (1.76 KB, text/plain)
2015-04-27 14:57 UTC, qqqqqqqqq9
Details
dumpe2fs /dev/sda5 (first half) (1.97 KB, text/plain)
2015-04-27 14:58 UTC, qqqqqqqqq9
Details

Description qqqqqqqqq9 2015-04-27 12:44:02 UTC
Hi, 
when i run 
systemctl restart systemd-update-done

i get the following timestamps:

 stat /etc/.updated /var/.updated /usr/
„/etc/.updated“
Zugriff    : 2015-04-27 12:07:55.000000000 +0200
Modifiziert: 2015-04-27 12:07:55.000000000 +0200
Geändert   : 2015-04-27 14:39:28.000000000 +0200

Datei: „/var/.updated“
Zugriff    : 2015-04-27 12:07:55.240078746 +0200
Modifiziert: 2015-04-27 12:07:55.240078746 +0200
Geändert   : 2015-04-27 14:39:28.382725004 +0200

Datei: „/usr/“
Zugriff    : 2015-04-27 13:22:43.806556656 +0200
Modifiziert: 2015-04-27 12:07:55.240078746 +0200
Geändert   : 2015-04-27 12:07:55.240078746 +0200

As you can see, the filesystem under /etc (ext4 on dm-crypt) doesn't support nanoseconds whereas the one under /var and /usr (ext4) does.

This means /etc/.updated is always older than /usr and ConditionNeedsUpdate is always true.
Comment 1 Lennart Poettering 2015-04-27 14:26:12 UTC
Hmm, this is really weird. ext4 supports nsec resolution just fine normally, and s-u-d makes use of utimensat() and futimens() to apply it, which has the necessary resolution. We also apply the exact same timestamp to both /etc/.updated and /var/.updated, it's really weird that they should be different...

Any chance you can invoke "strace /usr/lib/systemd/systemd-update-done" as root and attach the last 150 lines of output this generates here?

is it possible that the file system uses different mount options or feature settings in the header? (the latter check with dumpe2fs)

This is really weird...
Comment 2 qqqqqqqqq9 2015-04-27 14:36:50 UTC
Created attachment 115376 [details]
strace  /usr/lib/systemd/systemd-update-done  as root
Comment 3 Lennart Poettering 2015-04-27 14:42:52 UTC
Hmm, so the stat() apparently indicated that the .updated file in /var was already new enough... Wich is strange...

if you remove both files, and run it again, does it work then? if you run the tool multiple times ahen, does it break again?
Comment 4 qqqqqqqqq9 2015-04-27 14:57:11 UTC
Created attachment 115377 [details]
dumpe2fs /dev/mapper/etc (first half)
Comment 5 qqqqqqqqq9 2015-04-27 14:58:32 UTC
Created attachment 115378 [details]
dumpe2fs /dev/sda5 (first half)
Comment 6 qqqqqqqqq9 2015-04-27 15:03:51 UTC
Removing the .updated-files does not help.
But I think it's a problem of the underlying filesystem because touching a new file has the same problem. 

touch /etc/testfile
17:00 ~$ stat /etc/testfile 
  Datei: „/etc/testfile“
  Größe: 0              Blöcke: 0          EA Block: 1024   reguläre leere Datei
Gerät: fe01h/65025d     Inode: 901         Verknüpfungen: 1
Zugriff: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Zugriff    : 2015-04-27 16:59:59.000000000 +0200
Modifiziert: 2015-04-27 16:59:59.000000000 +0200
Geändert   : 2015-04-27 16:59:59.000000000 +0200
Comment 7 Lennart Poettering 2015-04-27 15:09:00 UTC
So, it appears that ext4 only stores ns timestamps if the inode size is >= 256. Which one of your file systems doesnt use. mke2fs is will use 128 for small file systems by default.

What a crazy idea in ext4, yuck...

But I figure we need to handle this somewhat nicely...
Comment 8 qqqqqqqqq9 2015-04-27 15:12:07 UTC
Thanks
Comment 9 Lennart Poettering 2015-04-27 15:21:15 UTC
i do wonder what tools like "make" do for this case though.

I am not aware that there was a way to query the granularity of the timestamps of a file system unfortunately. :-(


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.