Commit 86a90b1c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Kleikamp

JFS: sync blockdevice at umount

We need to sync the blockdevice mapping at umount although sync_blockdev
already does it as we need to make sure everything hits the disk before
we mark the superblock clean.

Found by Dave Kleikamp.
parent 2f57d1c3
......@@ -49,13 +49,14 @@
*/
int jfs_umount(struct super_block *sb)
{
int rc = 0;
log_t *log;
struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
struct jfs_sb_info *sbi = JFS_SBI(sb);
struct inode *ipbmap = sbi->ipbmap;
struct inode *ipimap = sbi->ipimap;
struct inode *ipaimap = sbi->ipaimap;
struct inode *ipaimap2 = sbi->ipaimap2;
log_t *log;
int rc = 0;
jFYI(1, ("\n UnMount JFS: sb:0x%p\n", sb));
......@@ -108,6 +109,14 @@ int jfs_umount(struct super_block *sb)
diFreeSpecial(ipbmap);
sbi->ipimap = NULL;
/*
* Make sure all metadata makes it to disk before we mark
* the superblock as clean
*/
filemap_fdatawait(bdev_mapping);
filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(bdev_mapping);
/*
* ensure all file system file pages are propagated to their
* home blocks on disk (and their in-memory buffer pages are
......@@ -133,6 +142,7 @@ int jfs_umount(struct super_block *sb)
int jfs_umount_rw(struct super_block *sb)
{
struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
struct jfs_sb_info *sbi = JFS_SBI(sb);
log_t *log = sbi->log;
......@@ -152,6 +162,16 @@ int jfs_umount_rw(struct super_block *sb)
dbSync(sbi->ipbmap);
diSync(sbi->ipimap);
/*
* Note that we have to do this even if sync_blockdev() will
* do exactly the same a few instructions later: We can't
* mark the superblock clean before everything is flushed to
* disk.
*/
filemap_fdatawait(bdev_mapping);
filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(bdev_mapping);
updateSuper(sb, FM_CLEAN);
sbi->log = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment