public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH] xfs: recheck appropriateness of map_shared lock
Date: Thu, 19 Jan 2023 10:31:06 -0800	[thread overview]
Message-ID: <Y8mMailEevUSZkG+@infradead.org> (raw)
In-Reply-To: <Y8ib6ls32e/pJezE@magnolia>

On Wed, Jan 18, 2023 at 05:24:58PM -0800, Darrick J. Wong wrote:
>  	xfs_ilock(ip, lock_mode);
> +
> +	/*
> +	 * It's possible that the unlocked access of the data fork to determine
> +	 * the lock mode could have raced with another thread that was failing
> +	 * to load the bmbt but hadn't yet torn down the iext tree.  Recheck
> +	 * the lock mode and upgrade to an exclusive lock if we need to.
> +	 */
> +	if (lock_mode == XFS_ILOCK_SHARED &&
> +	    xfs_need_iread_extents(&ip->i_df)) {

Eww.  I think the proper fix here is to make sure
xfs_need_iread_extents does not return false until we're actually
read the extents.  So I think we'll need a new inode flag
XFS_INEED_READ - gets set when reading inode in btree format,
and gets cleared at the very end of xfs_iread_extents once we know
the read succeeded.

  parent reply	other threads:[~2023-01-19 18:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  1:24 [PATCH] xfs: recheck appropriateness of map_shared lock Darrick J. Wong
2023-01-19  5:14 ` Dave Chinner
2023-01-19 18:39   ` Christoph Hellwig
2023-01-19 20:34     ` Dave Chinner
2023-02-28 20:08   ` Darrick J. Wong
2023-01-19 18:31 ` Christoph Hellwig [this message]
2023-04-11  1:05   ` 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=Y8mMailEevUSZkG+@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.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