diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-05 09:53:05 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-05 09:53:05 -0700 |
commit | 117a148ffe0026ddb64d0b7d9b907a1d9bc13e27 (patch) | |
tree | 26c771f802f986c63749c3f94d26828b00efe259 /fs/iomap.c | |
parent | 89c2e71123badc1e75316ccd969ee8a5c6fd921a (diff) |
iomap: fsync swap files before iterating mappings
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/iomap.c')
-rw-r--r-- | fs/iomap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/iomap.c b/fs/iomap.c index 206539d369a8..2bd04f0451f2 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, 1); if (ret) return ret; |