From 42672c40ee8aa9ff35e300f480f4362e3c2b2fb4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 20 Jun 2015 22:51:17 -0400 Subject: [PATCH] add patch sync-before-invalidating-blockdev --- series | 1 + sync-before-invalidating-blockdev | 29 +++++++++++++++++++++++++++++ timestamps | 7 ++++--- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 sync-before-invalidating-blockdev diff --git a/series b/series index 7bf8d686..ac5ba234 100644 --- a/series +++ b/series @@ -54,6 +54,7 @@ improve-warning-directory-handling-messages jbd2-get-rid-of-open-coded-allocation-retry-loop speedup-jbd2_journal_dirty_metadata +sync-before-invalidating-blockdev ########################################## # unstable patches diff --git a/sync-before-invalidating-blockdev b/sync-before-invalidating-blockdev new file mode 100644 index 00000000..1dbf8cd9 --- /dev/null +++ b/sync-before-invalidating-blockdev @@ -0,0 +1,29 @@ +ext4: call sync_blockdev() before invalidate_bdev() in put_super() + +Normally all of the buffers will have been forced out to disk before +we call invalidate_bdev(), but there will be some cases, where a file +system operation was aborted due to an ext4_error(), where there may +still be some dirty buffers in the buffer cache for the device. So +try to force them out to memory before calling invalidate_bdev(). + +This fixes a warning triggered by generic/081: + +WARNING: CPU: 1 PID: 3473 at /usr/projects/linux/ext4/fs/block_dev.c:56 __blkdev_put+0xb5/0x16f() + +Signed-off-by: Theodore Ts'o +--- + fs/ext4/super.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index fdac076..2858ac0 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -828,6 +828,7 @@ static void ext4_put_super(struct super_block *sb) + dump_orphan_list(sb, sbi); + J_ASSERT(list_empty(&sbi->s_orphan)); + ++ sync_blockdev(sb->s_bdev); + invalidate_bdev(sb->s_bdev); + if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) { + /* diff --git a/timestamps b/timestamps index 227f31ec..f6282a82 100755 --- a/timestamps +++ b/timestamps @@ -70,6 +70,7 @@ touch -d @1434394226 improve-warning-directory-handling-messages touch -d @1434397558 jbd2-get-rid-of-open-coded-allocation-retry-loop touch -d @1434397618 stable-boundary touch -d @1434851057 speedup-jbd2_journal_dirty_metadata -touch -d @1434851076 series -touch -d @1434851086 status -touch -d @1434854682 timestamps +touch -d @1434854818 series +touch -d @1434855033 sync-before-invalidating-blockdev +touch -d @1434855034 status +touch -d @1434855068 timestamps -- 2.11.4.GIT