public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, Omar Sandoval <osandov@osandov.com>,
	linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>,
	Christoph Hellwig <hch@infradead.org>,
	Aleksei Besogonov <cyberax@amazon.com>
Subject: Re: [PATCH] iomap: fsync swap files before iterating mappings
Date: Tue, 5 Jun 2018 09:25:24 -0700	[thread overview]
Message-ID: <20180605162524.GA16104@infradead.org> (raw)
In-Reply-To: <20180605161605.GG9437@magnolia>

On Tue, Jun 05, 2018 at 09:16:05AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Swap files require that all the file mapping metadata be stable on disk.
> It is insufficient to flush dirty pages in the page cache because that
> won't necessarily result in filesystems pushing all their metadata out
> to disk.  Therefore, call fsync from iomap_swapfile_activate.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/iomap.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 206539d369a8..48622bbbd751 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -1387,7 +1387,11 @@ int iomap_swapfile_activate(struct swap_info_struct *sis,
>  	loff_t len = ALIGN_DOWN(i_size_read(inode), PAGE_SIZE);
>  	loff_t ret;
>  
> -	ret = filemap_write_and_wait(inode->i_mapping);
> +	/*
> +	 * Persist all file mapping metadata so that we won't have any
> +	 * IOMAP_F_DIRTY iomaps.
> +	 */
> +	ret = vfs_fsync(swap_file, 0);

datasync semantics should be more than enough, so you can pass 1 here..

      reply	other threads:[~2018-06-05 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 16:16 [PATCH] iomap: fsync swap files before iterating mappings Darrick J. Wong
2018-06-05 16:25 ` Christoph Hellwig [this message]

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=20180605162524.GA16104@infradead.org \
    --to=hch@infradead.org \
    --cc=cyberax@amazon.com \
    --cc=darrick.wong@oracle.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=osandov@osandov.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