linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 8/9] xfs: use iomap_valid method to detect stale cached iomaps
Date: Tue, 15 Nov 2022 15:26:27 -0800	[thread overview]
Message-ID: <Y3QgI9CM1oEKMEE/@magnolia> (raw)
In-Reply-To: <Y3NSrSxq/nC4u8ws@infradead.org>

On Tue, Nov 15, 2022 at 12:49:49AM -0800, Christoph Hellwig wrote:
> On Tue, Nov 15, 2022 at 12:30:42PM +1100, Dave Chinner wrote:
> > +/*
> > + * Check that the iomap passed to us is still valid for the given offset and
> > + * length.
> > + */
> > +static bool
> > +xfs_iomap_valid(
> > +	struct inode		*inode,
> > +	const struct iomap	*iomap)
> > +{
> > +	struct xfs_inode	*ip = XFS_I(inode);
> > +	u64			cookie = 0;
> > +
> > +	if (iomap->flags & IOMAP_F_XATTR) {
> > +		cookie = READ_ONCE(ip->i_af.if_seq);
> > +	} else {
> > +		if ((iomap->flags & IOMAP_F_SHARED) && ip->i_cowfp)
> > +			cookie = (u64)READ_ONCE(ip->i_cowfp->if_seq) << 32;
> > +		cookie |= READ_ONCE(ip->i_df.if_seq);
> > +	}
> > +	return cookie == iomap->validity_cookie;
> 
> How can this be called with IOMAP_F_XATTR set?

xfs_xattr_iomap_begin for FIEMAP, if I'm not mistaken.

> Also the code seems to duplicate xfs_iomap_inode_sequence, so
> we just call that:
> 
> 	return cookie == xfs_iomap_inode_sequence(XFS_I(inode), iomap->flags);

I was thinking that too.

--D

  reply	other threads:[~2022-11-15 23:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  1:30 [PATCH v2 0/9] xfs, iomap: fix data corrupton due to stale cached iomaps Dave Chinner
2022-11-15  1:30 ` [PATCH 1/9] mm: export mapping_seek_hole_data() Dave Chinner
2022-11-15  8:40   ` Christoph Hellwig
2022-11-15  1:30 ` [PATCH 2/9] xfs: write page faults in iomap are not buffered writes Dave Chinner
2022-11-15  1:30 ` [PATCH 3/9] xfs: punching delalloc extents on write failure is racy Dave Chinner
2022-11-15  8:41   ` Christoph Hellwig
2022-11-15 23:53   ` Darrick J. Wong
2022-11-15  1:30 ` [PATCH 4/9] xfs: use byte ranges for write cleanup ranges Dave Chinner
2022-11-15  8:42   ` Christoph Hellwig
2022-11-15 23:57   ` Darrick J. Wong
2022-11-15  1:30 ` [PATCH 5/9] xfs: buffered write failure should not truncate the page cache Dave Chinner
2022-11-15  8:43   ` Christoph Hellwig
2022-11-16  0:48   ` Darrick J. Wong
2022-11-17  1:06     ` Dave Chinner
2022-11-16 13:57   ` Brian Foster
2022-11-17  0:41     ` Dave Chinner
2022-11-17 18:28       ` Darrick J. Wong
2022-11-18 17:20       ` Brian Foster
2022-11-21 23:13         ` Dave Chinner
2022-11-23 17:25           ` Brian Foster
2022-11-15  1:30 ` [PATCH 6/9] xfs: xfs_bmap_punch_delalloc_range() should take a byte range Dave Chinner
2022-11-15  8:44   ` Christoph Hellwig
2022-11-15 23:48     ` Darrick J. Wong
2022-11-16  0:57       ` Dave Chinner
2022-11-16  5:46         ` Christoph Hellwig
2022-11-15  1:30 ` [PATCH 7/9] iomap: write iomap validity checks Dave Chinner
2022-11-15  8:45   ` Christoph Hellwig
2022-11-15  1:30 ` [PATCH 8/9] xfs: use iomap_valid method to detect stale cached iomaps Dave Chinner
2022-11-15  8:49   ` Christoph Hellwig
2022-11-15 23:26     ` Darrick J. Wong [this message]
2022-11-16  0:10     ` Dave Chinner
2022-11-15  1:30 ` [PATCH 9/9] xfs: drop write error injection is unfixable, remove it Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2022-11-17  5:58 [PATCH 0/8 v3] xfs, iomap: fix data corrupton due to stale cached iomaps Dave Chinner
2022-11-17  5:58 ` [PATCH 8/9] xfs: use iomap_valid method to detect " Dave Chinner
2022-11-17 18:59   ` Darrick J. Wong
2022-11-17 21:36     ` Dave Chinner
2022-11-23  5:58 [PATCH 0/9 V4] xfs, iomap: fix data corrupton due to " Dave Chinner
2022-11-23  5:58 ` [PATCH 8/9] xfs: use iomap_valid method to detect " Dave Chinner

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=Y3QgI9CM1oEKMEE/@magnolia \
    --to=djwong@kernel.org \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@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;
as well as URLs for NNTP newsgroup(s).