linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, "Theodore Tso" <tytso@mit.edu>
Subject: [ 16/32] ext4: make sure the journal sb is written in ext4_clear_journal_err()
Date: Sun, 19 Aug 2012 20:57:12 -0700	[thread overview]
Message-ID: <20120820035650.114172576@linuxfoundation.org> (raw)
In-Reply-To: <20120820035647.862247088@linuxfoundation.org>

From: Greg KH <gregkh@linuxfoundation.org>

3.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit d796c52ef0b71a988364f6109aeb63d79c5b116b upstream.

After we transfer set the EXT4_ERROR_FS bit in the file system
superblock, it's not enough to call jbd2_journal_clear_err() to clear
the error indication from journal superblock --- we need to call
jbd2_journal_update_sb_errno() as well.  Otherwise, when the root file
system is mounted read-only, the journal is replayed, and the error
indicator is transferred to the superblock --- but the s_errno field
in the jbd2 superblock is left set (since although we cleared it in
memory, we never flushed it out to disk).

This can end up confusing e2fsck.  We should make e2fsck more robust
in this case, but the kernel shouldn't be leaving things in this
confused state, either.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/super.c      |    1 +
 fs/jbd2/journal.c    |    3 ++-
 include/linux/jbd2.h |    1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4227,6 +4227,7 @@ static void ext4_clear_journal_err(struc
 		ext4_commit_super(sb, 1);
 
 		jbd2_journal_clear_err(journal);
+		jbd2_journal_update_sb_errno(journal);
 	}
 }
 
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1340,7 +1340,7 @@ static void jbd2_mark_journal_empty(jour
  * Update a journal's errno.  Write updated superblock to disk waiting for IO
  * to complete.
  */
-static void jbd2_journal_update_sb_errno(journal_t *journal)
+void jbd2_journal_update_sb_errno(journal_t *journal)
 {
 	journal_superblock_t *sb = journal->j_superblock;
 
@@ -1352,6 +1352,7 @@ static void jbd2_journal_update_sb_errno
 
 	jbd2_write_superblock(journal, WRITE_SYNC);
 }
+EXPORT_SYMBOL(jbd2_journal_update_sb_errno);
 
 /*
  * Read the superblock for a given journal, performing initial
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1091,6 +1091,7 @@ extern int	   jbd2_journal_destroy    (j
 extern int	   jbd2_journal_recover    (journal_t *journal);
 extern int	   jbd2_journal_wipe       (journal_t *, int);
 extern int	   jbd2_journal_skip_recovery	(journal_t *);
+extern void	   jbd2_journal_update_sb_errno(journal_t *);
 extern void	   jbd2_journal_update_sb_log_tail	(journal_t *, tid_t,
 				unsigned long, int);
 extern void	   __jbd2_journal_abort_hard	(journal_t *);



  parent reply	other threads:[~2012-08-20  4:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-20  3:56 [ 00/32] 3.4.10-stable review Greg Kroah-Hartman
2012-08-20  3:56 ` [ 01/32] s390/compat: fix compat wrappers for process_vm system calls Greg Kroah-Hartman
2012-08-20  3:56 ` [ 02/32] s390/compat: fix mmap compat " Greg Kroah-Hartman
2012-08-20  3:56 ` [ 03/32] dma: imx-dma: Fix kernel crash due to missing clock conversion Greg Kroah-Hartman
2012-08-20  3:57 ` [ 04/32] fuse: verify all ioctl retry iov elements Greg Kroah-Hartman
2012-08-20  3:57 ` [ 05/32] xen: mark local pages as FOREIGN in the m2p_override Greg Kroah-Hartman
2012-08-20  3:57 ` [ 06/32] drm/i915: prefer wide & slow to fast & narrow in DP configs Greg Kroah-Hartman
2012-08-20  3:57 ` [ 07/32] drm/nvd0/disp: mask off high 16 bit of negative cursor x-coordinate Greg Kroah-Hartman
2012-08-20  3:57 ` [ 08/32] drm/i915: correctly order the ring init sequence Greg Kroah-Hartman
2012-08-24 23:03   ` Herton Ronaldo Krzesinski
2012-08-27  4:42     ` Greg Kroah-Hartman
2012-08-20  3:57 ` [ 09/32] drm/i915: ignore eDP bpc settings from vbt Greg Kroah-Hartman
2012-08-20  3:57 ` [ 10/32] drm/i915: reorder edp disabling to fix ivb MacBook Air Greg Kroah-Hartman
2012-08-20  3:57 ` [ 11/32] drm/radeon: properly handle crtc powergating Greg Kroah-Hartman
2012-08-20  3:57 ` [ 12/32] drm/radeon: do not reenable crtc after moving vram start address Greg Kroah-Hartman
2012-08-20  3:57 ` [ 13/32] drm/radeon: add some new SI pci ids Greg Kroah-Hartman
2012-08-20  3:57 ` [ 14/32] drm/radeon: fix bank tiling parameters on cayman Greg Kroah-Hartman
2012-08-20  3:57 ` [ 15/32] drm/radeon: fix bank tiling parameters on evergreen Greg Kroah-Hartman
2012-08-20  3:57 ` Greg Kroah-Hartman [this message]
2012-09-07  2:55   ` [ 16/32] ext4: make sure the journal sb is written in ext4_clear_journal_err() Ben Hutchings
2012-08-20  3:57 ` [ 17/32] ext4: avoid kmemcheck complaint from reading uninitialized memory Greg Kroah-Hartman
2012-08-20  3:57 ` [ 18/32] ext4: fix long mount times on very big file systems Greg Kroah-Hartman
2012-08-20  3:57 ` [ 19/32] ext4: fix kernel BUG on large-scale rm -rf commands Greg Kroah-Hartman
2012-08-20  3:57 ` [ 20/32] xhci: Add Etron XHCI_TRUST_TX_LENGTH quirk Greg Kroah-Hartman
2012-08-20  3:57 ` [ 21/32] xhci: Increase reset timeout for Renesas 720201 host Greg Kroah-Hartman
2012-08-20  3:57 ` [ 22/32] xhci: Switch PPT ports to EHCI on shutdown Greg Kroah-Hartman
2012-08-20  3:57 ` [ 23/32] xhci: Fix bug after deq ptr set to link TRB Greg Kroah-Hartman
2012-08-20  3:57 ` [ 24/32] USB: add USB_VENDOR_AND_INTERFACE_INFO() macro Greg Kroah-Hartman
2012-08-20  3:57 ` [ 25/32] pmac_zilog,kdb: Fix console poll hook to return instead of loop Greg Kroah-Hartman
2012-08-20  3:57 ` [ 26/32] IB/srp: Fix a race condition Greg Kroah-Hartman
2012-08-20  3:57 ` [ 27/32] USB: support the new interfaces of Huawei Data Card devices in option driver Greg Kroah-Hartman
2012-08-20  3:57 ` [ 28/32] USB: option: add ZTE K5006-Z Greg Kroah-Hartman
2012-08-20  3:57 ` [ 29/32] USB: ftdi_sio: Add VID/PID for Kondo Serial USB Greg Kroah-Hartman
2012-08-20  3:57 ` [ 30/32] usb: serial: mos7840: Fixup mos7840_chars_in_buffer() Greg Kroah-Hartman
2012-08-20  3:57 ` [ 31/32] usb: gadget: u_ether: fix kworker 100% CPU issue with still used interfaces in eth_stop Greg Kroah-Hartman
2012-08-20  3:57 ` [ 32/32] rt2x00: Add support for BUFFALO WLI-UC-GNM2 to rt2800usb Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120820035650.114172576@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).