All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix eofblocks race with file extending async dio writes
Date: Fri, 13 Jan 2017 09:25:25 -0500	[thread overview]
Message-ID: <20170113142524.GD22013@bfoster.bfoster> (raw)
In-Reply-To: <20170113073315.GA30685@infradead.org>

On Thu, Jan 12, 2017 at 11:33:15PM -0800, Christoph Hellwig wrote:
> On Thu, Jan 12, 2017 at 09:05:59AM -0500, Brian Foster wrote:
> > !need_iolock means the iolock is already held. I guess the name is kind
> > of confusing. !need_iolock doesn't mean that the lock is unnecessary, it
> > just means that we're calling from a context where it's already held.
> > See the xfs_icache_free_eofblocks() call from
> > xfs_file_buffered_aio_write() for reference.
> > 
> > I suppose I could add an ASSERT(xfs_isilocked()) after that block to
> > better document that..
> 
> Yeah.  In fact I'd prefer to kill that parameter at all, it's horrible.
> Instead we should always expect the lock and assert that it's held,
> and have the two current need_iolock = false callers take it manually.
> 

I may have lied about iolock holders.. I don't think we have the iolock
in the xfs_inactive() case. That said, I don't think there's any harm in
doing so there. It may have just been that way since we're breaking down
the inode in that context.

I agree that this is ugly. I'll try to kill off that param as suggested.

> This will increase lock hold times a bit for the current need_iolock
> callers, but the most important one, xfs_release already does a
> previous unlocked xfs_can_free_eofblocks check, and
> xfs_inode_free_eofblocks is only called it the inode is tagged, so this
> should not be an issue (and if it is a xfs_can_free_eofblocks call
> comes to rescue).
> 

The need_iolock case is also currently a trylock, so I think we can
retain that logic in the release case without being disruptive.

> Btw, there is a comment incorrectly referring to xfs_free_eofblocks
> in xfs_inode_free_cowblocks while we're at it.

I would send that as a standalone patch because it's an entirely
separate feature (and causes unnecessary backport churn, even though
it's just a comment), so I'm not sure it's really worth fixing with this
series.

Brian

> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2017-01-13 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 17:42 [PATCH] xfs: fix eofblocks race with file extending async dio writes Brian Foster
2017-01-12 13:56 ` Christoph Hellwig
2017-01-12 14:05   ` Brian Foster
2017-01-13  7:33     ` Christoph Hellwig
2017-01-13 14:25       ` Brian Foster [this message]

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=20170113142524.GD22013@bfoster.bfoster \
    --to=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 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.