public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@canonical.com>
To: Paul Taysom <taysom@chromium.org>
Cc: Dustin Kirkland <dustin.kirkland@gazzang.com>,
	ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	olofj@chromium.org
Subject: Re: [PATCH] fs: ecryptfs: fixed msync to flush data
Date: Fri, 24 May 2013 16:31:40 -0700	[thread overview]
Message-ID: <20130524233139.GA4029@boyd> (raw)
In-Reply-To: <1369344703-22245-1-git-send-email-taysom@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

On 2013-05-23 14:31:43, Paul Taysom wrote:
> When msync is called on a memory mapped file, that
> data is not flushed to the disk.
> 
> In Linux, msync calls fsync for the file. For ecryptfs,
> fsync just calls the lower level file system's fsync.
> Changed the ecryptfs fsync code to call filemap_write_and_wait
> before calling the lower level fsync.
> 
> Addresses the problem described in http://crbug.com/239536
> 
> Signed-off-by: Paul Taysom <taysom@chromium.org>
> ---

Thanks, Paul! I've pushed this to the eCryptfs next branch:

http://git.kernel.org/cgit/linux/kernel/git/tyhicks/ecryptfs.git/log/?h=next

I also marked it for the stable kernel as affecting 3.6 and newer.

As a side note, we need to make ecryptfs_fsync() more selective about
what gets synced by using filemap_write_and_wait_range() and
vfs_fsync_range(). Since we're already calling vfs_fsync() for the
entire lower file, this patch is good enough for now.

Tyler

>  fs/ecryptfs/file.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
> index 201f0a0..16f509d 100644
> --- a/fs/ecryptfs/file.c
> +++ b/fs/ecryptfs/file.c
> @@ -295,6 +295,7 @@ static int ecryptfs_release(struct inode *inode, struct file *file)
>  static int
>  ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
>  {
> +	filemap_write_and_wait(file->f_mapping);
>  	return vfs_fsync(ecryptfs_file_to_lower(file), datasync);
>  }
>  
> -- 
> 1.8.2.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-05-24 23:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 21:31 [PATCH] fs: ecryptfs: fixed msync to flush data Paul Taysom
2013-05-24 23:31 ` Tyler Hicks [this message]
2013-06-05  6:53   ` [PATCH] eCryptfs: Check return of filemap_write_and_wait during fsync Tyler Hicks

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=20130524233139.GA4029@boyd \
    --to=tyhicks@canonical.com \
    --cc=dustin.kirkland@gazzang.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olofj@chromium.org \
    --cc=taysom@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox