All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>,
	David Sterba <dsterba@suse.cz>,
	linux-btrfs@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH 00/21] Lock extents before pages
Date: Mon, 13 Mar 2023 02:16:42 -0700	[thread overview]
Message-ID: <ZA7p+uuc7G7gG6QE@infradead.org> (raw)
In-Reply-To: <20230310163828.guqukqexmx2pqmy7@kora>

On Fri, Mar 10, 2023 at 10:38:28AM -0600, Goldwyn Rodrigues wrote:
> > I am really worried about the i_count hack.  It is fundamentlly wrong
> > and breaks inode lifetime rules.  Furthermore there is no attempt
> > at understanding why it happens (or even if it is new with this series).
> 
> So this (another version) patch which first added working with i_count is:
> 8180ef8894fa ("Btrfs: keep inode pinned when compressing writes")
> 
> For async, inode is still referenced until all the pages
> are written back and cleared in end_compressed_writeback().
> evict() waits for all writeback to be completed. Josef, is this
> correct?
> 
> I removed the ihold() and delayed iput sequence and shifted
> unlock_extent() immediately after submit_compressed_extents(). It is
> working fine with no crashes for compress tests. But since this is a
> race condition I need to be sure if it is the correct thing to do. I
> have updated the git [1] but it needs more testing.

I think the import thing to remember here is:

 1) an inode is not getting fred as long as it has pages under writeback
 2) as long as you don't reference the inode after clearing the last
    PageWriteback bit, using the inode without an extra reference
    in the writeback code is fine

So I think we can just remove the extra referene after making sure that
the inode is not referenced after dropping the last writeback bit.
And handling of the writeback bit is quite funny in btrfs in a few
places.  Maybe I'll be able to find some time to dig into it while
you're away.


  reply	other threads:[~2023-03-13  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 22:24 [PATCH 00/21] Lock extents before pages Goldwyn Rodrigues
2023-03-09 18:10 ` David Sterba
2023-03-10  7:50   ` Christoph Hellwig
2023-03-10 16:38     ` Goldwyn Rodrigues
2023-03-13  9:16       ` Christoph Hellwig [this message]
2023-03-15 19:16     ` David Sterba

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=ZA7p+uuc7G7gG6QE@infradead.org \
    --to=hch@infradead.org \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rgoldwyn@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.