linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Brian Foster <bfoster@redhat.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: teach deferred op freezer to freeze and thaw inodes
Date: Wed, 29 Apr 2020 07:28:07 -0700	[thread overview]
Message-ID: <20200429142807.GU6742@magnolia> (raw)
In-Reply-To: <20200429114819.GA24120@infradead.org>

On Wed, Apr 29, 2020 at 04:48:19AM -0700, Christoph Hellwig wrote:
> On Wed, Apr 29, 2020 at 07:38:03AM -0400, Brian Foster wrote:
> > That aside, based on your description above it seems we currently rely
> > on this icache retention behavior for recovery anyways, otherwise we'd
> > hit this use after free and probably have user reports. That suggests to
> > me that holding a reference is a logical next step, at least as a bug
> > fix patch to provide a more practical solution for stable/distro
> > kernels. For example, if we just associated an iget()/iput() with the
> > assignment of the xfs_bmap_intent->bi_owner field (and the eventual free
> > of the intent structure), would that technically solve the inode use
> > after free problem?
> 
> Yes, that's what I thought.
> 
> > 
> > BTW, I also wonder about the viability of changing ->bi_owner to an
> > xfs_ino_t instead of a direct pointer, but that might be more
> > involved than just adding a reference to the existing scheme...
> 
> It is actually pretty easy, but I'm not sure if hitting the icache for
> every finished bmap item is all that desirable.

It came with a noticeable (~2%) slowdown on a swapext-heavy fsstress
run, which was my motivation for this (somewhat clunky) system for
avoiding all that overhead except for recovery.

Hmm.  Actually now that I think harder about it, the bmap item is
completely incore and fields are selectively copied to the log item.
This means that regular IO could set bi_owner = <some inode number> and
bi_ip = <the incore inode>.  Recovery IO can set bi_owner but leave
bi_ip NULL, and then the bmap item replay can iget as needed.  Now we
don't need this freeze/thaw thing at all.

--D

  reply	other threads:[~2020-04-29 14:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  2:08 [PATCH 0/3] xfs: fix inode use-after-free during log recovery Darrick J. Wong
2020-04-22  2:08 ` [PATCH 1/3] xfs: proper replay of deferred ops queued " Darrick J. Wong
2020-04-24 14:02   ` Brian Foster
2020-04-28 22:28     ` Darrick J. Wong
2020-04-22  2:08 ` [PATCH 2/3] xfs: reduce log recovery transaction block reservations Darrick J. Wong
2020-04-24 14:04   ` Brian Foster
2020-04-28 22:22     ` Darrick J. Wong
2020-05-27 22:39       ` Darrick J. Wong
2020-04-22  2:08 ` [PATCH 3/3] xfs: teach deferred op freezer to freeze and thaw inodes Darrick J. Wong
2020-04-25 19:01   ` Christoph Hellwig
2020-04-27 11:37     ` Brian Foster
2020-04-28 22:17       ` Darrick J. Wong
2020-04-29 11:38         ` Brian Foster
2020-04-29 11:48           ` Christoph Hellwig
2020-04-29 14:28             ` Darrick J. Wong [this message]
2020-04-29 14:55               ` Christoph Hellwig
2020-04-29 23:58                 ` Darrick J. Wong
2020-05-01 17:09                   ` Christoph Hellwig

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=20200429142807.GU6742@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=hch@infradead.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).