public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Chris Torek <chris.torek@windriver.com>
Cc: xfs@oss.sgi.com
Subject: Re: question about xfs_fsync on linux
Date: Tue, 15 Jul 2008 09:03:00 +1000	[thread overview]
Message-ID: <20080714230300.GY29319@disturbed> (raw)
In-Reply-To: <200807142213.m6EMDeE23640@elf.torek.net>

On Mon, Jul 14, 2008 at 04:13:40PM -0600, Chris Torek wrote:
> The implementation of xfs_fsync() in 2.6.2x, for reasonably late x,
> reads as follows in xfs_vnodeops.c:

What kernel(s), exactly, is/are showing this problem?

> 	error = filemap_fdatawait(vn_to_inode(XFS_ITOV(ip))->i_mapping);
> 
> We have a customer who is seeing data not "make it" to disk on a
> stress test that involves doing an fsync() or fdatasync() and then
> deliberately rebooting the machine (to simulate a failure; note
> that the underlying RAID has its own battery backup and this is
> just one of many different parts of the stress-test).

What is the symptom? The file size does not change? The file the
right size but has no data in it?

> Looking into this, I am now wondering if this call should read:
> 
> 	error = filemap_write_and_wait(vn_to_inode(XFS_ITOV(ip))->i_mapping);
> 
> instead.

No, the filemap_fdatawrite() has already been executed by this
point. We only need to wait for I/O completion here. See do_fsync():

 78 long do_fsync(struct file *file, int datasync)
 79 {
.....
 90         ret = filemap_fdatawrite(mapping);
.....
 97         err = file->f_op->fsync(file, file->f_path.dentry, datasync);
.....

The ->fsync() method in XFS is xfs_fsync()....

However, I do ask exactly what kernel version you are running,
because this mod that has gone into 2.6.26:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=978b7237123d007b9fa983af6e0e2fa8f97f9934

might be the fix you need for .24 or .25 kernels, (not sure about .22 or .23
where all this changed, nor .21 or earlier which I don't think even had the
wait...)

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2008-07-14 23:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 22:13 question about xfs_fsync on linux Chris Torek
2008-07-14 23:03 ` Dave Chinner [this message]
2008-07-15  1:29   ` Chris Torek
2008-07-15  2:48     ` Dave Chinner
2008-07-16 21:58       ` Chris Torek
2008-07-17  0:22         ` 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=20080714230300.GY29319@disturbed \
    --to=david@fromorbit.com \
    --cc=chris.torek@windriver.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