xfs
[Top] [All Lists]

Re: question about xfs_fsync on linux

To: Chris Torek <chris.torek@xxxxxxxxxxxxx>
Subject: Re: question about xfs_fsync on linux
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 15 Jul 2008 09:03:00 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <200807142213.m6EMDeE23640@xxxxxxxxxxxxx>
Mail-followup-to: Chris Torek <chris.torek@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
References: <200807142213.m6EMDeE23640@xxxxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.17+20080114 (2008-01-14)
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@xxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>