linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Brian Foster <bfoster@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix eofblocks race with file extending async dio writes
Date: Thu, 12 Jan 2017 23:33:15 -0800	[thread overview]
Message-ID: <20170113073315.GA30685@infradead.org> (raw)
In-Reply-To: <20170112140559.GD14085@bfoster.bfoster>

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.

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).

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

  reply	other threads:[~2017-01-13  7:33 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 [this message]
2017-01-13 14:25       ` Brian Foster

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=20170113073315.GA30685@infradead.org \
    --to=hch@infradead.org \
    --cc=bfoster@redhat.com \
    --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).