On Fri, Aug 23, 2024 at 08:29:18PM -0700, Christoph Hellwig wrote: > On Fri, Aug 23, 2024 at 10:41:40AM -0700, Darrick J. Wong wrote: > > <nod> If these both get merged for 6.12, I think the appropriate port > > for this patch is to change xfs_ioc_start_commit to do: > > > > struct kstat kstat; > > > > fill_mg_cmtime(&kstat, STATX_CTIME | STATX_MTIME, XFS_I(ip2)); > > kern_f->file2_ctime = kstat.ctime.tv_sec; > > kern_f->file2_ctime_nsec = kstat.ctime.tv_nsec; > > kern_f->file2_mtime = kstat.mtime.tv_sec; > > kern_f->file2_mtime_nsec = kstat.mtime.tv_nsec; > > > > instead of open-coding the inode_get_[cm]time calls. The entire > > exchangerange feature is still marked experimental, so I didn't think it > > was worth rebasing my entire dev branch on the multigrain timestamp > > redux series; we can just fix it later. > > But the commit log could really note this dependency. This will be > especially useful for backports, but also for anyone reading through > code history. Ok, how about this for a commit message: "This patch introduces two more new ioctls to manage atomic updates to file contents -- XFS_IOC_START_COMMIT and XFS_IOC_COMMIT_RANGE. The commit mechanism here is exactly the same as what XFS_IOC_EXCHANGE_RANGE does, but with the additional requirement that file2 cannot have changed since some sampling point. The start-commit ioctl performs the sampling of file attributes. "Note: This patch currently samples i_ctime during START_COMMIT and checks that it hasn't changed during COMMIT_RANGE. This isn't entirely safe in kernels prior to 6.12 because ctime only had coarse grained granularity and very fast updates could collide with a COMMIT_RANGE. With the multi-granularity ctime introduced in that release by Jeff Layton, it's now possible to update ctime such that this does not happen. "It is critical, then, that this patch must not be backported to any kernel that does not support fine-grained file change timestamps." Will that pass muster? --D