public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 7/7] xfs: xfs_fs_write_inode() can fail to write inodes synchronously
Date: Mon, 25 Jan 2010 11:03:54 -0500	[thread overview]
Message-ID: <20100125160354.GA30227@infradead.org> (raw)
In-Reply-To: <1264400564-19704-8-git-send-email-david@fromorbit.com>

On Mon, Jan 25, 2010 at 05:22:44PM +1100, Dave Chinner wrote:
> When an inode has already be flushed delayed write,
> xfs_inode_clean() returns true and hence xfs_fs_write_inode() can
> return on a synchronous inode write without having written the
> inode. Currently these sycnhronous writes only come from the unmount
> path or the nfsd on a synchronous export so should be fairly rare.

They also come from sync_filesystem, which is uses by the sync system
call, in the unmount code and from cachefiles.

> Realistically, a synchronous inode write is not necessary here; we
> can treat this like fsync where we either force the log if there are
> no unlogged changes, or do a sync transaction if there are unlogged
> changes. The will result real synchronous semantics as the fsync
> will issue barriers, but may slow down the above two configurations
> as a result. However, if the inode is not pinned and has no unlogged
> changes, then the fsync code is a no-op and hence it may be faster
> than the existing code.

If we get a lot of cases where we need to write out the inode
synchronously the barrier might hit us really hard, though.  If
we have a lot of delalloc I/O outstanding I fear this might actually
happen in practice as the inode gets modified between the first
->write_inode with wait == 0 by I/O completion.

> +	error = EAGAIN;
> +	if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
> +		goto out;
> +	if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip))
> +		goto out_unlock;

So if we make this non-blocking even for the wait case, don't we
still have a race window there bulkstat could miss the updates, even
after a sync?

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2010-01-25 16:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25  6:22 [PATCH 0/7] Delayed write metadata writeback V3 Dave Chinner
2010-01-25  6:22 ` [PATCH 1/7] xfs: Make inode reclaim states explicit Dave Chinner
2010-01-25 11:47   ` Christoph Hellwig
2010-01-25  6:22 ` [PATCH 2/7] xfs: Use delayed write for inodes rather than async Dave Chinner
2010-01-25 11:53   ` Christoph Hellwig
2010-01-25 22:31     ` Dave Chinner
2010-01-26  7:28       ` Dave Chinner
2010-01-26 16:10       ` Christoph Hellwig
2010-02-01 22:59         ` Dave Chinner
2010-01-25 15:29   ` Christoph Hellwig
2010-01-25  6:22 ` [PATCH 3/7] xfs: Don't issue buffer IO direct from AIL push Dave Chinner
2010-01-25 11:59   ` Christoph Hellwig
2010-01-25  6:22 ` [PATCH 4/7] xfs: Sort delayed write buffers before dispatch Dave Chinner
2010-01-25 12:00   ` Christoph Hellwig
2010-01-26  4:13     ` Dave Chinner
2010-01-25  6:22 ` [PATCH 5/7] xfs: Use delay write promotion for dquot flushing Dave Chinner
2010-01-25 12:03   ` Christoph Hellwig
2010-01-25  6:22 ` [PATCH 6/7] xfs: kill the unused XFS_QMOPT_* flush flags Dave Chinner
2010-01-25 12:04   ` Christoph Hellwig
2010-01-25  6:22 ` [PATCH 7/7] xfs: xfs_fs_write_inode() can fail to write inodes synchronously Dave Chinner
2010-01-25 16:03   ` Christoph Hellwig [this message]
2010-01-26  4:51     ` Dave Chinner

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=20100125160354.GA30227@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /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