linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/89] fs: new accessors for inode->i_ctime
@ 2023-07-05 18:58 Jeff Layton
  2023-07-05 18:58 ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Jeff Layton
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Jeff Layton @ 2023-07-05 18:58 UTC (permalink / raw)
  To: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jlayton,
	jaharkes, coda, jlbec, hch, nico, rafael, code, ardb, xiang,
	chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack, tytso,
	adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso, agruenba,
	richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, dlemoal, naohiro.aota, jth, ast,
	daniel, andrii, martin.lau, song, yhs, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

v2:
- prepend patches to add missing ctime updates
- add simple_rename_timestamp helper function
- rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
- drop individual inode_ctime_set_{sec,nsec} helpers

I've been working on a patchset to change how the inode->i_ctime is
accessed in order to give us conditional, high-res timestamps for the
ctime and mtime. struct timespec64 has unused bits in it that we can use
to implement this. In order to do that however, we need to wrap all
accesses of inode->i_ctime to ensure that bits used as flags are
appropriately handled.

The patchset starts with reposts of some missing ctime updates that I
spotted in the tree. It then adds a new helper function for updating the
timestamp after a successful rename, and new ctime accessor
infrastructure.

The bulk of the patchset is individual conversions of different
subsysteme to use the new infrastructure. Finally, the patchset renames
the i_ctime field to __i_ctime to help ensure that I didn't miss
anything.

This should apply cleanly to linux-next as of this morning.

Most of this conversion was done via 5 different coccinelle scripts, run
in succession, with a large swath of by-hand conversions to clean up the
remainder.

The coccinelle scripts that were used are below:

::::::::::::::
cocci/ctime1.cocci
::::::::::::::
// convert as much to use inode_set_ctime_current as possible
@@
identifier timei;
struct inode *inode;
expression E1, E2;
@@
(
- inode->i_ctime = E1 = E2 = current_time(timei)
+ E1 = E2 = inode_set_ctime_current(inode)
|
- inode->i_ctime = E1 = current_time(timei)
+ E1 = inode_set_ctime_current(inode)
|
- E1 = inode->i_ctime = current_time(timei)
+ E1 = inode_set_ctime_current(inode)
|
- inode->i_ctime = current_time(timei)
+ inode_set_ctime_current(inode)
)

@@
struct inode *inode;
expression E1, E2, E3;
@@
(
- E1 = current_time(inode)
+ E1 = inode_set_ctime_current(inode)
|
- E1 = current_time(E3)
+ E1 = inode_set_ctime_current(inode)
)
...
(
- inode->i_ctime = E1;
|
- E2 = inode->i_ctime = E1;
+ E2 = E1;
)
::::::::::::::
cocci/ctime2.cocci
::::::::::::::
// get the places that set individual timespec64 fields
@@
struct inode *inode;
expression val, val2;
@@
- inode->i_ctime.tv_sec = val
+ inode_set_ctime(inode, val, val2)
...
- inode->i_ctime.tv_nsec = val2;

// get places that just set the tv_sec
@@
struct inode *inode;
expression sec, E1, E2, E3;
@@
(
- E3 = inode->i_ctime.tv_sec = sec
+ E3 = inode_set_ctime(inode, sec, 0).tv_sec
|
- inode->i_ctime.tv_sec = sec
+ inode_set_ctime(inode, sec, 0)
)
<...
(
- inode->i_ctime.tv_nsec = 0;
|
- E1 = inode->i_ctime.tv_nsec = 0
+ E1 = 0
|
- inode->i_ctime.tv_nsec = E1 = 0
+ E1 = 0
|
- inode->i_ctime.tv_nsec = E1 = E2 = 0
+ E1 = E2 = 0
)
...>

::::::::::::::
cocci/ctime3.cocci
::::::::::::::
// convert places that set i_ctime to a timespec64 directly
@@
struct inode *inode;
expression ts, E1, E2;
@@
(
- inode->i_ctime = E1 = E2 = ts
+ E1 = E2 = inode_set_ctime_to_ts(inode, ts)
|
- inode->i_ctime = E1 = ts
+ E1 = inode_set_ctime_to_ts(inode, ts)
|
- inode->i_ctime = ts
+ inode_set_ctime_to_ts(inode, ts)
)
::::::::::::::
cocci/ctime4.cocci
::::::::::::::
// catch places that set the i_ctime in an inode embedded in another structure
@@
expression E1, E2, E3;
@@
(
- E3.i_ctime = E1 = E2 = current_time(&E3)
+ E1 = E2 = inode_set_ctime_current(&E3)
|
- E3.i_ctime = E1 = current_time(&E3)
+ E1 = inode_set_ctime_current(&E3)
|
- E1 = E3.i_ctime = current_time(&E3)
+ E1 = inode_set_ctime_current(&E3)
|
- E3.i_ctime = current_time(&E3)
+ inode_set_ctime_current(&E3)
)
::::::::::::::
cocci/ctime5.cocci
::::::::::::::
// convert the remaining i_ctime accesses
@@
struct inode *inode;
@@
- inode->i_ctime
+ inode_get_ctime(inode)


Jeff Layton (92):
  ibmvmc: update ctime in conjunction with mtime on write
  bfs: update ctime in addition to mtime when adding entries
  efivarfs: update ctime when mtime changes on a write
  exfat: ensure that ctime is updated whenever the mtime is
  apparmor: update ctime whenever the mtime changes on an inode
  cifs: update the ctime on a partial page write
  fs: add ctime accessors infrastructure
  fs: new helper: simple_rename_timestamp
  btrfs: convert to simple_rename_timestamp
  ubifs: convert to simple_rename_timestamp
  shmem: convert to simple_rename_timestamp
  exfat: convert to simple_rename_timestamp
  ntfs3: convert to simple_rename_timestamp
  reiserfs: convert to simple_rename_timestamp
  spufs: convert to ctime accessor functions
  s390: convert to ctime accessor functions
  binderfs: convert to ctime accessor functions
  infiniband: convert to ctime accessor functions
  ibm: convert to ctime accessor functions
  usb: convert to ctime accessor functions
  9p: convert to ctime accessor functions
  adfs: convert to ctime accessor functions
  affs: convert to ctime accessor functions
  afs: convert to ctime accessor functions
  fs: convert to ctime accessor functions
  autofs: convert to ctime accessor functions
  befs: convert to ctime accessor functions
  bfs: convert to ctime accessor functions
  btrfs: convert to ctime accessor functions
  ceph: convert to ctime accessor functions
  coda: convert to ctime accessor functions
  configfs: convert to ctime accessor functions
  cramfs: convert to ctime accessor functions
  debugfs: convert to ctime accessor functions
  devpts: convert to ctime accessor functions
  ecryptfs: convert to ctime accessor functions
  efivarfs: convert to ctime accessor functions
  efs: convert to ctime accessor functions
  erofs: convert to ctime accessor functions
  exfat: convert to ctime accessor functions
  ext2: convert to ctime accessor functions
  ext4: convert to ctime accessor functions
  f2fs: convert to ctime accessor functions
  fat: convert to ctime accessor functions
  freevxfs: convert to ctime accessor functions
  fuse: convert to ctime accessor functions
  gfs2: convert to ctime accessor functions
  hfs: convert to ctime accessor functions
  hfsplus: convert to ctime accessor functions
  hostfs: convert to ctime accessor functions
  hpfs: convert to ctime accessor functions
  hugetlbfs: convert to ctime accessor functions
  isofs: convert to ctime accessor functions
  jffs2: convert to ctime accessor functions
  jfs: convert to ctime accessor functions
  kernfs: convert to ctime accessor functions
  nfs: convert to ctime accessor functions
  nfsd: convert to ctime accessor functions
  nilfs2: convert to ctime accessor functions
  ntfs: convert to ctime accessor functions
  ntfs3: convert to ctime accessor functions
  ocfs2: convert to ctime accessor functions
  omfs: convert to ctime accessor functions
  openpromfs: convert to ctime accessor functions
  orangefs: convert to ctime accessor functions
  overlayfs: convert to ctime accessor functions
  procfs: convert to ctime accessor functions
  pstore: convert to ctime accessor functions
  qnx4: convert to ctime accessor functions
  qnx6: convert to ctime accessor functions
  ramfs: convert to ctime accessor functions
  reiserfs: convert to ctime accessor functions
  romfs: convert to ctime accessor functions
  smb: convert to ctime accessor functions
  squashfs: convert to ctime accessor functions
  sysv: convert to ctime accessor functions
  tracefs: convert to ctime accessor functions
  ubifs: convert to ctime accessor functions
  udf: convert to ctime accessor functions
  ufs: convert to ctime accessor functions
  vboxsf: convert to ctime accessor functions
  xfs: convert to ctime accessor functions
  zonefs: convert to ctime accessor functions
  linux: convert to ctime accessor functions
  mqueue: convert to ctime accessor functions
  bpf: convert to ctime accessor functions
  shmem: convert to ctime accessor functions
  sunrpc: convert to ctime accessor functions
  apparmor: convert to ctime accessor functions
  security: convert to ctime accessor functions
  selinux: convert to ctime accessor functions
  fs: rename i_ctime field to __i_ctime

 arch/powerpc/platforms/cell/spufs/inode.c |  2 +-
 arch/s390/hypfs/inode.c                   |  4 +-
 drivers/android/binderfs.c                |  8 ++--
 drivers/infiniband/hw/qib/qib_fs.c        |  3 +-
 drivers/misc/ibmasm/ibmasmfs.c            |  2 +-
 drivers/misc/ibmvmc.c                     |  2 +-
 drivers/usb/core/devio.c                  | 16 +++----
 drivers/usb/gadget/function/f_fs.c        |  3 +-
 drivers/usb/gadget/legacy/inode.c         |  3 +-
 fs/9p/vfs_inode.c                         |  4 +-
 fs/9p/vfs_inode_dotl.c                    |  8 ++--
 fs/adfs/inode.c                           |  4 +-
 fs/affs/amigaffs.c                        |  6 +--
 fs/affs/inode.c                           | 16 +++----
 fs/afs/dynroot.c                          |  2 +-
 fs/afs/inode.c                            |  6 +--
 fs/attr.c                                 |  2 +-
 fs/autofs/inode.c                         |  2 +-
 fs/autofs/root.c                          |  6 +--
 fs/bad_inode.c                            |  3 +-
 fs/befs/linuxvfs.c                        |  2 +-
 fs/bfs/dir.c                              | 16 +++----
 fs/bfs/inode.c                            |  5 +--
 fs/binfmt_misc.c                          |  3 +-
 fs/btrfs/delayed-inode.c                  |  8 ++--
 fs/btrfs/file.c                           | 21 ++++-----
 fs/btrfs/inode.c                          | 54 ++++++++--------------
 fs/btrfs/ioctl.c                          |  2 +-
 fs/btrfs/reflink.c                        |  3 +-
 fs/btrfs/transaction.c                    |  3 +-
 fs/btrfs/tree-log.c                       |  4 +-
 fs/btrfs/xattr.c                          |  4 +-
 fs/ceph/acl.c                             |  2 +-
 fs/ceph/caps.c                            |  2 +-
 fs/ceph/inode.c                           | 17 ++++---
 fs/ceph/snap.c                            |  2 +-
 fs/ceph/xattr.c                           |  2 +-
 fs/coda/coda_linux.c                      |  3 +-
 fs/coda/dir.c                             |  2 +-
 fs/coda/file.c                            |  2 +-
 fs/coda/inode.c                           |  2 +-
 fs/configfs/inode.c                       |  7 ++-
 fs/cramfs/inode.c                         |  3 +-
 fs/debugfs/inode.c                        |  3 +-
 fs/devpts/inode.c                         |  6 +--
 fs/ecryptfs/inode.c                       |  2 +-
 fs/efivarfs/file.c                        |  2 +-
 fs/efivarfs/inode.c                       |  2 +-
 fs/efs/inode.c                            |  4 +-
 fs/erofs/inode.c                          | 15 +++----
 fs/exfat/file.c                           |  4 +-
 fs/exfat/inode.c                          |  6 +--
 fs/exfat/namei.c                          | 26 +++++------
 fs/exfat/super.c                          |  3 +-
 fs/ext2/acl.c                             |  2 +-
 fs/ext2/dir.c                             |  6 +--
 fs/ext2/ialloc.c                          |  2 +-
 fs/ext2/inode.c                           | 10 ++---
 fs/ext2/ioctl.c                           |  4 +-
 fs/ext2/namei.c                           |  8 ++--
 fs/ext2/super.c                           |  2 +-
 fs/ext2/xattr.c                           |  2 +-
 fs/ext4/acl.c                             |  2 +-
 fs/ext4/ext4.h                            | 21 +++++++++
 fs/ext4/extents.c                         | 12 ++---
 fs/ext4/ialloc.c                          |  2 +-
 fs/ext4/inline.c                          |  4 +-
 fs/ext4/inode.c                           | 16 +++----
 fs/ext4/ioctl.c                           |  9 ++--
 fs/ext4/namei.c                           | 26 +++++------
 fs/ext4/super.c                           |  2 +-
 fs/ext4/xattr.c                           |  6 +--
 fs/f2fs/dir.c                             |  8 ++--
 fs/f2fs/f2fs.h                            |  4 +-
 fs/f2fs/file.c                            | 20 ++++-----
 fs/f2fs/inline.c                          |  2 +-
 fs/f2fs/inode.c                           | 10 ++---
 fs/f2fs/namei.c                           | 12 ++---
 fs/f2fs/recovery.c                        |  4 +-
 fs/f2fs/super.c                           |  2 +-
 fs/f2fs/xattr.c                           |  2 +-
 fs/fat/inode.c                            |  7 +--
 fs/fat/misc.c                             |  3 +-
 fs/freevxfs/vxfs_inode.c                  |  3 +-
 fs/fuse/control.c                         |  2 +-
 fs/fuse/dir.c                             |  8 ++--
 fs/fuse/inode.c                           | 16 +++----
 fs/gfs2/acl.c                             |  2 +-
 fs/gfs2/bmap.c                            | 11 +++--
 fs/gfs2/dir.c                             | 15 ++++---
 fs/gfs2/file.c                            |  2 +-
 fs/gfs2/glops.c                           |  4 +-
 fs/gfs2/inode.c                           |  8 ++--
 fs/gfs2/super.c                           |  4 +-
 fs/gfs2/xattr.c                           |  8 ++--
 fs/hfs/catalog.c                          |  8 ++--
 fs/hfs/dir.c                              |  2 +-
 fs/hfs/inode.c                            | 13 +++---
 fs/hfs/sysdep.c                           |  4 +-
 fs/hfsplus/catalog.c                      |  8 ++--
 fs/hfsplus/dir.c                          |  6 +--
 fs/hfsplus/inode.c                        | 16 ++++---
 fs/hostfs/hostfs_kern.c                   |  3 +-
 fs/hpfs/dir.c                             |  8 ++--
 fs/hpfs/inode.c                           |  6 +--
 fs/hpfs/namei.c                           | 26 ++++++-----
 fs/hpfs/super.c                           |  5 ++-
 fs/hugetlbfs/inode.c                      | 12 ++---
 fs/inode.c                                | 26 +++++++++--
 fs/isofs/inode.c                          |  8 ++--
 fs/isofs/rock.c                           | 16 +++----
 fs/jffs2/dir.c                            | 24 ++++++----
 fs/jffs2/file.c                           |  3 +-
 fs/jffs2/fs.c                             | 10 ++---
 fs/jffs2/os-linux.h                       |  2 +-
 fs/jfs/acl.c                              |  2 +-
 fs/jfs/inode.c                            |  2 +-
 fs/jfs/ioctl.c                            |  2 +-
 fs/jfs/jfs_imap.c                         |  8 ++--
 fs/jfs/jfs_inode.c                        |  4 +-
 fs/jfs/namei.c                            | 24 +++++-----
 fs/jfs/super.c                            |  2 +-
 fs/jfs/xattr.c                            |  2 +-
 fs/kernfs/inode.c                         |  5 +--
 fs/libfs.c                                | 55 +++++++++++++++--------
 fs/minix/bitmap.c                         |  2 +-
 fs/minix/dir.c                            |  6 +--
 fs/minix/inode.c                          | 10 ++---
 fs/minix/itree_common.c                   |  4 +-
 fs/minix/namei.c                          |  6 +--
 fs/nfs/callback_proc.c                    |  2 +-
 fs/nfs/fscache.h                          |  4 +-
 fs/nfs/inode.c                            | 20 ++++-----
 fs/nfsd/nfsctl.c                          |  2 +-
 fs/nfsd/vfs.c                             |  2 +-
 fs/nilfs2/dir.c                           |  6 +--
 fs/nilfs2/inode.c                         | 12 ++---
 fs/nilfs2/ioctl.c                         |  2 +-
 fs/nilfs2/namei.c                         |  8 ++--
 fs/nsfs.c                                 |  2 +-
 fs/ntfs/inode.c                           | 15 ++++---
 fs/ntfs/mft.c                             |  3 +-
 fs/ntfs3/file.c                           |  6 +--
 fs/ntfs3/frecord.c                        |  3 +-
 fs/ntfs3/inode.c                          | 14 +++---
 fs/ntfs3/namei.c                          | 11 ++---
 fs/ntfs3/xattr.c                          |  4 +-
 fs/ocfs2/acl.c                            |  6 +--
 fs/ocfs2/alloc.c                          |  6 +--
 fs/ocfs2/aops.c                           |  2 +-
 fs/ocfs2/dir.c                            |  8 ++--
 fs/ocfs2/dlmfs/dlmfs.c                    |  4 +-
 fs/ocfs2/dlmglue.c                        |  7 ++-
 fs/ocfs2/file.c                           | 16 ++++---
 fs/ocfs2/inode.c                          | 12 ++---
 fs/ocfs2/move_extents.c                   |  6 +--
 fs/ocfs2/namei.c                          | 21 ++++-----
 fs/ocfs2/refcounttree.c                   | 14 +++---
 fs/ocfs2/xattr.c                          |  6 +--
 fs/omfs/dir.c                             |  4 +-
 fs/omfs/inode.c                           |  9 ++--
 fs/openpromfs/inode.c                     |  5 +--
 fs/orangefs/namei.c                       |  2 +-
 fs/orangefs/orangefs-utils.c              |  6 +--
 fs/overlayfs/file.c                       |  7 ++-
 fs/overlayfs/util.c                       |  2 +-
 fs/pipe.c                                 |  2 +-
 fs/posix_acl.c                            |  2 +-
 fs/proc/base.c                            |  2 +-
 fs/proc/inode.c                           |  2 +-
 fs/proc/proc_sysctl.c                     |  2 +-
 fs/proc/self.c                            |  2 +-
 fs/proc/thread_self.c                     |  2 +-
 fs/pstore/inode.c                         |  4 +-
 fs/qnx4/inode.c                           |  3 +-
 fs/qnx6/inode.c                           |  3 +-
 fs/ramfs/inode.c                          |  6 +--
 fs/reiserfs/inode.c                       | 12 +++--
 fs/reiserfs/ioctl.c                       |  4 +-
 fs/reiserfs/namei.c                       | 18 +++-----
 fs/reiserfs/stree.c                       |  4 +-
 fs/reiserfs/super.c                       |  2 +-
 fs/reiserfs/xattr.c                       |  5 ++-
 fs/reiserfs/xattr_acl.c                   |  2 +-
 fs/romfs/super.c                          |  4 +-
 fs/smb/client/file.c                      |  4 +-
 fs/smb/client/fscache.h                   |  5 ++-
 fs/smb/client/inode.c                     | 14 +++---
 fs/smb/client/smb2ops.c                   |  3 +-
 fs/smb/server/smb2pdu.c                   |  8 ++--
 fs/squashfs/inode.c                       |  2 +-
 fs/stack.c                                |  2 +-
 fs/stat.c                                 |  2 +-
 fs/sysv/dir.c                             |  6 +--
 fs/sysv/ialloc.c                          |  2 +-
 fs/sysv/inode.c                           |  5 +--
 fs/sysv/itree.c                           |  4 +-
 fs/sysv/namei.c                           |  6 +--
 fs/tracefs/inode.c                        |  2 +-
 fs/ubifs/debug.c                          |  4 +-
 fs/ubifs/dir.c                            | 39 ++++++----------
 fs/ubifs/file.c                           | 16 ++++---
 fs/ubifs/ioctl.c                          |  2 +-
 fs/ubifs/journal.c                        |  4 +-
 fs/ubifs/super.c                          |  4 +-
 fs/ubifs/xattr.c                          |  6 +--
 fs/udf/ialloc.c                           |  2 +-
 fs/udf/inode.c                            | 17 ++++---
 fs/udf/namei.c                            | 24 +++++-----
 fs/ufs/dir.c                              |  6 +--
 fs/ufs/ialloc.c                           |  2 +-
 fs/ufs/inode.c                            | 23 +++++-----
 fs/ufs/namei.c                            |  8 ++--
 fs/vboxsf/utils.c                         |  4 +-
 fs/xfs/libxfs/xfs_inode_buf.c             |  5 ++-
 fs/xfs/libxfs/xfs_trans_inode.c           |  2 +-
 fs/xfs/xfs_acl.c                          |  2 +-
 fs/xfs/xfs_bmap_util.c                    |  6 ++-
 fs/xfs/xfs_inode.c                        |  3 +-
 fs/xfs/xfs_inode_item.c                   |  2 +-
 fs/xfs/xfs_iops.c                         |  4 +-
 fs/xfs/xfs_itable.c                       |  4 +-
 fs/zonefs/super.c                         |  8 ++--
 include/linux/fs.h                        | 49 +++++++++++++++++++-
 include/linux/fs_stack.h                  |  2 +-
 ipc/mqueue.c                              | 23 +++++-----
 kernel/bpf/inode.c                        |  6 +--
 mm/shmem.c                                | 26 +++++------
 net/sunrpc/rpc_pipe.c                     |  2 +-
 security/apparmor/apparmorfs.c            | 11 +++--
 security/apparmor/policy_unpack.c         | 11 +++--
 security/inode.c                          |  2 +-
 security/selinux/selinuxfs.c              |  2 +-
 233 files changed, 901 insertions(+), 812 deletions(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v2 07/92] fs: add ctime accessors infrastructure
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
@ 2023-07-05 18:58 ` Jeff Layton
  2023-07-05 23:12   ` Damien Le Moal
  2023-07-05 18:58 ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Jeff Layton @ 2023-07-05 18:58 UTC (permalink / raw)
  To: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jlayton,
	jaharkes, coda, jlbec, hch, nico, rafael, code, ardb, xiang,
	chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack, tytso,
	adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso, agruenba,
	richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, dlemoal, naohiro.aota, jth, ast,
	daniel, andrii, martin.lau, song, yhs, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux
  Cc: Jan Kara

struct timespec64 has unused bits in the tv_nsec field that can be used
for other purposes. In future patches, we're going to change how the
inode->i_ctime is accessed in certain inodes in order to make use of
them. In order to do that safely though, we'll need to eradicate raw
accesses of the inode->i_ctime field from the kernel.

Add new accessor functions for the ctime that we use to replace them.

Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/inode.c         | 16 ++++++++++++++++
 include/linux/fs.h | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index d37fad91c8da..21b026d95b51 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2499,6 +2499,22 @@ struct timespec64 current_time(struct inode *inode)
 }
 EXPORT_SYMBOL(current_time);
 
+/**
+ * inode_set_ctime_current - set the ctime to current_time
+ * @inode: inode
+ *
+ * Set the inode->i_ctime to the current value for the inode. Returns
+ * the current value that was assigned to i_ctime.
+ */
+struct timespec64 inode_set_ctime_current(struct inode *inode)
+{
+	struct timespec64 now = current_time(inode);
+
+	inode_set_ctime(inode, now.tv_sec, now.tv_nsec);
+	return now;
+}
+EXPORT_SYMBOL(inode_set_ctime_current);
+
 /**
  * in_group_or_capable - check whether caller is CAP_FSETID privileged
  * @idmap:	idmap of the mount @inode was found from
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 824accb89a91..bdfbd11a5811 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1474,7 +1474,50 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb,
 	       kgid_has_mapping(fs_userns, kgid);
 }
 
-extern struct timespec64 current_time(struct inode *inode);
+struct timespec64 current_time(struct inode *inode);
+struct timespec64 inode_set_ctime_current(struct inode *inode);
+
+/**
+ * inode_get_ctime - fetch the current ctime from the inode
+ * @inode: inode from which to fetch ctime
+ *
+ * Grab the current ctime from the inode and return it.
+ */
+static inline struct timespec64 inode_get_ctime(const struct inode *inode)
+{
+	return inode->i_ctime;
+}
+
+/**
+ * inode_set_ctime_to_ts - set the ctime in the inode
+ * @inode: inode in which to set the ctime
+ * @ts: value to set in the ctime field
+ *
+ * Set the ctime in @inode to @ts
+ */
+static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode,
+						      struct timespec64 ts)
+{
+	inode->i_ctime = ts;
+	return ts;
+}
+
+/**
+ * inode_set_ctime - set the ctime in the inode
+ * @inode: inode in which to set the ctime
+ * @sec: tv_sec value to set
+ * @nsec: tv_nsec value to set
+ *
+ * Set the ctime in @inode to { @sec, @nsec }
+ */
+static inline struct timespec64 inode_set_ctime(struct inode *inode,
+						time64_t sec, long nsec)
+{
+	struct timespec64 ts = { .tv_sec  = sec,
+				 .tv_nsec = nsec };
+
+	return inode_set_ctime_to_ts(inode, ts);
+}
 
 /*
  * Snapshotting support.
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
  2023-07-05 18:58 ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Jeff Layton
@ 2023-07-05 18:58 ` Jeff Layton
  2023-07-05 23:19   ` Damien Le Moal
                     ` (2 more replies)
  2023-07-05 18:58 ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
                   ` (4 subsequent siblings)
  6 siblings, 3 replies; 22+ messages in thread
From: Jeff Layton @ 2023-07-05 18:58 UTC (permalink / raw)
  To: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jlayton,
	jaharkes, coda, jlbec, hch, nico, rafael, code, ardb, xiang,
	chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack, tytso,
	adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso, agruenba,
	richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, dlemoal, naohiro.aota, jth, ast,
	daniel, andrii, martin.lau, song, yhs, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

A rename potentially involves updating 4 different inode timestamps. Add
a function that handles the details sanely, and convert the libfs.c
callers to use it.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/libfs.c         | 36 +++++++++++++++++++++++++++---------
 include/linux/fs.h |  2 ++
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index a7e56baf8bbd..9ee79668c909 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -692,6 +692,31 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
 }
 EXPORT_SYMBOL(simple_rmdir);
 
+/**
+ * simple_rename_timestamp - update the various inode timestamps for rename
+ * @old_dir: old parent directory
+ * @old_dentry: dentry that is being renamed
+ * @new_dir: new parent directory
+ * @new_dentry: target for rename
+ *
+ * POSIX mandates that the old and new parent directories have their ctime and
+ * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have
+ * their ctime updated.
+ */
+void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
+			     struct inode *new_dir, struct dentry *new_dentry)
+{
+	struct inode *newino = d_inode(new_dentry);
+
+	old_dir->i_mtime = inode_set_ctime_current(old_dir);
+	if (new_dir != old_dir)
+		new_dir->i_mtime = inode_set_ctime_current(new_dir);
+	inode_set_ctime_current(d_inode(old_dentry));
+	if (newino)
+		inode_set_ctime_current(newino);
+}
+EXPORT_SYMBOL_GPL(simple_rename_timestamp);
+
 int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
 			   struct inode *new_dir, struct dentry *new_dentry)
 {
@@ -707,11 +732,7 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
 			inc_nlink(old_dir);
 		}
 	}
-	old_dir->i_ctime = old_dir->i_mtime =
-	new_dir->i_ctime = new_dir->i_mtime =
-	d_inode(old_dentry)->i_ctime =
-	d_inode(new_dentry)->i_ctime = current_time(old_dir);
-
+	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(simple_rename_exchange);
@@ -720,7 +741,6 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
 		  struct dentry *old_dentry, struct inode *new_dir,
 		  struct dentry *new_dentry, unsigned int flags)
 {
-	struct inode *inode = d_inode(old_dentry);
 	int they_are_dirs = d_is_dir(old_dentry);
 
 	if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
@@ -743,9 +763,7 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
 		inc_nlink(new_dir);
 	}
 
-	old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
-		new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
-
+	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
 	return 0;
 }
 EXPORT_SYMBOL(simple_rename);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bdfbd11a5811..14e38bd900f1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2979,6 +2979,8 @@ extern int simple_open(struct inode *inode, struct file *file);
 extern int simple_link(struct dentry *, struct inode *, struct dentry *);
 extern int simple_unlink(struct inode *, struct dentry *);
 extern int simple_rmdir(struct inode *, struct dentry *);
+void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
+			     struct inode *new_dir, struct dentry *new_dentry);
 extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
 				  struct inode *new_dir, struct dentry *new_dentry);
 extern int simple_rename(struct mnt_idmap *, struct inode *,
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
  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 ` Jeff Layton
  2023-07-05 23:19   ` Damien Le Moal
  2023-07-06 14:58   ` Jan Kara
  2023-07-05 21:57 ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 22+ messages in thread
From: Jeff Layton @ 2023-07-05 18:58 UTC (permalink / raw)
  To: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jlayton,
	jaharkes, coda, jlbec, hch, nico, rafael, code, ardb, xiang,
	chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack, tytso,
	adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso, agruenba,
	richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, dlemoal, naohiro.aota, jth, ast,
	daniel, andrii, martin.lau, song, yhs, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

Now that everything in-tree is converted to use the accessor functions,
rename the i_ctime field in the inode to discourage direct access.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 14e38bd900f1..b66442f91835 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -642,7 +642,7 @@ struct inode {
 	loff_t			i_size;
 	struct timespec64	i_atime;
 	struct timespec64	i_mtime;
-	struct timespec64	i_ctime;
+	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
@@ -1485,7 +1485,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
  */
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-	return inode->i_ctime;
+	return inode->__i_ctime;
 }
 
 /**
@@ -1498,7 +1498,7 @@ static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_ctime = ts;
+	inode->__i_ctime = ts;
 	return ts;
 }
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
                   ` (2 preceding siblings ...)
  2023-07-05 18:58 ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
@ 2023-07-05 21:57 ` Jeff Layton
  2023-07-06 15:16   ` Eric W. Biederman
  2023-07-07 12:42 ` Jeff Layton
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Jeff Layton @ 2023-07-05 21:57 UTC (permalink / raw)
  To: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote:
> v2:
> - prepend patches to add missing ctime updates
> - add simple_rename_timestamp helper function
> - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> - drop individual inode_ctime_set_{sec,nsec} helpers
> 
> I've been working on a patchset to change how the inode->i_ctime is
> accessed in order to give us conditional, high-res timestamps for the
> ctime and mtime. struct timespec64 has unused bits in it that we can use
> to implement this. In order to do that however, we need to wrap all
> accesses of inode->i_ctime to ensure that bits used as flags are
> appropriately handled.
> 
> The patchset starts with reposts of some missing ctime updates that I
> spotted in the tree. It then adds a new helper function for updating the
> timestamp after a successful rename, and new ctime accessor
> infrastructure.
> 
> The bulk of the patchset is individual conversions of different
> subsysteme to use the new infrastructure. Finally, the patchset renames
> the i_ctime field to __i_ctime to help ensure that I didn't miss
> anything.
> 
> This should apply cleanly to linux-next as of this morning.
> 
> Most of this conversion was done via 5 different coccinelle scripts, run
> in succession, with a large swath of by-hand conversions to clean up the
> remainder.
> 

A couple of other things I should note:

If you sent me an Acked-by or Reviewed-by in the previous set, then I
tried to keep it on the patch here, since the respun patches are mostly
just renaming stuff from v1. Let me know if I've missed any.

I've also pushed the pile to my tree as this tag:

    https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/tag/?h=ctime.20230705

In case that's easier to work with.

Cheers,
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 07/92] fs: add ctime accessors infrastructure
  2023-07-05 18:58 ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Jeff Layton
@ 2023-07-05 23:12   ` Damien Le Moal
  0 siblings, 0 replies; 22+ messages in thread
From: Damien Le Moal @ 2023-07-05 23:12 UTC (permalink / raw)
  To: Jeff Layton, jk, arnd, mpe, npiggin, christophe.leroy, hca, gor,
	agordeev, borntraeger, svens, gregkh, arve, tkjos, maco, joel,
	brauner, cmllamas, surenb, dennis.dalessandro, jgg, leon,
	bwarrum, rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba,
	dhowells, marc.dionne, viro, raven, luisbg, salah.triki,
	aivazian.tigran, ebiederm, keescook, clm, josef, xiubli,
	idryomov, jaharkes, coda, jlbec, hch, nico, rafael, code, ardb,
	xiang, chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack,
	tytso, adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso,
	agruenba, richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, naohiro.aota, jth, ast, daniel,
	andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux
  Cc: Jan Kara

On 7/6/23 03:58, Jeff Layton wrote:
> struct timespec64 has unused bits in the tv_nsec field that can be used
> for other purposes. In future patches, we're going to change how the
> inode->i_ctime is accessed in certain inodes in order to make use of
> them. In order to do that safely though, we'll need to eradicate raw
> accesses of the inode->i_ctime field from the kernel.
> 
> Add new accessor functions for the ctime that we use to replace them.
> 
> Reviewed-by: Jan Kara <jack@suse.cz>
> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-05 18:58 ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
@ 2023-07-05 23:19   ` Damien Le Moal
  2023-07-06  0:04     ` Jeff Layton
  2023-07-06 10:27   ` Jan Kara
  2023-08-30  0:19   ` Al Viro
  2 siblings, 1 reply; 22+ messages in thread
From: Damien Le Moal @ 2023-07-05 23:19 UTC (permalink / raw)
  To: Jeff Layton, jk, arnd, mpe, npiggin, christophe.leroy, hca, gor,
	agordeev, borntraeger, svens, gregkh, arve, tkjos, maco, joel,
	brauner, cmllamas, surenb, dennis.dalessandro, jgg, leon,
	bwarrum, rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba,
	dhowells, marc.dionne, viro, raven, luisbg, salah.triki,
	aivazian.tigran, ebiederm, keescook, clm, josef, xiubli,
	idryomov, jaharkes, coda, jlbec, hch, nico, rafael, code, ardb,
	xiang, chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack,
	tytso, adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso,
	agruenba, richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, naohiro.aota, jth, ast, daniel,
	andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

On 7/6/23 03:58, Jeff Layton wrote:
> A rename potentially involves updating 4 different inode timestamps. Add
> a function that handles the details sanely, and convert the libfs.c
> callers to use it.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/libfs.c         | 36 +++++++++++++++++++++++++++---------
>  include/linux/fs.h |  2 ++
>  2 files changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/libfs.c b/fs/libfs.c
> index a7e56baf8bbd..9ee79668c909 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -692,6 +692,31 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
>  }
>  EXPORT_SYMBOL(simple_rmdir);
>  
> +/**
> + * simple_rename_timestamp - update the various inode timestamps for rename
> + * @old_dir: old parent directory
> + * @old_dentry: dentry that is being renamed
> + * @new_dir: new parent directory
> + * @new_dentry: target for rename
> + *
> + * POSIX mandates that the old and new parent directories have their ctime and
> + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have
> + * their ctime updated.
> + */
> +void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
> +			     struct inode *new_dir, struct dentry *new_dentry)
> +{
> +	struct inode *newino = d_inode(new_dentry);
> +
> +	old_dir->i_mtime = inode_set_ctime_current(old_dir);
> +	if (new_dir != old_dir)
> +		new_dir->i_mtime = inode_set_ctime_current(new_dir);
> +	inode_set_ctime_current(d_inode(old_dentry));
> +	if (newino)
> +		inode_set_ctime_current(newino);
> +}
> +EXPORT_SYMBOL_GPL(simple_rename_timestamp);
> +
>  int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
>  			   struct inode *new_dir, struct dentry *new_dentry)
>  {
> @@ -707,11 +732,7 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
>  			inc_nlink(old_dir);
>  		}
>  	}
> -	old_dir->i_ctime = old_dir->i_mtime =
> -	new_dir->i_ctime = new_dir->i_mtime =
> -	d_inode(old_dentry)->i_ctime =
> -	d_inode(new_dentry)->i_ctime = current_time(old_dir);
> -
> +	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);

This is somewhat changing the current behavior: before the patch, the mtime and
ctime of old_dir, new_dir and the inodes associated with the dentries are always
equal. But given that simple_rename_timestamp() calls inode_set_ctime_current()
4 times, the times could potentially be different.

I am not sure if that is an issue, but it seems that calling
inode_set_ctime_current() once, recording the "now" time it sets and using that
value to set all times may be more efficient and preserve the existing behavior.

>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(simple_rename_exchange);
> @@ -720,7 +741,6 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>  		  struct dentry *old_dentry, struct inode *new_dir,
>  		  struct dentry *new_dentry, unsigned int flags)
>  {
> -	struct inode *inode = d_inode(old_dentry);
>  	int they_are_dirs = d_is_dir(old_dentry);
>  
>  	if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
> @@ -743,9 +763,7 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>  		inc_nlink(new_dir);
>  	}
>  
> -	old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
> -		new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
> -
> +	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
>  	return 0;
>  }
>  EXPORT_SYMBOL(simple_rename);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index bdfbd11a5811..14e38bd900f1 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2979,6 +2979,8 @@ extern int simple_open(struct inode *inode, struct file *file);
>  extern int simple_link(struct dentry *, struct inode *, struct dentry *);
>  extern int simple_unlink(struct inode *, struct dentry *);
>  extern int simple_rmdir(struct inode *, struct dentry *);
> +void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
> +			     struct inode *new_dir, struct dentry *new_dentry);
>  extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
>  				  struct inode *new_dir, struct dentry *new_dentry);
>  extern int simple_rename(struct mnt_idmap *, struct inode *,

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime
  2023-07-05 18:58 ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
@ 2023-07-05 23:19   ` Damien Le Moal
  2023-07-06 14:58   ` Jan Kara
  1 sibling, 0 replies; 22+ messages in thread
From: Damien Le Moal @ 2023-07-05 23:19 UTC (permalink / raw)
  To: Jeff Layton, jk, arnd, mpe, npiggin, christophe.leroy, hca, gor,
	agordeev, borntraeger, svens, gregkh, arve, tkjos, maco, joel,
	brauner, cmllamas, surenb, dennis.dalessandro, jgg, leon,
	bwarrum, rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba,
	dhowells, marc.dionne, viro, raven, luisbg, salah.triki,
	aivazian.tigran, ebiederm, keescook, clm, josef, xiubli,
	idryomov, jaharkes, coda, jlbec, hch, nico, rafael, code, ardb,
	xiang, chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack,
	tytso, adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso,
	agruenba, richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, naohiro.aota, jth, ast, daniel,
	andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

On 7/6/23 03:58, Jeff Layton wrote:
> Now that everything in-tree is converted to use the accessor functions,
> rename the i_ctime field in the inode to discourage direct access.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-05 23:19   ` Damien Le Moal
@ 2023-07-06  0:04     ` Jeff Layton
  2023-07-06 21:02       ` [apparmor] " Seth Arnold
  0 siblings, 1 reply; 22+ messages in thread
From: Jeff Layton @ 2023-07-06  0:04 UTC (permalink / raw)
  To: Damien Le Moal, jk, arnd, mpe, npiggin, christophe.leroy, hca,
	gor, agordeev, borntraeger, svens, gregkh, arve, tkjos, maco,
	joel, brauner, cmllamas, surenb, dennis.dalessandro, jgg, leon,
	bwarrum, rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba,
	dhowells, marc.dionne, viro, raven, luisbg, salah.triki,
	aivazian.tigran, ebiederm, keescook, clm, josef, xiubli,
	idryomov, jaharkes, coda, jlbec, hch, nico, rafael, code, ardb,
	xiang, chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack,
	tytso, adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso,
	agruenba, richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, naohiro.aota, jth, ast, daniel,
	andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

On Thu, 2023-07-06 at 08:19 +0900, Damien Le Moal wrote:
> On 7/6/23 03:58, Jeff Layton wrote:
> > A rename potentially involves updating 4 different inode timestamps. Add
> > a function that handles the details sanely, and convert the libfs.c
> > callers to use it.
> > 
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> >  fs/libfs.c         | 36 +++++++++++++++++++++++++++---------
> >  include/linux/fs.h |  2 ++
> >  2 files changed, 29 insertions(+), 9 deletions(-)
> > 
> > diff --git a/fs/libfs.c b/fs/libfs.c
> > index a7e56baf8bbd..9ee79668c909 100644
> > --- a/fs/libfs.c
> > +++ b/fs/libfs.c
> > @@ -692,6 +692,31 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
> >  }
> >  EXPORT_SYMBOL(simple_rmdir);
> >  
> > +/**
> > + * simple_rename_timestamp - update the various inode timestamps for rename
> > + * @old_dir: old parent directory
> > + * @old_dentry: dentry that is being renamed
> > + * @new_dir: new parent directory
> > + * @new_dentry: target for rename
> > + *
> > + * POSIX mandates that the old and new parent directories have their ctime and
> > + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have
> > + * their ctime updated.
> > + */
> > +void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
> > +			     struct inode *new_dir, struct dentry *new_dentry)
> > +{
> > +	struct inode *newino = d_inode(new_dentry);
> > +
> > +	old_dir->i_mtime = inode_set_ctime_current(old_dir);
> > +	if (new_dir != old_dir)
> > +		new_dir->i_mtime = inode_set_ctime_current(new_dir);
> > +	inode_set_ctime_current(d_inode(old_dentry));
> > +	if (newino)
> > +		inode_set_ctime_current(newino);
> > +}
> > +EXPORT_SYMBOL_GPL(simple_rename_timestamp);
> > +
> >  int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
> >  			   struct inode *new_dir, struct dentry *new_dentry)
> >  {
> > @@ -707,11 +732,7 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
> >  			inc_nlink(old_dir);
> >  		}
> >  	}
> > -	old_dir->i_ctime = old_dir->i_mtime =
> > -	new_dir->i_ctime = new_dir->i_mtime =
> > -	d_inode(old_dentry)->i_ctime =
> > -	d_inode(new_dentry)->i_ctime = current_time(old_dir);
> > -
> > +	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
> 
> This is somewhat changing the current behavior: before the patch, the mtime and
> ctime of old_dir, new_dir and the inodes associated with the dentries are always
> equal. But given that simple_rename_timestamp() calls inode_set_ctime_current()
> 4 times, the times could potentially be different.
> 
> I am not sure if that is an issue, but it seems that calling
> inode_set_ctime_current() once, recording the "now" time it sets and using that
> value to set all times may be more efficient and preserve the existing behavior.
> 

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.

The other problem with doing it that way is that it assumes that
current_time(inode) should always return the same value when given
different inodes. Is it really correct to do this?

	inode_set_ctime(dir, inode_set_ctime_current(inode));

"dir" and "inode" are different inodes, after all, and you're setting
dir's timestamp to "inode"'s value. It's not a big deal today since
they're always on the same sb, but the ultimate goal of these changes is
to implement multigrain timestamps. That will mean that fetching a fine-
grained timestamp for an update when the existing mtime or ctime value
has been queried via getattr.

With that change, I think it's best that we treat updates to different
inodes individually, as some of them may require updating with a fine-
grained timestamp and some may not.

> >  	return 0;
> >  }
> >  EXPORT_SYMBOL_GPL(simple_rename_exchange);
> > @@ -720,7 +741,6 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> >  		  struct dentry *old_dentry, struct inode *new_dir,
> >  		  struct dentry *new_dentry, unsigned int flags)
> >  {
> > -	struct inode *inode = d_inode(old_dentry);
> >  	int they_are_dirs = d_is_dir(old_dentry);
> >  
> >  	if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
> > @@ -743,9 +763,7 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> >  		inc_nlink(new_dir);
> >  	}
> >  
> > -	old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
> > -		new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
> > -
> > +	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
> >  	return 0;
> >  }
> >  EXPORT_SYMBOL(simple_rename);
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index bdfbd11a5811..14e38bd900f1 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -2979,6 +2979,8 @@ extern int simple_open(struct inode *inode, struct file *file);
> >  extern int simple_link(struct dentry *, struct inode *, struct dentry *);
> >  extern int simple_unlink(struct inode *, struct dentry *);
> >  extern int simple_rmdir(struct inode *, struct dentry *);
> > +void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
> > +			     struct inode *new_dir, struct dentry *new_dentry);
> >  extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
> >  				  struct inode *new_dir, struct dentry *new_dentry);
> >  extern int simple_rename(struct mnt_idmap *, struct inode *,
> 

-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-05 18:58 ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
  2023-07-05 23:19   ` Damien Le Moal
@ 2023-07-06 10:27   ` Jan Kara
  2023-08-30  0:19   ` Al Viro
  2 siblings, 0 replies; 22+ messages in thread
From: Jan Kara @ 2023-07-06 10:27 UTC (permalink / raw)
  To: Jeff Layton
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed 05-07-23 14:58:11, Jeff Layton wrote:
> A rename potentially involves updating 4 different inode timestamps. Add
> a function that handles the details sanely, and convert the libfs.c
> callers to use it.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/libfs.c         | 36 +++++++++++++++++++++++++++---------
>  include/linux/fs.h |  2 ++
>  2 files changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/libfs.c b/fs/libfs.c
> index a7e56baf8bbd..9ee79668c909 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -692,6 +692,31 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
>  }
>  EXPORT_SYMBOL(simple_rmdir);
>  
> +/**
> + * simple_rename_timestamp - update the various inode timestamps for rename
> + * @old_dir: old parent directory
> + * @old_dentry: dentry that is being renamed
> + * @new_dir: new parent directory
> + * @new_dentry: target for rename
> + *
> + * POSIX mandates that the old and new parent directories have their ctime and
> + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have
> + * their ctime updated.
> + */
> +void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
> +			     struct inode *new_dir, struct dentry *new_dentry)
> +{
> +	struct inode *newino = d_inode(new_dentry);
> +
> +	old_dir->i_mtime = inode_set_ctime_current(old_dir);
> +	if (new_dir != old_dir)
> +		new_dir->i_mtime = inode_set_ctime_current(new_dir);
> +	inode_set_ctime_current(d_inode(old_dentry));
> +	if (newino)
> +		inode_set_ctime_current(newino);
> +}
> +EXPORT_SYMBOL_GPL(simple_rename_timestamp);
> +
>  int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
>  			   struct inode *new_dir, struct dentry *new_dentry)
>  {
> @@ -707,11 +732,7 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
>  			inc_nlink(old_dir);
>  		}
>  	}
> -	old_dir->i_ctime = old_dir->i_mtime =
> -	new_dir->i_ctime = new_dir->i_mtime =
> -	d_inode(old_dentry)->i_ctime =
> -	d_inode(new_dentry)->i_ctime = current_time(old_dir);
> -
> +	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(simple_rename_exchange);
> @@ -720,7 +741,6 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>  		  struct dentry *old_dentry, struct inode *new_dir,
>  		  struct dentry *new_dentry, unsigned int flags)
>  {
> -	struct inode *inode = d_inode(old_dentry);
>  	int they_are_dirs = d_is_dir(old_dentry);
>  
>  	if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
> @@ -743,9 +763,7 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>  		inc_nlink(new_dir);
>  	}
>  
> -	old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
> -		new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
> -
> +	simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
>  	return 0;
>  }
>  EXPORT_SYMBOL(simple_rename);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index bdfbd11a5811..14e38bd900f1 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2979,6 +2979,8 @@ extern int simple_open(struct inode *inode, struct file *file);
>  extern int simple_link(struct dentry *, struct inode *, struct dentry *);
>  extern int simple_unlink(struct inode *, struct dentry *);
>  extern int simple_rmdir(struct inode *, struct dentry *);
> +void simple_rename_timestamp(struct inode *old_dir, struct dentry *old_dentry,
> +			     struct inode *new_dir, struct dentry *new_dentry);
>  extern int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
>  				  struct inode *new_dir, struct dentry *new_dentry);
>  extern int simple_rename(struct mnt_idmap *, struct inode *,
> -- 
> 2.41.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime
  2023-07-05 18:58 ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
  2023-07-05 23:19   ` Damien Le Moal
@ 2023-07-06 14:58   ` Jan Kara
  1 sibling, 0 replies; 22+ messages in thread
From: Jan Kara @ 2023-07-06 14:58 UTC (permalink / raw)
  To: Jeff Layton
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed 05-07-23 14:58:12, Jeff Layton wrote:
> Now that everything in-tree is converted to use the accessor functions,
> rename the i_ctime field in the inode to discourage direct access.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  include/linux/fs.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 14e38bd900f1..b66442f91835 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -642,7 +642,7 @@ struct inode {
>  	loff_t			i_size;
>  	struct timespec64	i_atime;
>  	struct timespec64	i_mtime;
> -	struct timespec64	i_ctime;
> +	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
>  	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
>  	unsigned short          i_bytes;
>  	u8			i_blkbits;
> @@ -1485,7 +1485,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
>   */
>  static inline struct timespec64 inode_get_ctime(const struct inode *inode)
>  {
> -	return inode->i_ctime;
> +	return inode->__i_ctime;
>  }
>  
>  /**
> @@ -1498,7 +1498,7 @@ static inline struct timespec64 inode_get_ctime(const struct inode *inode)
>  static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode,
>  						      struct timespec64 ts)
>  {
> -	inode->i_ctime = ts;
> +	inode->__i_ctime = ts;
>  	return ts;
>  }
>  
> -- 
> 2.41.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-05 21:57 ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
@ 2023-07-06 15:16   ` Eric W. Biederman
  2023-07-06 16:14     ` Jeff Layton
  0 siblings, 1 reply; 22+ messages in thread
From: Eric W. Biederman @ 2023-07-06 15:16 UTC (permalink / raw)
  To: Jeff Layton
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	keescook, clm, josef, xiubli, idryomov, jaharkes, coda, jlbec,
	hch, nico, rafael, code, ardb, xiang, chao, huyue2, jefflexu,
	linkinjeon, sj1557.seo, jack, tytso, adilger.kernel, jaegeuk,
	hirofumi, miklos, rpeterso, agruenba, richard, anton.ivanov,
	johannes, mikulas, mike.kravetz, muchun.song, dwmw2, shaggy, tj,
	trond.myklebust, anna, chuck.lever, neilb, kolga, Dai.Ngo, tom,
	konishi.ryusuke, anton, almaz.alexandrovich, mark, joseph.qi, me,
	hubcap, martin, amir73il, mcgrof, yzaikin, tony.luck, gpiccoli,
	al, sfrench, pc, lsahlber, sprasad, senozhatsky, phillip,
	rostedt, mhiramat, dushistov, hdegoede, djwong, dlemoal,
	naohiro.aota, jth, ast, daniel, andrii, martin.lau, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, hughd, akpm, davem,
	edumazet, kuba, pabeni, john.johansen, paul, jmorris, serge,
	stephen.smalley.work, eparis, jgross, stern, lrh2000,
	sebastian.reichel, wsa+renesas, quic_ugoswami, quic_linyyuan,
	john, error27, quic_uaggarwa, hayama, jomajm, axboe, dhavale,
	dchinner, hannes, zhangpeng362, slava, gargaditya08,
	penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy, okanatov,
	jeffxu, linux, mirimmad17, yijiangshan, yang.yang29, xu.xin16,
	chengzhihao1, shr, Liam.Howlett, adobriyan, chi.minghao,
	roberto.sassu, linuszeng, bvanassche, zohar, yi.zhang, trix,
	fmdefrancesco, ebiggers, princekumarmaurya06, chenzhongjin, riel,
	shaozhengchao, jingyuwang_vip, linuxppc-dev, linux-kernel,
	linux-s390, linux-rdma, linux-usb, v9fs, linux-fsdevel,
	linux-afs, autofs, linux-mm, linux-btrfs, ceph-devel, codalist,
	ecryptfs, linux-efi, linux-erofs, linux-ext4, linux-f2fs-devel,
	cluster-devel, linux-um, linux-mtd, jfs-discussion, linux-nfs,
	linux-nilfs, linux-ntfs-dev, ntfs3, ocfs2-devel,
	linux-karma-devel, devel, linux-unionfs, linux-hardening,
	reiserfs-devel, linux-cifs, samba-technical, linux-trace-kernel,
	linux-xfs, bpf, netdev, apparmor, linux-security-module, selinux

Jeff Layton <jlayton@kernel.org> writes:

> On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote:
>> v2:
>> - prepend patches to add missing ctime updates
>> - add simple_rename_timestamp helper function
>> - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
>> - drop individual inode_ctime_set_{sec,nsec} helpers
>> 
>> I've been working on a patchset to change how the inode->i_ctime is
>> accessed in order to give us conditional, high-res timestamps for the
>> ctime and mtime. struct timespec64 has unused bits in it that we can use
>> to implement this. In order to do that however, we need to wrap all
>> accesses of inode->i_ctime to ensure that bits used as flags are
>> appropriately handled.
>> 
>> The patchset starts with reposts of some missing ctime updates that I
>> spotted in the tree. It then adds a new helper function for updating the
>> timestamp after a successful rename, and new ctime accessor
>> infrastructure.
>> 
>> The bulk of the patchset is individual conversions of different
>> subsysteme to use the new infrastructure. Finally, the patchset renames
>> the i_ctime field to __i_ctime to help ensure that I didn't miss
>> anything.
>> 
>> This should apply cleanly to linux-next as of this morning.
>> 
>> Most of this conversion was done via 5 different coccinelle scripts, run
>> in succession, with a large swath of by-hand conversions to clean up the
>> remainder.
>> 
>
> A couple of other things I should note:
>
> If you sent me an Acked-by or Reviewed-by in the previous set, then I
> tried to keep it on the patch here, since the respun patches are mostly
> just renaming stuff from v1. Let me know if I've missed any.
>
> I've also pushed the pile to my tree as this tag:
>
>     https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/tag/?h=ctime.20230705
>
> In case that's easier to work with.

Are there any preliminary patches showing what you want your introduced
accessors to turn into?  It is hard to judge the sanity of the
introduction of wrappers without seeing what the wrappers are ultimately
going to do.

Eric

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-06 15:16   ` Eric W. Biederman
@ 2023-07-06 16:14     ` Jeff Layton
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Layton @ 2023-07-06 16:14 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	keescook, clm, josef, xiubli, idryomov, jaharkes, coda, jlbec,
	hch, nico, rafael, code, ardb, xiang, chao, huyue2, jefflexu,
	linkinjeon, sj1557.seo, jack, tytso, adilger.kernel, jaegeuk,
	hirofumi, miklos, rpeterso, agruenba, richard, anton.ivanov,
	johannes, mikulas, mike.kravetz, muchun.song, dwmw2, shaggy, tj,
	trond.myklebust, anna, chuck.lever, neilb, kolga, Dai.Ngo, tom,
	konishi.ryusuke, anton, almaz.alexandrovich, mark, joseph.qi, me,
	hubcap, martin, amir73il, mcgrof, yzaikin, tony.luck, gpiccoli,
	al, sfrench, pc, lsahlber, sprasad, senozhatsky, phillip,
	rostedt, mhiramat, dushistov, hdegoede, djwong, dlemoal,
	naohiro.aota, jth, ast, daniel, andrii, martin.lau, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, hughd, akpm, davem,
	edumazet, kuba, pabeni, john.johansen, paul, jmorris, serge,
	stephen.smalley.work, eparis, jgross, stern, lrh2000,
	sebastian.reichel, wsa+renesas, quic_ugoswami, quic_linyyuan,
	john, error27, quic_uaggarwa, hayama, jomajm, axboe, dhavale,
	dchinner, hannes, zhangpeng362, slava, gargaditya08,
	penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy, okanatov,
	jeffxu, linux, mirimmad17, yijiangshan, yang.yang29, xu.xin16,
	chengzhihao1, shr, Liam.Howlett, adobriyan, chi.minghao,
	roberto.sassu, linuszeng, bvanassche, zohar, yi.zhang, trix,
	fmdefrancesco, ebiggers, princekumarmaurya06, chenzhongjin, riel,
	shaozhengchao, jingyuwang_vip, linuxppc-dev, linux-kernel,
	linux-s390, linux-rdma, linux-usb, v9fs, linux-fsdevel,
	linux-afs, autofs, linux-mm, linux-btrfs, ceph-devel, codalist,
	ecryptfs, linux-efi, linux-erofs, linux-ext4, linux-f2fs-devel,
	cluster-devel, linux-um, linux-mtd, jfs-discussion, linux-nfs,
	linux-nilfs, linux-ntfs-dev, ntfs3, ocfs2-devel,
	linux-karma-devel, devel, linux-unionfs, linux-hardening,
	reiserfs-devel, linux-cifs, samba-technical, linux-trace-kernel,
	linux-xfs, bpf, netdev, apparmor, linux-security-module, selinux

On Thu, 2023-07-06 at 10:16 -0500, Eric W. Biederman wrote:
> Jeff Layton <jlayton@kernel.org> writes:
> 
> > On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote:
> > > v2:
> > > - prepend patches to add missing ctime updates
> > > - add simple_rename_timestamp helper function
> > > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> > > - drop individual inode_ctime_set_{sec,nsec} helpers
> > > 
> > > I've been working on a patchset to change how the inode->i_ctime is
> > > accessed in order to give us conditional, high-res timestamps for the
> > > ctime and mtime. struct timespec64 has unused bits in it that we can use
> > > to implement this. In order to do that however, we need to wrap all
> > > accesses of inode->i_ctime to ensure that bits used as flags are
> > > appropriately handled.
> > > 
> > > The patchset starts with reposts of some missing ctime updates that I
> > > spotted in the tree. It then adds a new helper function for updating the
> > > timestamp after a successful rename, and new ctime accessor
> > > infrastructure.
> > > 
> > > The bulk of the patchset is individual conversions of different
> > > subsysteme to use the new infrastructure. Finally, the patchset renames
> > > the i_ctime field to __i_ctime to help ensure that I didn't miss
> > > anything.
> > > 
> > > This should apply cleanly to linux-next as of this morning.
> > > 
> > > Most of this conversion was done via 5 different coccinelle scripts, run
> > > in succession, with a large swath of by-hand conversions to clean up the
> > > remainder.
> > > 
> > 
> > A couple of other things I should note:
> > 
> > If you sent me an Acked-by or Reviewed-by in the previous set, then I
> > tried to keep it on the patch here, since the respun patches are mostly
> > just renaming stuff from v1. Let me know if I've missed any.
> > 
> > I've also pushed the pile to my tree as this tag:
> > 
> >     https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/tag/?h=ctime.20230705
> > 
> > In case that's easier to work with.
> 
> Are there any preliminary patches showing what you want your introduced
> accessors to turn into?  It is hard to judge the sanity of the
> introduction of wrappers without seeing what the wrappers are ultimately
> going to do.
> 
> Eric

I have a draft version of the multigrain patches on top of the wrapper
conversion I've already posted in my "mgctime-experimental" branch:

    https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/log/?h=mgctime-experimental

The rationale is best explained in this changelog:

    https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?h=mgctime-experimental&id=face437a144d3375afb7f70c233b0644b4edccba

The idea will be to enable this on a per-fs basis.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [apparmor] [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-06  0:04     ` Jeff Layton
@ 2023-07-06 21:02       ` Seth Arnold
  2023-07-07 10:50         ` Jeff Layton
  0 siblings, 1 reply; 22+ messages in thread
From: Seth Arnold @ 2023-07-06 21:02 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Damien Le Moal, jk, arnd, mpe, npiggin, christophe.leroy, hca,
	gor, agordeev, borntraeger, svens, gregkh, arve, tkjos, maco,
	joel, brauner, cmllamas, surenb, dennis.dalessandro, jgg, leon,
	bwarrum, rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba,
	dhowells, marc.dionne, viro, raven, luisbg, salah.triki,
	aivazian.tigran, ebiederm, keescook, clm, josef, xiubli,
	idryomov, jaharkes, coda, jlbec, hch, nico, rafael, code, ardb,
	xiang, chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack,
	tytso, adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso,
	agruenba, richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, naohiro.aota, jth, ast, daniel,
	andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

[-- 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 --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [apparmor] [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-06 21:02       ` [apparmor] " Seth Arnold
@ 2023-07-07 10:50         ` Jeff Layton
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Layton @ 2023-07-07 10:50 UTC (permalink / raw)
  To: Seth Arnold
  Cc: Damien Le Moal, jk, arnd, mpe, npiggin, christophe.leroy, hca,
	gor, agordeev, borntraeger, svens, gregkh, arve, tkjos, maco,
	joel, brauner, cmllamas, surenb, dennis.dalessandro, jgg, leon,
	bwarrum, rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba,
	dhowells, marc.dionne, viro, raven, luisbg, salah.triki,
	aivazian.tigran, ebiederm, keescook, clm, josef, xiubli,
	idryomov, jaharkes, coda, jlbec, hch, nico, rafael, code, ardb,
	xiang, chao, huyue2, jefflexu, linkinjeon, sj1557.seo, jack,
	tytso, adilger.kernel, jaegeuk, hirofumi, miklos, rpeterso,
	agruenba, richard, anton.ivanov, johannes, mikulas, mike.kravetz,
	muchun.song, dwmw2, shaggy, tj, trond.myklebust, anna,
	chuck.lever, neilb, kolga, Dai.Ngo, tom, konishi.ryusuke, anton,
	almaz.alexandrovich, mark, joseph.qi, me, hubcap, martin,
	amir73il, mcgrof, yzaikin, tony.luck, gpiccoli, al, sfrench, pc,
	lsahlber, sprasad, senozhatsky, phillip, rostedt, mhiramat,
	dushistov, hdegoede, djwong, naohiro.aota, jth, ast, daniel,
	andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, hughd, akpm, davem, edumazet, kuba, pabeni,
	john.johansen, paul, jmorris, serge, stephen.smalley.work,
	eparis, jgross, stern, lrh2000, sebastian.reichel, wsa+renesas,
	quic_ugoswami, quic_linyyuan, john, error27, quic_uaggarwa,
	hayama, jomajm, axboe, dhavale, dchinner, hannes, zhangpeng362,
	slava, gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe,
	willy, okanatov, jeffxu, linux, mirimmad17, yijiangshan,
	yang.yang29, xu.xin16, chengzhihao1, shr, Liam.Howlett,
	adobriyan, chi.minghao, roberto.sassu, linuszeng, bvanassche,
	zohar, yi.zhang, trix, fmdefrancesco, ebiggers,
	princekumarmaurya06, chenzhongjin, riel, shaozhengchao,
	jingyuwang_vip, linuxppc-dev, linux-kernel, linux-s390,
	linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs, autofs,
	linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

On Thu, 2023-07-06 at 21:02 +0000, Seth Arnold wrote:
> 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:
> 

Thanks for looking into this!

To be clear, POSIX doesn't require that _different_ inodes ever be set
to the same timestamp value. IOW, it certainly doesn't require that the
source and target directories on a rename() end up with the exact same
timestamp value.

Granted, POSIX is rather vague on timestamps in general, but most of the
examples below involve comparing different timestamps on the _same_
inode.


> 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;
> 

This should be fine with this patchset. Note that this is comparing
a/c/mtime on the same inode, and our usual pattern on inode
instantiation is:

    inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);

...which should result in all of inode's timestamps being synchronized.

> 
> 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;
> 

Ditto here.

> 
> 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 */
>   {
> 

This one is really weird. You have two different struct stat's, "o" and
"s". I assume though that these should be stat values from the same
inode, because otherwise this comparison would make no sense:

      ((s->st_ctime != o.st_ctime) &&           /*     file changed (moved) */

In general, we can never contrive to ensure that the ctime of two
different inodes are the same, since that is always set by the kernel to
the current time, and you'd have to ensure that they were created within
the same jiffy (at least with today's code).

> 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;
> 		}
> 

Ditto here with the first examples. This involves comparing timestamps
on the same inode, which should be fine.

> 
> 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
> 

(I kinda miss Perl. I wrote a bunch of stuff in it in the 90's and early
naughties)

I think this test is supposed to be testing whether the mtime changes on
link() ?

-----------------8<----------------
    my($nlink, $mtime, $ctime) = (stat($tmpfile))[$NLINK, $MTIME, $CTIME];

[...]


        skip "Solaris tmpfs has different mtime/ctime link semantics", 2
                                     if $Is_Solaris and $cwd =~ m#^/tmp# and
                                        $mtime && $mtime == $ctime;
-----------------8<----------------

...again, I think this would be ok too since it's just comparing the
mtime and ctime of the same inode. Granted this is a Solaris-specific
test, but Linux would be fine here too.

So in conclusion, I don't think this patchset will cause problems with
any of the above code.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
                   ` (3 preceding siblings ...)
  2023-07-05 21:57 ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
@ 2023-07-07 12:42 ` Jeff Layton
  2023-07-10 12:35   ` Christian Brauner
  2023-07-10 12:18 ` [PATCH v2 00/92] " Christian Brauner
  2023-09-04 18:11 ` [f2fs-dev] [PATCH v2 00/89] " patchwork-bot+f2fs
  6 siblings, 1 reply; 22+ messages in thread
From: Jeff Layton @ 2023-07-07 12:42 UTC (permalink / raw)
  To: Christian Brauner
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote:
> v2:
> - prepend patches to add missing ctime updates
> - add simple_rename_timestamp helper function
> - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> - drop individual inode_ctime_set_{sec,nsec} helpers
> 

After review by Jan and others, and Jan's ext4 rework, the diff on top
of the series I posted a couple of days ago is below. I don't really
want to spam everyone with another ~100 patch v3 series, but I can if
you think that's best.

Christian, what would you like me to do here?

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index bcdb1a0beccf..5f6e93714f5a 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -699,8 +699,7 @@ void ceph_fill_file_time(struct inode *inode, int issued,
 		if (ci->i_version == 0 ||
 		    timespec64_compare(ctime, &ictime) > 0) {
 			dout("ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n",
-			     inode_get_ctime(inode).tv_sec,
-			     inode_get_ctime(inode).tv_nsec,
+			     ictime.tv_sec, ictime.tv_nsec,
 			     ctime->tv_sec, ctime->tv_nsec);
 			inode_set_ctime_to_ts(inode, *ctime);
 		}
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 806374d866d1..567c0d305ea4 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -175,10 +175,7 @@ static void *erofs_read_inode(struct erofs_buf *buf,
 		vi->chunkbits = sb->s_blocksize_bits +
 			(vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
 	}
-	inode->i_mtime.tv_sec = inode_get_ctime(inode).tv_sec;
-	inode->i_atime.tv_sec = inode_get_ctime(inode).tv_sec;
-	inode->i_mtime.tv_nsec = inode_get_ctime(inode).tv_nsec;
-	inode->i_atime.tv_nsec = inode_get_ctime(inode).tv_nsec;
+	inode->i_mtime = inode->i_atime = inode_get_ctime(inode);
 
 	inode->i_flags &= ~S_DAX;
 	if (test_opt(&sbi->opt, DAX_ALWAYS) && S_ISREG(inode->i_mode) &&
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index c007de6ac1c7..1b9f587f6cca 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -1351,7 +1351,7 @@ static int exfat_rename(struct mnt_idmap *idmap,
 			exfat_warn(sb, "abnormal access to an inode dropped");
 			WARN_ON(new_inode->i_nlink == 0);
 		}
-		EXFAT_I(new_inode)->i_crtime = inode_set_ctime_current(new_inode);
+		EXFAT_I(new_inode)->i_crtime = current_time(new_inode);
 	}
 
 unlock:
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index d502b930431b..d63543187359 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -868,64 +868,63 @@ struct ext4_inode {
  * affected filesystem before 2242.
  */
 
-static inline __le32 ext4_encode_extra_time(struct timespec64 *time)
+static inline __le32 ext4_encode_extra_time(struct timespec64 ts)
 {
-	u32 extra =((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK;
-	return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS));
+	u32 extra = ((ts.tv_sec - (s32)ts.tv_sec) >> 32) & EXT4_EPOCH_MASK;
+	return cpu_to_le32(extra | (ts.tv_nsec << EXT4_EPOCH_BITS));
 }
 
-static inline void ext4_decode_extra_time(struct timespec64 *time,
-					  __le32 extra)
+static inline struct timespec64 ext4_decode_extra_time(__le32 base,
+						       __le32 extra)
 {
+	struct timespec64 ts = { .tv_sec = le32_to_cpu(base) };
+
 	if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK)))
-		time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32;
-	time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
+		ts.tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32;
+	ts.tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
+	return ts;
 }
 
-#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode)				\
+#define EXT4_INODE_SET_XTIME_VAL(xtime, inode, raw_inode, ts)			\
 do {										\
-	if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra))     {\
-		(raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec);	\
-		(raw_inode)->xtime ## _extra =					\
-				ext4_encode_extra_time(&(inode)->xtime);	\
-		}								\
-	else	\
-		(raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (inode)->xtime.tv_sec, S32_MIN, S32_MAX));	\
+	if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {	\
+		(raw_inode)->xtime = cpu_to_le32((ts).tv_sec);			\
+		(raw_inode)->xtime ## _extra = ext4_encode_extra_time(ts);	\
+	} else									\
+		(raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (ts).tv_sec, S32_MIN, S32_MAX));	\
 } while (0)
 
+#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode)				\
+	EXT4_INODE_SET_XTIME_VAL(xtime, inode, raw_inode, (inode)->xtime)
+
+#define EXT4_INODE_SET_CTIME(inode, raw_inode)					\
+	EXT4_INODE_SET_XTIME_VAL(i_ctime, inode, raw_inode, inode_get_ctime(inode))
+
 #define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode)			       \
-do {									       \
-	if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime))		       \
-		(raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec);      \
-	if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra))	       \
-		(raw_inode)->xtime ## _extra =				       \
-				ext4_encode_extra_time(&(einode)->xtime);      \
-} while (0)
+	EXT4_INODE_SET_XTIME_VAL(xtime, &((einode)->vfs_inode), raw_inode, (einode)->xtime)
+
+#define EXT4_INODE_GET_XTIME_VAL(xtime, inode, raw_inode)			\
+	(EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra) ?	\
+		ext4_decode_extra_time((raw_inode)->xtime,				\
+				       (raw_inode)->xtime ## _extra) :		\
+		(struct timespec64) {						\
+			.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime)	\
+		})
 
 #define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode)				\
 do {										\
-	(inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime);	\
-	if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {	\
-		ext4_decode_extra_time(&(inode)->xtime,				\
-				       raw_inode->xtime ## _extra);		\
-		}								\
-	else									\
-		(inode)->xtime.tv_nsec = 0;					\
+	(inode)->xtime = EXT4_INODE_GET_XTIME_VAL(xtime, inode, raw_inode);	\
 } while (0)
 
+#define EXT4_INODE_GET_CTIME(inode, raw_inode)					\
+do {										\
+	inode_set_ctime_to_ts(inode,						\
+		EXT4_INODE_GET_XTIME_VAL(i_ctime, inode, raw_inode));		\
+} while (0)
 
 #define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode)			       \
 do {									       \
-	if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime))		       \
-		(einode)->xtime.tv_sec = 				       \
-			(signed)le32_to_cpu((raw_inode)->xtime);	       \
-	else								       \
-		(einode)->xtime.tv_sec = 0;				       \
-	if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra))	       \
-		ext4_decode_extra_time(&(einode)->xtime,		       \
-				       raw_inode->xtime ## _extra);	       \
-	else								       \
-		(einode)->xtime.tv_nsec = 0;				       \
+	(einode)->xtime = EXT4_INODE_GET_XTIME_VAL(xtime, &(einode->vfs_inode), raw_inode);	\
 } while (0)
 
 #define i_disk_version osd1.linux1.l_i_version
@@ -3823,27 +3822,6 @@ static inline int ext4_buffer_uptodate(struct buffer_head *bh)
 	return buffer_uptodate(bh);
 }
 
-static inline void ext4_inode_set_ctime(struct inode *inode, struct ext4_inode *raw_inode)
-{
-	struct timespec64 ctime = inode_get_ctime(inode);
-
-	if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra)) {
-		raw_inode->i_ctime = cpu_to_le32(ctime.tv_sec);
-		raw_inode->i_ctime_extra = ext4_encode_extra_time(&ctime);
-	} else {
-		raw_inode->i_ctime = cpu_to_le32(clamp_t(int32_t, ctime.tv_sec, S32_MIN, S32_MAX));
-	}
-}
-
-static inline void ext4_inode_get_ctime(struct inode *inode, const struct ext4_inode *raw_inode)
-{
-	struct timespec64 ctime = { .tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime) };
-
-	if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra))
-		ext4_decode_extra_time(&ctime, raw_inode->i_ctime_extra);
-	inode_set_ctime(inode, ctime.tv_sec, ctime.tv_nsec);
-}
-
 #endif	/* __KERNEL__ */
 
 #define EFSBADCRC	EBADMSG		/* Bad CRC detected */
diff --git a/fs/ext4/inode-test.c b/fs/ext4/inode-test.c
index 7935ea6cf92c..f0c0fd507fbc 100644
--- a/fs/ext4/inode-test.c
+++ b/fs/ext4/inode-test.c
@@ -245,9 +245,9 @@ static void inode_test_xtimestamp_decoding(struct kunit *test)
 	struct timestamp_expectation *test_param =
 			(struct timestamp_expectation *)(test->param_value);
 
-	timestamp.tv_sec = get_32bit_time(test_param);
-	ext4_decode_extra_time(&timestamp,
-			       cpu_to_le32(test_param->extra_bits));
+	timestamp = ext4_decode_extra_time(
+				cpu_to_le32(get_32bit_time(test_param)),
+				cpu_to_le32(test_param->extra_bits));
 
 	KUNIT_EXPECT_EQ_MSG(test,
 			    test_param->expected.tv_sec,
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index bbc57954dfd3..c6a837b90af4 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4249,7 +4249,7 @@ static int ext4_fill_raw_inode(struct inode *inode, struct ext4_inode *raw_inode
 	}
 	raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
 
-	ext4_inode_set_ctime(inode, raw_inode);
+	EXT4_INODE_SET_CTIME(inode, raw_inode);
 	EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
 	EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
 	EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
@@ -4858,7 +4858,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
 		}
 	}
 
-	ext4_inode_get_ctime(inode, raw_inode);
+	EXT4_INODE_GET_CTIME(inode, raw_inode);
 	EXT4_INODE_GET_XTIME(i_mtime, inode, raw_inode);
 	EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
 	EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
@@ -4981,7 +4981,7 @@ static void __ext4_update_other_inode_time(struct super_block *sb,
 		spin_unlock(&inode->i_lock);
 
 		spin_lock(&ei->i_raw_lock);
-		ext4_inode_get_ctime(inode, raw_inode);
+		EXT4_INODE_SET_CTIME(inode, raw_inode);
 		EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
 		EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
 		ext4_inode_csum_set(inode, raw_inode, ei);
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 2be40ff8a74f..cdd39b6020f3 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1407,9 +1407,7 @@ static int fat_read_root(struct inode *inode)
 	MSDOS_I(inode)->mmu_private = inode->i_size;
 
 	fat_save_attrs(inode, ATTR_DIR);
-	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode_set_ctime(inode,
-									0, 0).tv_sec;
-	inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0;
+	inode->i_mtime = inode->i_atime = inode_set_ctime(inode, 0, 0);
 	set_nlink(inode, fat_subdirs(inode)+2);
 
 	return 0;
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 36babb78b510..f4eb8d6f5989 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -15,8 +15,7 @@ static void hpfs_update_directory_times(struct inode *dir)
 	if (t == dir->i_mtime.tv_sec &&
 	    t == inode_get_ctime(dir).tv_sec)
 		return;
-	dir->i_mtime.tv_sec = inode_set_ctime(dir, t, 0).tv_sec;
-	dir->i_mtime.tv_nsec = 0;
+	dir->i_mtime = inode_set_ctime(dir, t, 0);
 	hpfs_write_inode_nolock(dir);
 }
 
@@ -59,11 +58,8 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 	result->i_ino = fno;
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
 	hpfs_i(result)->i_dno = dno;
-	inode_set_ctime(result,
-			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
-			0);
-	result->i_mtime.tv_nsec = 0; 
-	result->i_atime.tv_nsec = 0; 
+	result->i_mtime = result->i_atime =
+		inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
 	hpfs_i(result)->i_ea_size = 0;
 	result->i_mode |= S_IFDIR;
 	result->i_op = &hpfs_dir_iops;
@@ -168,11 +164,8 @@ static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
 	result->i_fop = &hpfs_file_ops;
 	set_nlink(result, 1);
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
-	inode_set_ctime(result,
-			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
-			0);
-	result->i_mtime.tv_nsec = 0;
-	result->i_atime.tv_nsec = 0;
+	result->i_mtime = result->i_atime =
+		inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
 	hpfs_i(result)->i_ea_size = 0;
 	if (dee.read_only)
 		result->i_mode &= ~0222;
@@ -252,11 +245,8 @@ static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
 	hpfs_init_inode(result);
 	result->i_ino = fno;
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
-	inode_set_ctime(result,
-			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
-			0);
-	result->i_mtime.tv_nsec = 0;
-	result->i_atime.tv_nsec = 0;
+	result->i_mtime = result->i_atime =
+		inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
 	hpfs_i(result)->i_ea_size = 0;
 	result->i_uid = current_fsuid();
 	result->i_gid = current_fsgid();
@@ -329,11 +319,8 @@ static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
 	result->i_ino = fno;
 	hpfs_init_inode(result);
 	hpfs_i(result)->i_parent_dir = dir->i_ino;
-	inode_set_ctime(result,
-			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
-			0);
-	result->i_mtime.tv_nsec = 0;
-	result->i_atime.tv_nsec = 0;
+	result->i_mtime = result->i_atime =
+		inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
 	hpfs_i(result)->i_ea_size = 0;
 	result->i_mode = S_IFLNK | 0777;
 	result->i_uid = current_fsuid();
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 98a78200cff1..2ee21286ac8f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1422,13 +1422,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 			inode->i_ino, de->flags[-high_sierra]);
 	}
 #endif
-
-	inode->i_mtime.tv_sec =
-	inode->i_atime.tv_sec = inode_set_ctime(inode,
-						iso_date(de->date, high_sierra),
-						0).tv_sec;
-	inode->i_mtime.tv_nsec =
-	inode->i_atime.tv_nsec = 0;
+	inode->i_mtime = inode->i_atime =
+		inode_set_ctime(inode, iso_date(de->date, high_sierra), 0);
 
 	ei->i_first_extent = (isonum_733(de->extent) +
 			isonum_711(de->ext_attr_length));
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 3715a3940bd4..8a4fc9420b36 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -501,11 +501,7 @@ static struct inode *V1_minix_iget(struct inode *inode)
 	i_gid_write(inode, raw_inode->i_gid);
 	set_nlink(inode, raw_inode->i_nlinks);
 	inode->i_size = raw_inode->i_size;
-	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode_set_ctime(inode,
-									raw_inode->i_time,
-									0).tv_sec;
-	inode->i_mtime.tv_nsec = 0;
-	inode->i_atime.tv_nsec = 0;
+	inode->i_mtime = inode->i_atime = inode_set_ctime(inode, raw_inode->i_time, 0);
 	inode->i_blocks = 0;
 	for (i = 0; i < 9; i++)
 		minix_inode->u.i1_data[i] = raw_inode->i_zone[i];
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 7acd3e3fe790..7e7876aae01c 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -255,7 +255,7 @@ static void ovl_file_accessed(struct file *file)
 	if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
 	     !timespec64_equal(&ctime, &uctime))) {
 		inode->i_mtime = upperinode->i_mtime;
-		inode_set_ctime_to_ts(inode, inode_get_ctime(upperinode));
+		inode_set_ctime_to_ts(inode, uctime);
 	}
 
 	touch_atime(&file->f_path);
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index 961b9d342e0e..d89739655f9e 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -322,8 +322,7 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)
 
 	set_nlink(i, 1);		/* Hard to decide.. */
 	i->i_size = be32_to_cpu(ri.size);
-	i->i_mtime.tv_sec = i->i_atime.tv_sec = inode_set_ctime(i, 0, 0).tv_sec;
-	i->i_mtime.tv_nsec = i->i_atime.tv_nsec = 0;
+	i->i_mtime = i->i_atime = inode_set_ctime(i, 0, 0);
 
 	/* set up mode and ops */
 	mode = romfs_modemap[nextfh & ROMFH_TYPE];
diff --git a/fs/smb/client/fscache.h b/fs/smb/client/fscache.h
index a228964bc2ce..84f3b09367d2 100644
--- a/fs/smb/client/fscache.h
+++ b/fs/smb/client/fscache.h
@@ -56,7 +56,7 @@ void cifs_fscache_fill_coherency(struct inode *inode,
 	cd->last_write_time_sec   = cpu_to_le64(cifsi->netfs.inode.i_mtime.tv_sec);
 	cd->last_write_time_nsec  = cpu_to_le32(cifsi->netfs.inode.i_mtime.tv_nsec);
 	cd->last_change_time_sec  = cpu_to_le64(ctime.tv_sec);
-	cd->last_change_time_nsec  = cpu_to_le64(ctime.tv_nsec);
+	cd->last_change_time_nsec = cpu_to_le32(ctime.tv_nsec);
 }
 
 

-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/92] fs: new accessors for inode->i_ctime
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
                   ` (4 preceding siblings ...)
  2023-07-07 12:42 ` Jeff Layton
@ 2023-07-10 12:18 ` Christian Brauner
  2023-09-04 18:11 ` [f2fs-dev] [PATCH v2 00/89] " patchwork-bot+f2fs
  6 siblings, 0 replies; 22+ messages in thread
From: Christian Brauner @ 2023-07-10 12:18 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Christian Brauner, jk, arnd, mpe, npiggin, christophe.leroy, hca,
	gor, agordeev, borntraeger, svens, gregkh, arve, tkjos, maco,
	joel, cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed, 05 Jul 2023 14:58:09 -0400, Jeff Layton wrote:
> v2:
> - prepend patches to add missing ctime updates
> - add simple_rename_timestamp helper function
> - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> - drop individual inode_ctime_set_{sec,nsec} helpers
> 
> I've been working on a patchset to change how the inode->i_ctime is
> accessed in order to give us conditional, high-res timestamps for the
> ctime and mtime. struct timespec64 has unused bits in it that we can use
> to implement this. In order to do that however, we need to wrap all
> accesses of inode->i_ctime to ensure that bits used as flags are
> appropriately handled.
> 
> [...]

Applied to the vfs.ctime branch of the vfs/vfs.git tree.
Patches in the vfs.ctime branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.ctime

[01/92] ibmvmc: update ctime in conjunction with mtime on write
        https://git.kernel.org/vfs/vfs/c/ead310563ad2
[02/92] bfs: update ctime in addition to mtime when adding entries
        https://git.kernel.org/vfs/vfs/c/f42faf14b838
[03/92] efivarfs: update ctime when mtime changes on a write
        https://git.kernel.org/vfs/vfs/c/d8d026e0d1f2
[04/92] exfat: ensure that ctime is updated whenever the mtime is
        https://git.kernel.org/vfs/vfs/c/d84bd8fa48d7
[05/92] apparmor: update ctime whenever the mtime changes on an inode
        https://git.kernel.org/vfs/vfs/c/73955caedfae
[06/92] cifs: update the ctime on a partial page write
        https://git.kernel.org/vfs/vfs/c/c2f784379c99
[07/92] fs: add ctime accessors infrastructure
        https://git.kernel.org/vfs/vfs/c/64f0367de800
[08/92] fs: new helper: simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/54ced54a0239
[09/92] btrfs: convert to simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/218e0f662fee
[10/92] ubifs: convert to simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/caac4f65568d
[11/92] shmem: convert to simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/d3d11e9927b6
[12/92] exfat: convert to simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/71534b484c63
[13/92] ntfs3: convert to simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/140880821ce0
[14/92] reiserfs: convert to simple_rename_timestamp
        https://git.kernel.org/vfs/vfs/c/1a1a4df5e8fc
[15/92] spufs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/784e5a93c9cf
[16/92] s390: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/1cece1f8e5c2
[17/92] binderfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/0bcd830a76f3
[18/92] infiniband: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/811f97f80b01
[19/92] ibm: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/b447ed7597f0
[20/92] usb: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/2557dc7f2dde
[21/92] 9p: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/4cd4b11385ef
[22/92] adfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/e257d7ade66e
[23/92] affs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/770619f19a77
[24/92] afs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/758506e44668
[25/92] fs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/a0a5a9810b37
[26/92] autofs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/d7d1363cc3f6
[27/92] befs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/d6218773de2d
[28/92] bfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/368b313ac2ab
[29/92] btrfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/d3d15221956a
[30/92] ceph: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/818fc6e0129a
[31/92] coda: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/4e0b22fbc012
[32/92] configfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/69c977798a6a
[33/92] cramfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/911f086eae23
[34/92] debugfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/634a50390dbb
[35/92] devpts: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/92bb29a24707
[36/92] ecryptfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/16d21856dfd6
[37/92] efivarfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/cfeee05a50e1
[38/92] efs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/3a30b097319f
[39/92] erofs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/e3594996216f
[40/92] exfat: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/8bd562d6f46d
[41/92] ext2: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/7483252e8894
[42/92] ext4: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/f2ddb05870fb
[43/92] 9afc475653af f2fs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/f2ddb05870fb
[44/92] fat: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/8a0c417b695b
[45/92] freevxfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/7affaeb5b914
[46/92] fuse: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/688279761436
[47/92] gfs2: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/9e5b114b5ee4
[48/92] hfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/d41f5876a177
[49/92] hfsplus: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/147f3dd171d2
[50/92] hostfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/2ceaa835b4f5
[51/92] hpfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/e6fd7f49daa7
[52/92] hugetlbfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/f5950f079b1a
[53/92] isofs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/53f2bb3567f0
[54/92] jffs2: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/7e8dc4ab1afb
[55/92] jfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/77737373dbb3
[56/92] kernfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/8b0e3c2e9900
[57/92] nfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/12844cb15dc6
[58/92] nfsd: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/f297728268bf
[59/92] nilfs2: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/1e9f083bc9cd
[60/92] ntfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/3cc66672eaa5
[61/92] ntfs3: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/9438de01396e
[62/92] ocfs2: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/da5b97da32e7
[63/92] omfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/563d772c8d70
[64/92] openpromfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/5f0978a6f0a6
[65/92] orangefs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/6a83804b4325
[66/92] overlayfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/60dcee636746
[67/92] procfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/85e0a6b3b8cf
[68/92] pstore: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/2b8125b5e7c6
[69/92] qnx4: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/77eb00659cb5
[70/92] qnx6: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/af1acd38df36
[71/92] ramfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/0eb8012f4b0b
[72/92] reiserfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/e3e5f5f70292
[73/92] romfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/b6058a9af143
[74/92] smb: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/d5c263f2187d
[75/92] squashfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/eaace9c73ba8
[76/92] sysv: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/41b6f4fbbe32
[77/92] tracefs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/5f69a5364568
[78/92] ubifs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/5bb225ba81c0
[79/92] udf: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/e251f0e98433
[80/92] ufs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/376ef9f6cab1
[81/92] vboxsf: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/9f06612951d5
[82/92] xfs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/4e8c1361146f
[83/92] zonefs: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/cbdc6aa5f65d
[84/92] linux: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/ff12abb4a71a
[85/92] mqueue: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/a6b5a0055142
[86/92] bpf: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/d2b6a0a3863a
[87/92] shmem: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/ffcd778237d3
[88/92] sunrpc: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/ccf1c9002d71
[89/92] apparmor: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/ff91aaa76f1a
[90/92] security: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/701071f9ad33
[91/92] selinux: convert to ctime accessor functions
        https://git.kernel.org/vfs/vfs/c/cb6dfffdc7e9
[92/92] fs: rename i_ctime field to __i_ctime
        https://git.kernel.org/vfs/vfs/c/c06d4bf5e207

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-07 12:42 ` Jeff Layton
@ 2023-07-10 12:35   ` Christian Brauner
  2023-07-10 13:32     ` Jeff Layton
  0 siblings, 1 reply; 22+ messages in thread
From: Christian Brauner @ 2023-07-10 12:35 UTC (permalink / raw)
  To: Jeff Layton
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, cmllamas,
	surenb, dennis.dalessandro, jgg, leon, bwarrum, rituagar, ericvh,
	lucho, asmadeus, linux_oss, dsterba, dhowells, marc.dionne, viro,
	raven, luisbg, salah.triki, aivazian.tigran, ebiederm, keescook,
	clm, josef, xiubli, idryomov, jaharkes, coda, jlbec, hch, nico,
	rafael, code, ardb, xiang, chao, huyue2, jefflexu, linkinjeon,
	sj1557.seo, jack, tytso, adilger.kernel, jaegeuk, hirofumi,
	miklos, rpeterso, agruenba, richard, anton.ivanov, johannes,
	mikulas, mike.kravetz, muchun.song, dwmw2, shaggy, tj,
	trond.myklebust, anna, chuck.lever, neilb, kolga, Dai.Ngo, tom,
	konishi.ryusuke, anton, almaz.alexandrovich, mark, joseph.qi, me,
	hubcap, martin, amir73il, mcgrof, yzaikin, tony.luck, gpiccoli,
	al, sfrench, pc, lsahlber, sprasad, senozhatsky, phillip,
	rostedt, mhiramat, dushistov, hdegoede, djwong, dlemoal,
	naohiro.aota, jth, ast, daniel, andrii, martin.lau, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, hughd, akpm, davem,
	edumazet, kuba, pabeni, john.johansen, paul, jmorris, serge,
	stephen.smalley.work, eparis, jgross, stern, lrh2000,
	sebastian.reichel, wsa+renesas, quic_ugoswami, quic_linyyuan,
	john, error27, quic_uaggarwa, hayama, jomajm, axboe, dhavale,
	dchinner, hannes, zhangpeng362, slava, gargaditya08,
	penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy, okanatov,
	jeffxu, linux, mirimmad17, yijiangshan, yang.yang29, xu.xin16,
	chengzhihao1, shr, Liam.Howlett, adobriyan, chi.minghao,
	roberto.sassu, linuszeng, bvanassche, zohar, yi.zhang, trix,
	fmdefrancesco, ebiggers, princekumarmaurya06, chenzhongjin, riel,
	shaozhengchao, jingyuwang_vip, linuxppc-dev, linux-kernel,
	linux-s390, linux-rdma, linux-usb, v9fs, linux-fsdevel,
	linux-afs, autofs, linux-mm, linux-btrfs, ceph-devel, codalist,
	ecryptfs, linux-efi, linux-erofs, linux-ext4, linux-f2fs-devel,
	cluster-devel, linux-um, linux-mtd, jfs-discussion, linux-nfs,
	linux-nilfs, linux-ntfs-dev, ntfs3, ocfs2-devel,
	linux-karma-devel, devel, linux-unionfs, linux-hardening,
	reiserfs-devel, linux-cifs, samba-technical, linux-trace-kernel,
	linux-xfs, bpf, netdev, apparmor, linux-security-module, selinux

On Fri, Jul 07, 2023 at 08:42:31AM -0400, Jeff Layton wrote:
> On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote:
> > v2:
> > - prepend patches to add missing ctime updates
> > - add simple_rename_timestamp helper function
> > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> > - drop individual inode_ctime_set_{sec,nsec} helpers
> > 
> 
> After review by Jan and others, and Jan's ext4 rework, the diff on top
> of the series I posted a couple of days ago is below. I don't really
> want to spam everyone with another ~100 patch v3 series, but I can if
> you think that's best.
> 
> Christian, what would you like me to do here?

I picked up the series from the list and folded the fixups you posted
here into the respective fs conversion patches. I hope that helps you
avoid a resend. You should have received a separate "thank you" mail for
all of this.

To each patch that I folded one of the fixlets from below into I added a
git note that records a link to your mail here and the respective patch
hunk from this mail that I folded into the patch. git.kernel.org will
show notes by default. For example,
https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.ctime&id=8b0e3c2e99004609a16ba145bcbdfdddb78e220e
should show you the note I added. You can also fetch them via
git fetch $remote refs/notes/*:refs/notes/*
(You probably know that ofc but jic.) if you're interested.

Based on v6.5-rc1 as of today.

Btw, both b4 and patchwork somehow treat the series in weird was.
IOW, based on the message id of the cover letter I was able to pull most
messages except for:

[07/92] fs: add ctime accessors infrastructure
[08/92] fs: new helper: simple_rename_timestamp
[92/92] fs: rename i_ctime field to __i_ctime

which I pulled in separately. Not sure what the cause of this is.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-10 12:35   ` Christian Brauner
@ 2023-07-10 13:32     ` Jeff Layton
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Layton @ 2023-07-10 13:32 UTC (permalink / raw)
  To: Christian Brauner
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, cmllamas,
	surenb, dennis.dalessandro, jgg, leon, bwarrum, rituagar, ericvh,
	lucho, asmadeus, linux_oss, dsterba, dhowells, marc.dionne, viro,
	raven, luisbg, salah.triki, aivazian.tigran, ebiederm, keescook,
	clm, josef, xiubli, idryomov, jaharkes, coda, jlbec, hch, nico,
	rafael, code, ardb, xiang, chao, huyue2, jefflexu, linkinjeon,
	sj1557.seo, jack, tytso, adilger.kernel, jaegeuk, hirofumi,
	miklos, rpeterso, agruenba, richard, anton.ivanov, johannes,
	mikulas, mike.kravetz, muchun.song, dwmw2, shaggy, tj,
	trond.myklebust, anna, chuck.lever, neilb, kolga, Dai.Ngo, tom,
	konishi.ryusuke, anton, almaz.alexandrovich, mark, joseph.qi, me,
	hubcap, martin, amir73il, mcgrof, yzaikin, tony.luck, gpiccoli,
	al, sfrench, pc, lsahlber, sprasad, senozhatsky, phillip,
	rostedt, mhiramat, dushistov, hdegoede, djwong, dlemoal,
	naohiro.aota, jth, ast, daniel, andrii, martin.lau, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, hughd, akpm, davem,
	edumazet, kuba, pabeni, john.johansen, paul, jmorris, serge,
	stephen.smalley.work, eparis, jgross, stern, lrh2000,
	sebastian.reichel, wsa+renesas, quic_ugoswami, quic_linyyuan,
	john, error27, quic_uaggarwa, hayama, jomajm, axboe, dhavale,
	dchinner, hannes, zhangpeng362, slava, gargaditya08,
	penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy, okanatov,
	jeffxu, linux, mirimmad17, yijiangshan, yang.yang29, xu.xin16,
	chengzhihao1, shr, Liam.Howlett, adobriyan, chi.minghao,
	roberto.sassu, linuszeng, bvanassche, zohar, yi.zhang, trix,
	fmdefrancesco, ebiggers, princekumarmaurya06, chenzhongjin, riel,
	shaozhengchao, jingyuwang_vip, linuxppc-dev, linux-kernel,
	linux-s390, linux-rdma, linux-usb, v9fs, linux-fsdevel,
	linux-afs, autofs, linux-mm, linux-btrfs, ceph-devel, codalist,
	ecryptfs, linux-efi, linux-erofs, linux-ext4, linux-f2fs-devel,
	cluster-devel, linux-um, linux-mtd, jfs-discussion, linux-nfs,
	linux-nilfs, linux-ntfs-dev, ntfs3, ocfs2-devel,
	linux-karma-devel, devel, linux-unionfs, linux-hardening,
	reiserfs-devel, linux-cifs, samba-technical, linux-trace-kernel,
	linux-xfs, bpf, netdev, apparmor, linux-security-module, selinux

On Mon, 2023-07-10 at 14:35 +0200, Christian Brauner wrote:
> On Fri, Jul 07, 2023 at 08:42:31AM -0400, Jeff Layton wrote:
> > On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote:
> > > v2:
> > > - prepend patches to add missing ctime updates
> > > - add simple_rename_timestamp helper function
> > > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> > > - drop individual inode_ctime_set_{sec,nsec} helpers
> > > 
> > 
> > After review by Jan and others, and Jan's ext4 rework, the diff on top
> > of the series I posted a couple of days ago is below. I don't really
> > want to spam everyone with another ~100 patch v3 series, but I can if
> > you think that's best.
> > 
> > Christian, what would you like me to do here?
> 
> I picked up the series from the list and folded the fixups you posted
> here into the respective fs conversion patches. I hope that helps you
> avoid a resend. You should have received a separate "thank you" mail for
> all of this.
> 
> To each patch that I folded one of the fixlets from below into I added a
> git note that records a link to your mail here and the respective patch
> hunk from this mail that I folded into the patch. git.kernel.org will
> show notes by default. For example,
> https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.ctime&id=8b0e3c2e99004609a16ba145bcbdfdddb78e220e
> should show you the note I added. You can also fetch them via
> git fetch $remote refs/notes/*:refs/notes/*
> (You probably know that ofc but jic.) if you're interested.
> 
> Based on v6.5-rc1 as of today.
> 

Many thanks!!! I'll get to work rebasing the multigrain timestamp series
on top of that.

> Btw, both b4 and patchwork somehow treat the series in weird was.
> IOW, based on the message id of the cover letter I was able to pull most
> messages except for:
> 
> [07/92] fs: add ctime accessors infrastructure
> [08/92] fs: new helper: simple_rename_timestamp
> [92/92] fs: rename i_ctime field to __i_ctime
> 
> which I pulled in separately. Not sure what the cause of 
> 
> this is.

Good to know.

I ended up doing the send in two phases: one for the cover letter and
infrastructure patches that went to everyone, and one for the per-
subsystem patches that went do individual maintainers and lists.

I suspect that screwed up the message IDs somehow. Hopefully I won't
need to do a posting like that again soon, but I'll pay closer attention
to the message id handling next time.

Thanks again!
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-07-05 18:58 ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
  2023-07-05 23:19   ` Damien Le Moal
  2023-07-06 10:27   ` Jan Kara
@ 2023-08-30  0:19   ` Al Viro
  2023-08-30  0:48     ` Jeff Layton
  2 siblings, 1 reply; 22+ messages in thread
From: Al Viro @ 2023-08-30  0:19 UTC (permalink / raw)
  To: Jeff Layton
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed, Jul 05, 2023 at 02:58:11PM -0400, Jeff Layton wrote:

> + * POSIX mandates that the old and new parent directories have their ctime and
> + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have
> + * their ctime updated.

APPLICATION USAGE
Some implementations mark for update the last file status change timestamp
of renamed files and some do not. Applications which make use of the
last file status change timestamp may behave differently with respect
to renamed files unless they are designed to allow for either behavior.

So for children POSIX permits rather than mandates.  Doesn't really matter;
Linux behaviour had been to touch ctime on children since way back, if
not since the very beginning.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp
  2023-08-30  0:19   ` Al Viro
@ 2023-08-30  0:48     ` Jeff Layton
  0 siblings, 0 replies; 22+ messages in thread
From: Jeff Layton @ 2023-08-30  0:48 UTC (permalink / raw)
  To: Al Viro
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed, 2023-08-30 at 01:19 +0100, Al Viro wrote:
> On Wed, Jul 05, 2023 at 02:58:11PM -0400, Jeff Layton wrote:
> 
> > + * POSIX mandates that the old and new parent directories have their ctime and
> > + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), have
> > + * their ctime updated.
> 
> APPLICATION USAGE
> Some implementations mark for update the last file status change timestamp
> of renamed files and some do not. Applications which make use of the
> last file status change timestamp may behave differently with respect
> to renamed files unless they are designed to allow for either behavior.
>
> So for children POSIX permits rather than mandates.  Doesn't really matter;
> Linux behaviour had been to touch ctime on children since way back, if
> not since the very beginning.

Mea culpa. You're quite correct. I'll plan to roll a small patch to
update the comment over this function.

Thanks!
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [f2fs-dev] [PATCH v2 00/89] fs: new accessors for inode->i_ctime
  2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
                   ` (5 preceding siblings ...)
  2023-07-10 12:18 ` [PATCH v2 00/92] " Christian Brauner
@ 2023-09-04 18:11 ` patchwork-bot+f2fs
  6 siblings, 0 replies; 22+ messages in thread
From: patchwork-bot+f2fs @ 2023-09-04 18:11 UTC (permalink / raw)
  To: Jeff Layton
  Cc: jk, arnd, mpe, npiggin, christophe.leroy, hca, gor, agordeev,
	borntraeger, svens, gregkh, arve, tkjos, maco, joel, brauner,
	cmllamas, surenb, dennis.dalessandro, jgg, leon, bwarrum,
	rituagar, ericvh, lucho, asmadeus, linux_oss, dsterba, dhowells,
	marc.dionne, viro, raven, luisbg, salah.triki, aivazian.tigran,
	ebiederm, keescook, clm, josef, xiubli, idryomov, jaharkes, coda,
	jlbec, hch, nico, rafael, code, ardb, xiang, chao, huyue2,
	jefflexu, linkinjeon, sj1557.seo, jack, tytso, adilger.kernel,
	jaegeuk, hirofumi, miklos, rpeterso, agruenba, richard,
	anton.ivanov, johannes, mikulas, mike.kravetz, muchun.song,
	dwmw2, shaggy, tj, trond.myklebust, anna, chuck.lever, neilb,
	kolga, Dai.Ngo, tom, konishi.ryusuke, anton, almaz.alexandrovich,
	mark, joseph.qi, me, hubcap, martin, amir73il, mcgrof, yzaikin,
	tony.luck, gpiccoli, al, sfrench, pc, lsahlber, sprasad,
	senozhatsky, phillip, rostedt, mhiramat, dushistov, hdegoede,
	djwong, dlemoal, naohiro.aota, jth, ast, daniel, andrii,
	martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, hughd, akpm, davem, edumazet, kuba, pabeni, john.johansen,
	paul, jmorris, serge, stephen.smalley.work, eparis, jgross,
	stern, lrh2000, sebastian.reichel, wsa+renesas, quic_ugoswami,
	quic_linyyuan, john, error27, quic_uaggarwa, hayama, jomajm,
	axboe, dhavale, dchinner, hannes, zhangpeng362, slava,
	gargaditya08, penguin-kernel, yifeliu, madkar, ezk, yuzhe, willy,
	okanatov, jeffxu, linux, mirimmad17, yijiangshan, yang.yang29,
	xu.xin16, chengzhihao1, shr, Liam.Howlett, adobriyan,
	chi.minghao, roberto.sassu, linuszeng, bvanassche, zohar,
	yi.zhang, trix, fmdefrancesco, ebiggers, princekumarmaurya06,
	chenzhongjin, riel, shaozhengchao, jingyuwang_vip, linuxppc-dev,
	linux-kernel, linux-s390, linux-rdma, linux-usb, v9fs,
	linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Christian Brauner <brauner@kernel.org>:

On Wed,  5 Jul 2023 14:58:09 -0400 you wrote:
> v2:
> - prepend patches to add missing ctime updates
> - add simple_rename_timestamp helper function
> - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_*
> - drop individual inode_ctime_set_{sec,nsec} helpers
> 
> I've been working on a patchset to change how the inode->i_ctime is
> accessed in order to give us conditional, high-res timestamps for the
> ctime and mtime. struct timespec64 has unused bits in it that we can use
> to implement this. In order to do that however, we need to wrap all
> accesses of inode->i_ctime to ensure that bits used as flags are
> appropriately handled.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2,07/92] fs: add ctime accessors infrastructure
    https://git.kernel.org/jaegeuk/f2fs/c/9b6304c1d537
  - [f2fs-dev,v2,08/92] fs: new helper: simple_rename_timestamp
    https://git.kernel.org/jaegeuk/f2fs/c/0c4767923ed6
  - [f2fs-dev,v2,92/92] fs: rename i_ctime field to __i_ctime
    https://git.kernel.org/jaegeuk/f2fs/c/13bc24457850

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2023-09-04 18:11 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
2023-07-05 18:58 ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Jeff Layton
2023-07-05 23:12   ` Damien Le Moal
2023-07-05 18:58 ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
2023-07-05 23:19   ` Damien Le Moal
2023-07-06  0:04     ` Jeff Layton
2023-07-06 21:02       ` [apparmor] " Seth Arnold
2023-07-07 10:50         ` Jeff Layton
2023-07-06 10:27   ` Jan Kara
2023-08-30  0:19   ` Al Viro
2023-08-30  0:48     ` Jeff Layton
2023-07-05 18:58 ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
2023-07-05 23:19   ` Damien Le Moal
2023-07-06 14:58   ` Jan Kara
2023-07-05 21:57 ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
2023-07-06 15:16   ` 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
2023-09-04 18:11 ` [f2fs-dev] [PATCH v2 00/89] " patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).