Bug 48751
Summary: | ext3: ctime changes with no reason in 30 seconds after a file change | ||
---|---|---|---|
Product: | File System | Reporter: | Vladimir A. Pavlov (pv4) |
Component: | ext3 | Assignee: | Jan Kara (jack) |
Status: | RESOLVED WILL_NOT_FIX | ||
Severity: | normal | CC: | alan, jack, pv4 |
Priority: | P1 | ||
Hardware: | IA-32 | ||
OS: | Linux | ||
Kernel Version: | 2.6.35+, maybe older | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | Details |
Description
Vladimir A. Pavlov
2012-10-13 18:07:33 UTC
> 3.2 or above (3.6.1 is still as well)
I mean 3.6.1 is affected as well
Does this go away if you mount without "relatime" ? No Yeah, the reason is that /tmp/a/usr/lib/locale/locale-archive is written to via mmap. ext3 (since it does not support delayed allocation) allocates blocks for the written data only when flusher thread decides to do writeback on the inode (which is 30s after the file is written). This allocation changes i_blocks field of the inode and thus inode's ctime has to be changed as well. I understand this is counter-intuitive but that's just how the filesystem works... Oh, and I should add the behavior is like this all the time ext3 exists. > Oh, and I should add the behavior is like this all the time ext3 exists.
Oops... You are right.
I've just rechecked. It actually exists in 2.6.35 as well. So, it's not a regression.
Any chances it will be fixed? Otherwise I have to think about moving to ext4 :(
As much as I understand ctime update is unexpected at the first sight, it is technically a correct thing to do as writeback *does* change what stat(2) returns (st_blocks field). So I don't plan to change the behavior for ext3 and potentially break some applications relying on ctime changing whenever inode changes. Of course more complex fix of performing delayed allocation and thus updating i_blocks earlier is possible as well. I actually suggested something like that about an year ago but it's a rather complex change and people were concerned about introducing bugs to a filesystem which is in maintenance-only mode. So that didn't happen. BTW: What problems does delayed ctime update cause to your applications? > What problems does delayed ctime update cause to your applications?
I have a script to create binary tarball of glibc. It does
...
make install_root=/tmp/glibc localedata/install-locales
cd /tmp/glibc
tar -cJf /tmp/glibc-2.16.0-bin.tar.xz .
tar detects ctime change during its run and prints a warning like "usr/lib/locale/locale-archve: file changed as we read it". This seemed unlogically for me (and still does) and looked like a kernel bug so I reported it. I can of course redirect tar output to /dev/null or just ignore the warning if it's really hard to fix the issue.
I see. Yes, for ext3 it's not easy as I wrote... So I'm closing the bug. And thanks for report anyway :). |