public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: David Laight <david.laight.linux@gmail.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	"Artem S. Tashkinov" <aros@gmx.com>,
	linux-ext4@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: A syscall for changing birth time
Date: Tue, 11 Mar 2025 00:31:19 +0000	[thread overview]
Message-ID: <20250311003119.GM2023217@ZenIV> (raw)
In-Reply-To: <20250310221243.0d5db7b3@pumpkin>

On Mon, Mar 10, 2025 at 10:12:43PM +0000, David Laight wrote:
> On Mon, 10 Mar 2025 09:58:28 -0400
> "Theodore Ts'o" <tytso@mit.edu> wrote:
> 
> > On Mon, Mar 10, 2025 at 07:26:00AM +0000, Artem S. Tashkinov wrote:
> > > 
> > > Why is it that the Linux kernel supports reading btime, but there's no
> > > syscall to change it? At least for ext4 there's the debugfs utility, but
> > > for other filesystems there's just nothing. And even debugfs is not a
> > > solution, since it requires root privileges and an unmounted/mounted RO
> > > filesystem.  
> > 
> > POSIX and Single Unix Specification also doesn't provide a way to
> > allow userspace to set ctime (inode change time).  That's because the
> > definition of "change time" is defined to include the time to change
> > anything about the inode metadata --- including the inode timestamps.
> > 
> 
> I'm sure that hadn't used to be the case.

You are incorrect.

> But as some point the 'ctime' changed from something that was usually
> the file create time (for some definition of create) to a pretty useless
> time that is almost a waste of disk space.

Which point would that be, considering that v6 inodes have only two timestamps
(atime and mtime), while in v7 e.g. chmod() definitely does update ctime?

sys/sys4.c:chmod():
        ip->i_flag |= ICHG;
	...
	iput(ip);
sys/iget.c:iput():
        if(ip->i_count == 1) {
		...
		iupdat(ip, &time, &time);
sys/iget.c:iupdat():
                if(ip->i_flag&ICHG)
			dp->di_ctime = time;

And filesys(5) has this:
.I Di_ctime
records the time of last modification
to the inode or to the file, and is used
to determine whether it should be dumped.

... which ought to answer the question about the intended use of that thing.
Hopefully useful mnemonics for your next attempt at UNIX101:
	A: Accessed
	M: contents Modified
	C: Changed in any way, including metadata

  reply	other threads:[~2025-03-11  0:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10  7:26 A syscall for changing birth time Artem S. Tashkinov
2025-03-10 13:58 ` Theodore Ts'o
2025-03-10 14:11   ` Artem S. Tashkinov
2025-03-10 15:37     ` Theodore Ts'o
2025-03-11 16:08       ` David Sterba
2025-03-11 21:14         ` Theodore Ts'o
2025-03-10 22:12   ` David Laight
2025-03-11  0:31     ` Al Viro [this message]
2025-03-11  4:49     ` Theodore Ts'o
2025-03-11  4:56       ` Al Viro
2025-03-11 17:07         ` Theodore Ts'o
2025-03-11 18:11           ` Al Viro
2025-03-11 20:01           ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250311003119.GM2023217@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=aros@gmx.com \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox