All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext3: enable cache flush in ext3_sync_file
Date: Tue, 01 Sep 2009 13:24:05 -0500	[thread overview]
Message-ID: <4A9D66C5.4060806@redhat.com> (raw)
In-Reply-To: <20090831193712.GB2672@lst.de>

Christoph Hellwig wrote:
> We need to flush the write cache unconditionally in ->fsync, otherwise
> writes into already allocated blocks can get lost.  Writes into fully
> allocated files are very common when using disk images for
> virtualization, and without this fix can easily lose data after
> an fdatasync, which is the typical implementation for a cache flush on
> the virtual drive.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Given that I tried to do the same thing 1.5 years ago (though not quite
correctly) ...

Acked-by: Eric Sandeen <sandeen@redhat.com>

> 
> Index: linux-2.6/fs/ext3/fsync.c
> ===================================================================
> --- linux-2.6.orig/fs/ext3/fsync.c
> +++ linux-2.6/fs/ext3/fsync.c
> @@ -23,6 +23,7 @@
>   */
>  
>  #include <linux/time.h>
> +#include <linux/blkdev.h>
>  #include <linux/fs.h>
>  #include <linux/sched.h>
>  #include <linux/writeback.h>
> @@ -87,5 +88,7 @@ int ext3_sync_file(struct file * file, s
>  		ret = sync_inode(inode, &wbc);
>  	}
>  out:
> +	if (test_opt(inode->i_sb, BARRIER))
> +		blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
>  	return ret;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2009-09-01 18:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31 19:37 [PATCH] ext3: enable cache flush in ext3_sync_file Christoph Hellwig
2009-09-01 18:24 ` Eric Sandeen [this message]
2009-09-08 13:04   ` Jan Kara
2009-09-08 13:10     ` Christoph Hellwig

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=4A9D66C5.4060806@redhat.com \
    --to=sandeen@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-ext4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.