public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: aborting inodes on shutdown may need buffer lock
Date: Tue, 22 Mar 2022 09:43:42 +1100	[thread overview]
Message-ID: <20220321224342.GL1544202@dread.disaster.area> (raw)
In-Reply-To: <20220321215620.GL8224@magnolia>

On Mon, Mar 21, 2022 at 02:56:20PM -0700, Darrick J. Wong wrote:
> On Mon, Mar 21, 2022 at 12:23:28PM +1100, Dave Chinner wrote:
> > +
> > +	/*
> > +	 * Capture the associated buffer and lock it if the caller didn't
> > +	 * pass us the locked buffer to begin with.
> > +	 */
> > +	spin_lock(&iip->ili_lock);
> > +	bp = iip->ili_item.li_buf;
> > +	xfs_iflush_abort_clean(iip);
> > +	spin_unlock(&iip->ili_lock);
> 
> Is the comment here incorrect?  The _shutdown_abort variant will go
> ahead and lock the buffer, but this function does not do that...?

Ah, stale comment from before I refactored it into separate
functions. I'll clean it up....

> > -	xfs_iflags_clear(ip, XFS_IFLUSHING);
> > -	if (bp)
> > -		xfs_buf_rele(bp);
> > +
> > +	/*
> > +	 * Got two references to bp. The first will get droped by 
> 
> "The first will get dropped by..." (spelling and stgit nagging me about
> trailing whitespace)
> 
> > +	 * xfs_iflush_abort() when the item is removed from the buffer list, but
> > +	 * we can't drop our reference until _abort() returns because we have to
> > +	 * unlock the buffer as well. Hence we abort and then unlock and release
> > +	 * our reference to the buffer.
> 
> ...and presumably xfs_iflush_abort will drop the other bp reference at
> some point after where we unlocked the inode item, locked the (held)
> buffer, and relocked the inode item?

Yes, xfs_iflush_abort() will drop the other buffer reference when it
removes the inode from the buffer item list.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-03-21 22:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21  1:23 [PATCH 0/2] xfs: more shutdown/recovery fixes Dave Chinner
2022-03-21  1:23 ` [PATCH 1/2] xfs: aborting inodes on shutdown may need buffer lock Dave Chinner
2022-03-21 21:56   ` Darrick J. Wong
2022-03-21 22:43     ` Dave Chinner [this message]
2022-03-21  1:23 ` [PATCH 2/2] xfs: shutdown in intent recovery has non-intent items in the AIL Dave Chinner
2022-03-21 21:52   ` Darrick J. Wong
2022-03-21 22:41     ` Dave Chinner
2022-03-22  2:35 ` [PATCH 0/2] xfs: more shutdown/recovery fixes Darrick J. Wong
2022-03-22  3:26   ` Dave Chinner
2022-03-22 16:23     ` 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=20220321224342.GL1544202@dread.disaster.area \
    --to=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