From: Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH] jbd: always mark super uptodate before dirty
References: bnc#618767
Patch-mainline: Unknown

 The superblock's bh is something of an exception. It is only read
 during mount and is only released during unmount. The in-memory
 copy is invariably the most recent one.

 If a write error occurs while syncing the superblock, it will be marked
 !uptodate. When the journal shuts down at umount (or is synced out
 otherwise), journal_update_superblock will mark it dirty and try to
 sync it out again. If the buffer is !uptodate, then mark_buffer_dirty
 will issue a warning, but continue anyway.

 This patch marks it uptodate before writing it out. This doesn't really
 change anything other than silencing the warning in mark_buffer_dirty.
 If the write succeeds, good. Otherwise, it will just have uptodate
 cleared again.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/jbd/journal.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-3.0-tmp-jikos/fs/jbd/journal.c
===================================================================
--- linux-3.0-tmp-jikos.orig/fs/jbd/journal.c
+++ linux-3.0-tmp-jikos/fs/jbd/journal.c
@@ -1051,6 +1051,7 @@ void journal_update_superblock(journal_t
 	spin_unlock(&journal->j_state_lock);
 
 	BUFFER_TRACE(bh, "marking dirty");
+	set_buffer_uptodate(bh);
 	mark_buffer_dirty(bh);
 	if (wait) {
 		sync_dirty_buffer(bh);
