Re: ext2 + -osync: not as easy as it seems

From: Theodore Tso
Date: Wed Jan 14 2009 - 12:02:31 EST


On Wed, Jan 14, 2009 at 03:37:56PM +0100, Jan Kara wrote:
> > Um, we have that already; the sync_inode() followed by
> > blkdev_issue_flush() is the path taken by fdatasync(), I do believe.
>
> Maybe ext4-patch-queue changes that area but in Linus's tree I see:
>
> if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
> goto out;
>
> So if we just overwrite some data, we send them to disk via fdatawrite()
> and then we quickly bail out from ext4_sync_file() without doing
> blkdev_issue_flush().

So you're thinking about fdatawrite() being called by some code path
other than ext4_sync_file() before we call fsync()? Yeah, that could
happen.... I think that will only happen if the file is opened
O_SYNC, but that raises another issue, which is that we're not forcing
a flush for writes when the file is opened O_SYNC.

- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/