public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: "Darrick J. Wong" <djwong@kernel.org>, cem@kernel.org
Cc: stable@vger.kernel.org, linux-xfs@vger.kernel.org, hch@lst.de
Subject: Re: [PATCH 6/6] xfs: port xfs_ioc_start_commit to multigrain timestamps
Date: Tue, 03 Dec 2024 20:01:16 -0800	[thread overview]
Message-ID: <d6717fb9af7a27cb86358b51047482211c007015.camel@kernel.org> (raw)
In-Reply-To: <173328106685.1145623.13634222093317841310.stgit@frogsfrogsfrogs>

On Tue, 2024-12-03 at 19:03 -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Take advantage of the multigrain timestamp APIs to ensure that nobody
> can sneak in and write things to a file between starting a file update
> operation and committing the results.  This should have been part of the
> multigrain timestamp merge, but I forgot to fling it at jlayton when he
> resubmitted the patchset due to developer bandwidth problems.
> 
> Cc: jlayton@kernel.org
> Cc: <stable@vger.kernel.org> # v6.13-rc1
> Fixes: 4e40eff0b5737c ("fs: add infrastructure for multigrain timestamps")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/xfs_exchrange.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_exchrange.c b/fs/xfs/xfs_exchrange.c
> index 9ab05ad224d127..dd24de420714ab 100644
> --- a/fs/xfs/xfs_exchrange.c
> +++ b/fs/xfs/xfs_exchrange.c
> @@ -854,7 +854,7 @@ xfs_ioc_start_commit(
>  	struct xfs_commit_range __user	*argp)
>  {
>  	struct xfs_commit_range		args = { };
> -	struct timespec64		ts;
> +	struct kstat			kstat;
>  	struct xfs_commit_range_fresh	*kern_f;
>  	struct xfs_commit_range_fresh	__user *user_f;
>  	struct inode			*inode2 = file_inode(file);
> @@ -871,12 +871,12 @@ xfs_ioc_start_commit(
>  	memcpy(&kern_f->fsid, ip2->i_mount->m_fixedfsid, sizeof(xfs_fsid_t));
>  
>  	xfs_ilock(ip2, lockflags);
> -	ts = inode_get_ctime(inode2);
> -	kern_f->file2_ctime		= ts.tv_sec;
> -	kern_f->file2_ctime_nsec	= ts.tv_nsec;
> -	ts = inode_get_mtime(inode2);
> -	kern_f->file2_mtime		= ts.tv_sec;
> -	kern_f->file2_mtime_nsec	= ts.tv_nsec;
> +	/* Force writing of a distinct ctime if any writes happen. */
> +	fill_mg_cmtime(&kstat, STATX_CTIME | STATX_MTIME, inode2);
> +	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;
>  	kern_f->file2_ino		= ip2->i_ino;
>  	kern_f->file2_gen		= inode2->i_generation;
>  	kern_f->magic			= XCR_FRESH_MAGIC;
> 

Looks good!

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2024-12-04  4:01 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04  3:02 [PATCHSET v2] xfs: proposed bug fixes for 6.13 Darrick J. Wong
2024-12-04  3:02 ` [PATCH 1/6] xfs: don't move nondir/nonreg temporary repair files to the metadir namespace Darrick J. Wong
2024-12-04  8:24   ` Christoph Hellwig
2024-12-05  6:14     ` Darrick J. Wong
2024-12-05  6:46       ` Christoph Hellwig
2024-12-05  7:16         ` Darrick J. Wong
2024-12-04  3:02 ` [PATCH 2/6] xfs: don't crash on corrupt /quotas dirent Darrick J. Wong
2024-12-04  8:24   ` Christoph Hellwig
2024-12-04  3:03 ` [PATCH 3/6] xfs: check pre-metadir fields correctly Darrick J. Wong
2024-12-04  8:25   ` Christoph Hellwig
2024-12-04  3:03 ` [PATCH 4/6] xfs: fix zero byte checking in the superblock scrubber Darrick J. Wong
2024-12-04  8:27   ` Christoph Hellwig
2024-12-05  5:54     ` Darrick J. Wong
2024-12-05  6:48       ` Christoph Hellwig
2024-12-05  7:17         ` Darrick J. Wong
2024-12-04  3:03 ` [PATCH 5/6] xfs: return from xfs_symlink_verify early on V4 filesystems Darrick J. Wong
2024-12-04  8:27   ` Christoph Hellwig
2024-12-04  3:03 ` [PATCH 6/6] xfs: port xfs_ioc_start_commit to multigrain timestamps Darrick J. Wong
2024-12-04  4:01   ` Jeff Layton [this message]
2024-12-04  8:28   ` Christoph Hellwig
2024-12-05  1:26 ` [PATCHSET v2] xfs: proposed bug fixes for 6.13 Bill O'Donnell
2024-12-05  6:42   ` Darrick J. Wong
2024-12-05  6:52     ` Bill O'Donnell
2024-12-05  6:58       ` Christoph Hellwig
2024-12-05  7:04         ` Bill O'Donnell
2024-12-05  7:30           ` Bill O'Donnell
2024-12-05  7:39             ` Darrick J. Wong
2024-12-05  7:33           ` Darrick J. Wong
2024-12-05  7:40             ` Bill O'Donnell
2024-12-05  7:46             ` Bill O'Donnell
2024-12-05  8:02               ` Bill O'Donnell
2024-12-05  8:39                 ` Greg KH
2024-12-05  8:47                   ` Bill O'Donnell
2024-12-05  7:57         ` Darrick J. Wong
2024-12-05 16:11     ` Bill O'Donnell
  -- strict thread matches above, loose matches on Subject: below --
2024-12-07  0:30 [PATCHSET v3] " Darrick J. Wong
2024-12-07  0:32 ` [PATCH 6/6] xfs: port xfs_ioc_start_commit to multigrain timestamps Darrick J. Wong
2024-12-11 20:07 [PATCHSET v4] xfs: bug fixes for 6.13 Darrick J. Wong
2024-12-11 20:09 ` [PATCH 6/6] xfs: port xfs_ioc_start_commit to multigrain timestamps Darrick J. Wong

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=d6717fb9af7a27cb86358b51047482211c007015.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

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

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