add patch sync-before-invalidating-blockdev
[ext4-patch-queue.git] / sync-before-invalidating-blockdev
blob1dbf8cd9950ffdd4a48c5e252ea857fe925e3937
1 ext4: call sync_blockdev() before invalidate_bdev() in put_super()
3 Normally all of the buffers will have been forced out to disk before
4 we call invalidate_bdev(), but there will be some cases, where a file
5 system operation was aborted due to an ext4_error(), where there may
6 still be some dirty buffers in the buffer cache for the device.  So
7 try to force them out to memory before calling invalidate_bdev().
9 This fixes a warning triggered by generic/081:
11 WARNING: CPU: 1 PID: 3473 at /usr/projects/linux/ext4/fs/block_dev.c:56 __blkdev_put+0xb5/0x16f()
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 ---
15  fs/ext4/super.c | 1 +
16  1 file changed, 1 insertion(+)
18 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
19 index fdac076..2858ac0 100644
20 --- a/fs/ext4/super.c
21 +++ b/fs/ext4/super.c
22 @@ -828,6 +828,7 @@ static void ext4_put_super(struct super_block *sb)
23                 dump_orphan_list(sb, sbi);
24         J_ASSERT(list_empty(&sbi->s_orphan));
26 +       sync_blockdev(sb->s_bdev);
27         invalidate_bdev(sb->s_bdev);
28         if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) {
29                 /*