Linux NILFS development
 help / color / mirror / Atom feed
From: Seth Arnold <seth.arnold@canonical.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: Damien Le Moal <dlemoal@kernel.org>,
	jk@ozlabs.org, arnd@arndb.de, mpe@ellerman.id.au,
	npiggin@gmail.com, christophe.leroy@csgroup.eu,
	hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
	borntraeger@linux.ibm.com, svens@linux.ibm.com,
	gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com,
	maco@android.com, joel@joelfernandes.org, brauner@kernel.org,
	cmllamas@google.com, surenb@google.com,
	dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca,
	leon@kernel.org, bwarrum@linux.ibm.com, rituagar@linux.ibm.com,
	ericvh@kernel.org, lucho@ionkov.net, asmadeus@codewreck.org,
	linux_oss@crudebyte.com, dsterba@suse.com, dhowells@redhat.com,
	marc.dionne@auristor.com, viro@zeniv.linux.org.uk,
	raven@themaw.net, luisbg@kernel.org, salah.triki@gmail.com,
	aivazian.tigran@gmail.com
Subject: Re: [apparmor] [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
Date: Thu, 6 Jul 2023 21:02:36 +0000	[thread overview]
Message-ID: <20230706210236.GB3244704@millbarge> (raw)
In-Reply-To: <7c783969641b67d6ffdfb10e509f382d083c5291.camel@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2340 bytes --]

On Wed, Jul 05, 2023 at 08:04:41PM -0400, Jeff Layton wrote:
> 
> I don't believe it's an issue. I've seen nothing in the POSIX spec that
> mandates that timestamp updates to different inodes involved in an
> operation be set to the _same_ value. It just says they must be updated.
> 
> It's also hard to believe that any software would depend on this either,
> given that it's very inconsistent across filesystems today. AFAICT, this
> was mostly done in the past just as a matter of convenience.

I've seen this assumption in several programs:

mutt buffy.c
https://sources.debian.org/src/mutt/2.2.9-1/buffy.c/?hl=625#L625

  if (mailbox->newly_created &&
      (sb->st_ctime != sb->st_mtime || sb->st_ctime != sb->st_atime))
    mailbox->newly_created = 0;


neomutt mbox/mbox.c
https://sources.debian.org/src/neomutt/20220429+dfsg1-4.1/mbox/mbox.c/?hl=1820#L1820

  if (m->newly_created && ((st.st_ctime != st.st_mtime) || (st.st_ctime != st.st_atime)))
    m->newly_created = false;


screen logfile.c
https://sources.debian.org/src/screen/4.9.0-4/logfile.c/?hl=130#L130

  if ((!s->st_dev && !s->st_ino) ||             /* stat failed, that's new! */
      !s->st_nlink ||                           /* red alert: file unlinked */
      (s->st_size < o.st_size) ||               /*           file truncated */
      (s->st_mtime != o.st_mtime) ||            /*            file modified */
      ((s->st_ctime != o.st_ctime) &&           /*     file changed (moved) */
       !(s->st_mtime == s->st_ctime &&          /*  and it was not a change */
         o.st_ctime < s->st_ctime)))            /* due to delayed nfs write */
  {

nemo libnemo-private/nemo-vfs-file.c
https://sources.debian.org/src/nemo/5.6.5-1/libnemo-private/nemo-vfs-file.c/?hl=344#L344

		/* mtime is when the contents changed; ctime is when the
		 * contents or the permissions (inc. owner/group) changed.
		 * So we can only know when the permissions changed if mtime
		 * and ctime are different.
		 */
		if (file->details->mtime == file->details->ctime) {
			return FALSE;
		}


While looking for more examples, I found a perl test that seems to suggest
that at least Solaris, AFS, AmigaOS, DragonFly BSD do as you suggest:
https://sources.debian.org/src/perl/5.36.0-7/t/op/stat.t/?hl=158#L140


Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2023-07-06 21:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230705185812.579118-1-jlayton@kernel.org>
     [not found] ` <20230705185812.579118-1-jlayton-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-07-05 18:58   ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Jeff Layton
2023-07-05 18:58   ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
2023-07-05 18:58   ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
2023-07-05 21:57   ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
     [not found] ` <20230705185812.579118-2-jlayton@kernel.org>
     [not found]   ` <20230705185812.579118-2-jlayton-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-07-05 23:12     ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Damien Le Moal
     [not found] ` <20230705185812.579118-4-jlayton@kernel.org>
     [not found]   ` <20230705185812.579118-4-jlayton-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-07-05 23:19     ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Damien Le Moal
2023-07-06 14:58   ` Jan Kara
     [not found] ` <a4e6cfec345487fc9ac8ab814a817c79a61b123a.camel@kernel.org>
     [not found]   ` <a4e6cfec345487fc9ac8ab814a817c79a61b123a.camel-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-07-06 15:16     ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Eric W. Biederman
2023-07-06 16:14       ` Jeff Layton
2023-07-07 12:42 ` Jeff Layton
2023-07-10 12:35   ` Christian Brauner
2023-07-10 13:32     ` Jeff Layton
2023-07-10 12:18 ` [PATCH v2 00/92] " Christian Brauner
     [not found] ` <20230705185812.579118-3-jlayton@kernel.org>
     [not found]   ` <20230705185812.579118-3-jlayton-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-07-05 23:19     ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Damien Le Moal
2023-07-06 10:27     ` Jan Kara
     [not found]   ` <3b403ef1-22e6-0220-6c9c-435e3444b4d3@kernel.org>
     [not found]     ` <3b403ef1-22e6-0220-6c9c-435e3444b4d3-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-07-06  0:04       ` Jeff Layton
     [not found]     ` <7c783969641b67d6ffdfb10e509f382d083c5291.camel@kernel.org>
2023-07-06 21:02       ` Seth Arnold [this message]
2023-07-07 10:50         ` [apparmor] " Jeff Layton
2023-08-30  0:19   ` Al Viro
2023-08-30  0:48     ` Jeff Layton
2023-09-04 18:11 ` [f2fs-dev] [PATCH v2 00/89] fs: new accessors for inode->i_ctime patchwork-bot+f2fs

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=20230706210236.GB3244704@millbarge \
    --to=seth.arnold@canonical.com \
    --cc=agordeev@linux.ibm.com \
    --cc=aivazian.tigran@gmail.com \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=asmadeus@codewreck.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=brauner@kernel.org \
    --cc=bwarrum@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=cmllamas@google.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dhowells@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=ericvh@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hca@linux.ibm.com \
    --cc=jgg@ziepe.ca \
    --cc=jk@ozlabs.org \
    --cc=jlayton@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=leon@kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=luisbg@kernel.org \
    --cc=maco@android.com \
    --cc=marc.dionne@auristor.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=raven@themaw.net \
    --cc=rituagar@linux.ibm.com \
    --cc=salah.triki@gmail.com \
    --cc=surenb@google.com \
    --cc=svens@linux.ibm.com \
    --cc=tkjos@android.com \
    --cc=viro@zeniv.linux.org.uk \
    /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